#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 extrapolateSum(double, int const);
double log(int);
double partialSum(double, int const);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  const int N = 10, n = 13;
  int i;
  double xlist[N + 1], val1, val2, val3;
  xlist[N] = 1.25;
  for (i = 0; i < N; i++)
    xlist[i] = 1.0 * i / (N - 1);
  printf("\tpartial sum \textrapolated sum  \ttrue value\n");
  for (i = 0; i < N + 1; i++) {
    val1 = partialSum(xlist[i], n);
    val2 = extrapolateSum(xlist[i], n);
    val3 = log(1 + xlist[i]);
    printf("\n\t%.10f\t%.10f\t\t%.10f \n", val1, val2, val3);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xd,-0xc(%rbp)
mov    %rsp,%rax
mov    %rax,-0x18(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11bd <main+0x7d>
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe76(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0x10(%rbp),%rax
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117b <main+0x3b>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0xb,-0x10(%rbp)
jge    1262 <main+0x122>
movslq -0x10(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,-0x20(%rbp)
movslq -0x10(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
mov    $0xd,%edi
call   1060 <extrapolateSum@plt>
movsd  %xmm0,-0x28(%rbp)
movslq -0x10(%rbp),%rax
movsd  0xde8(%rip),%xmm0
addsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
cvttsd2si %xmm0,%edi
call   1050 <log@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
lea    0xdf8(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d2 <main+0x92>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
movabs $0x3ff4000000000000,%rax
mov    %rax,0x70(%rsp)
xorps  %xmm0,%xmm0
movhps 0xe8f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe93(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe97(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe9f(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%edi
call   1060 <log@plt>
movaps %xmm0,%xmm2
lea    0xe64(%rip),%rbx
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xdc6(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xd63(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xd00(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x40(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xc9d(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xc3a(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x50(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xbd7(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xb74(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x60(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xb11(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x68(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xaae(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
movsd  0x70(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0xd,%edi
call   1030 <partialSum@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0xd,%edi
call   1070 <extrapolateSum@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xa4b(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log@plt>
movapd %xmm0,%xmm2
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mov    $0x3,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\09partial sum \09extrapolated sum \09true value\0A\00"
@.str.1 = [23 x i8] c"\0A\09%.10f\09%.10f\09\09%.10f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
store i32 10, i32* %2
store i32 13, i32* %3
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %5
%10 = alloca double, i64 11
%11 = getelementptr inbounds double, double* %10, i64 10
store double 1.250000e+00, double* %11
store i32 0, i32* %4
br label %12
12: ; preds = %23, %0
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = fmul double 1.000000e+00, %17
%19 = fdiv double %18, 9.000000e+00
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %10, i64 %21
store double %19, double* %22
br label %23
23: ; preds = %15
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %12
26: ; preds = %12
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %28
28: ; preds = %53, %26
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 11
br i1 %30, label %31, label %56
31: ; preds = %28
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %10, i64 %33
%35 = load double, double* %34
%36 = call double @partialSum(double %35, i32 13)
store double %36, double* %6
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %10, i64 %38
%40 = load double, double* %39
%41 = call double @extrapolateSum(double %40, i32 13)
store double %41, double* %7
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %10, i64 %43
%45 = load double, double* %44
%46 = fadd double 1.000000e+00, %45
%47 = fptosi double %46 to i32
%48 = call double @log(i32 %47)
store double %48, double* %8
%49 = load double, double* %6
%50 = load double, double* %7
%51 = load double, double* %8
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %49, double %50, double %51)
br label %53
53: ; preds = %31
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %28
56: ; preds = %28
%57 = load i8*, i8** %5
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"\0A\09%.10f\09%.10f\09\09%.10f \0A\00"
@str = [44 x i8] c"\09partial sum \09extrapolated sum \09true value\00"
define i32 @main() {
%1 = alloca [11 x double]
%2 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 10
store double 1.250000e+00, double* %2
%3 = bitcast [11 x double]* %1 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 0x3FBC71C71C71C71C>, <2 x double>* %3
%4 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 2
%5 = bitcast double* %4 to <2 x double>*
store <2 x double> <double 0x3FCC71C71C71C71C, double 0x3FD5555555555555>, <2 x double>* %5
%6 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 4
%7 = bitcast double* %6 to <2 x double>*
store <2 x double> <double 0x3FDC71C71C71C71C, double 0x3FE1C71C71C71C72>, <2 x double>* %7
%8 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 6
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 0x3FE5555555555555, double 0x3FE8E38E38E38E39>, <2 x double>* %9
%10 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 8
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 0x3FEC71C71C71C71C, double 1.000000e+00>, <2 x double>* %11
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%13 = tail call double @partialSum(double 0.000000e+00, i32 13)
%14 = tail call double @extrapolateSum(double 0.000000e+00, i32 13)
%15 = tail call double @log(i32 1)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %13, double %14, double %15)
%17 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 1
%18 = load double, double* %17
%19 = tail call double @partialSum(double %18, i32 13)
%20 = tail call double @extrapolateSum(double %18, i32 13)
%21 = fadd double %18, 1.000000e+00
%22 = fptosi double %21 to i32
%23 = tail call double @log(i32 %22)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %19, double %20, double %23)
%25 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 2
%26 = load double, double* %25
%27 = tail call double @partialSum(double %26, i32 13)
%28 = tail call double @extrapolateSum(double %26, i32 13)
%29 = fadd double %26, 1.000000e+00
%30 = fptosi double %29 to i32
%31 = tail call double @log(i32 %30)
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %27, double %28, double %31)
%33 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 3
%34 = load double, double* %33
%35 = tail call double @partialSum(double %34, i32 13)
%36 = tail call double @extrapolateSum(double %34, i32 13)
%37 = fadd double %34, 1.000000e+00
%38 = fptosi double %37 to i32
%39 = tail call double @log(i32 %38)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %35, double %36, double %39)
%41 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 4
%42 = load double, double* %41
%43 = tail call double @partialSum(double %42, i32 13)
%44 = tail call double @extrapolateSum(double %42, i32 13)
%45 = fadd double %42, 1.000000e+00
%46 = fptosi double %45 to i32
%47 = tail call double @log(i32 %46)
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %43, double %44, double %47)
%49 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 5
%50 = load double, double* %49
%51 = tail call double @partialSum(double %50, i32 13)
%52 = tail call double @extrapolateSum(double %50, i32 13)
%53 = fadd double %50, 1.000000e+00
%54 = fptosi double %53 to i32
%55 = tail call double @log(i32 %54)
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %51, double %52, double %55)
%57 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 6
%58 = load double, double* %57
%59 = tail call double @partialSum(double %58, i32 13)
%60 = tail call double @extrapolateSum(double %58, i32 13)
%61 = fadd double %58, 1.000000e+00
%62 = fptosi double %61 to i32
%63 = tail call double @log(i32 %62)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %59, double %60, double %63)
%65 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 7
%66 = load double, double* %65
%67 = tail call double @partialSum(double %66, i32 13)
%68 = tail call double @extrapolateSum(double %66, i32 13)
%69 = fadd double %66, 1.000000e+00
%70 = fptosi double %69 to i32
%71 = tail call double @log(i32 %70)
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %67, double %68, double %71)
%73 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 8
%74 = load double, double* %73
%75 = tail call double @partialSum(double %74, i32 13)
%76 = tail call double @extrapolateSum(double %74, i32 13)
%77 = fadd double %74, 1.000000e+00
%78 = fptosi double %77 to i32
%79 = tail call double @log(i32 %78)
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %75, double %76, double %79)
%81 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 9
%82 = load double, double* %81
%83 = tail call double @partialSum(double %82, i32 13)
%84 = tail call double @extrapolateSum(double %82, i32 13)
%85 = fadd double %82, 1.000000e+00
%86 = fptosi double %85 to i32
%87 = tail call double @log(i32 %86)
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %83, double %84, double %87)
%89 = getelementptr inbounds [11 x double], [11 x double]* %1, i64 0, i64 10
%90 = load double, double* %89
%91 = tail call double @partialSum(double %90, i32 13)
%92 = tail call double @extrapolateSum(double %90, i32 13)
%93 = fadd double %90, 1.000000e+00
%94 = fptosi double %93 to i32
%95 = tail call double @log(i32 %94)
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %91, double %92, double %95)
ret i32 0
}