#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 */
double BoysAsymptotic(double, int);
double BoysSum(double, int, double);
int atoi(char *);
int /*<<< orphan*/ printf(char *, double, int, double, double);
int main(int argc, char *argv[]) {
  int n = (argc > 1) ? atoi(argv[1]) : 0;
  for (int i = 0; i < 30; ++i) {
    double x = (double)i;
    double a = BoysAsymptotic(x, n);
    double s = BoysSum(x, n, 1.0e-13);
    printf("Boys(%8.5lf,%d) = %20.10e (asymp) %20.10e (sum) \n", x, n, a, s);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1175 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x34(%rbp)
jmp    117f <main+0x3f>
xor    %eax,%eax
mov    %eax,-0x34(%rbp)
jmp    117f <main+0x3f>
mov    -0x34(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x1e,-0x18(%rbp)
jge    11f8 <main+0xb8>
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x14(%rbp),%edi
call   1050 <BoysAsymptotic@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x14(%rbp),%edi
movsd  0xe3e(%rip),%xmm1
call   1030 <BoysSum@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x14(%rbp),%esi
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118c <main+0x4c>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
cmp    $0x2,%edi
jl     115a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
xorpd  %xmm0,%xmm0
mov    $0x1e,%ebp
lea    0xea6(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mov    %ebx,%edi
call   1050 <BoysAsymptotic@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
mov    %ebx,%edi
movsd  0xe6a(%rip),%xmm1
call   1030 <BoysSum@plt>
movaps %xmm0,%xmm2
mov    %r14,%rdi
movsd  (%rsp),%xmm0
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm1
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
addsd  0xe48(%rip),%xmm0
add    $0xffffffff,%ebp
jne    1170 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Boys(%8.5lf,%d) = %20.10e (asymp) %20.10e (sum) \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
br label %19
18: ; preds = %2
br label %19
19: ; preds = %18, %13
%20 = phi i32 [ %17, %13 ], [ 0, %18 ]
store i32 %20, i32* %6
store i32 0, i32* %7
br label %21
21: ; preds = %38, %19
%22 = load i32, i32* %7
%23 = icmp slt i32 %22, 30
br i1 %23, label %24, label %41
24: ; preds = %21
%25 = load i32, i32* %7
%26 = sitofp i32 %25 to double
store double %26, double* %8
%27 = load double, double* %8
%28 = load i32, i32* %6
%29 = call double @BoysAsymptotic(double %27, i32 %28)
store double %29, double* %9
%30 = load double, double* %8
%31 = load i32, i32* %6
%32 = call double @BoysSum(double %30, i32 %31, double 1.000000e-13)
store double %32, double* %10
%33 = load double, double* %8
%34 = load i32, i32* %6
%35 = load double, double* %9
%36 = load double, double* %10
%37 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), double %33, i32 %34, double %35, double %36)
br label %38
38: ; preds = %24
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %21
41: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"Boys(%8.5lf,%d) = %20.10e (asymp) %20.10e (sum) \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
br label %11
10: ; preds = %11
ret i32 0
11: ; preds = %8, %11
%12 = phi i32 [ 0, %8 ], [ %17, %11 ]
%13 = sitofp i32 %12 to double
%14 = tail call double @BoysAsymptotic(double %13, i32 %9)
%15 = tail call double @BoysSum(double %13, i32 %9, double 1.000000e-13)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), double %13, i32 %9, double %14, double %15)
%17 = add nuw nsw i32 %12, 1
%18 = icmp eq i32 %17, 30
br i1 %18, label %10, label %11
}