#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 pow(int, double);
int /*<<< orphan*/ printf(char *, double, double);
int main(void) {
  double n = 100, i, pie = 0;
  for (n; n <= 1000000; n *= 10) {
    pie = 0;
    for (i = 1; i <= n; i++) {
      pie += 4 * (pow(-1, i + 1) / ((2 * i) - 1));
    }
    printf("%7.lf    %lf\n", n, pie);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xebc(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1212 <main+0xf2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11e5 <main+0xc5>
movsd  0xe88(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    $0xffffffff,%edi
call   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xe7c(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xe5f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe3a(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    116c <main+0x4c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe3a(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe15(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1144 <main+0x24>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movsd  0xed4(%rip),%xmm2
xorpd  %xmm1,%xmm1
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  0xebd(%rip),%xmm0
addsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
mov    $0xffffffff,%edi
movapd %xmm2,%xmm0
call   1040 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm2,%xmm2
movsd  0xe95(%rip),%xmm0
addsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
movsd  0xe8d(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0xe5f(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0xffffffff,%edi
call   1040 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
addsd  0xe3f(%rip),%xmm0
divsd  %xmm0,%xmm1
mulsd  0xe3b(%rip),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0xe35(%rip),%xmm0
movsd  (%rsp),%xmm2
ucomisd %xmm2,%xmm0
jae    1130 <main+0x10>
lea    0xe47(%rip),%rdi
movsd  0xe17(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xdf2(%rip),%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm0
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
addsd  0xdcc(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0xffffffff,%edi
movsd  (%rsp),%xmm0
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm2
addsd  0xda1(%rip),%xmm2
divsd  %xmm2,%xmm0
mulsd  0xd9d(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xda1(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm2
jae    1220 <main+0x100>
lea    0xdaa(%rip),%rdi
movsd  0xd82(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xd55(%rip),%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
addsd  0xd2c(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0xffffffff,%edi
movsd  (%rsp),%xmm0
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm2
addsd  0xd01(%rip),%xmm2
divsd  %xmm2,%xmm0
mulsd  0xcfd(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd09(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm2
jae    12c0 <main+0x1a0>
lea    0xd0a(%rip),%rdi
movsd  0xcea(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xcb5(%rip),%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
addsd  0xc8c(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0xffffffff,%edi
movsd  (%rsp),%xmm0
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm2
addsd  0xc61(%rip),%xmm2
divsd  %xmm2,%xmm0
mulsd  0xc5d(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xc71(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm2
jae    1360 <main+0x240>
lea    0xc6a(%rip),%rdi
movsd  0xc52(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xc15(%rip),%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm2,%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
addsd  0xbec(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    $0xffffffff,%edi
movsd  (%rsp),%xmm0
call   1040 <pow@plt>
movsd  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm2
addsd  0xbc1(%rip),%xmm2
divsd  %xmm2,%xmm0
mulsd  0xbbd(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xbd9(%rip),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm2
jae    1400 <main+0x2e0>
lea    0xbca(%rip),%rdi
movsd  0xbba(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%7.lf %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store double 1.000000e+02, double* %2
store double 0.000000e+00, double* %4
%5 = load double, double* %2
br label %6
6: ; preds = %31, %0
%7 = load double, double* %2
%8 = fcmp ole double %7, 1.000000e+06
br i1 %8, label %9, label %34
9: ; preds = %6
store double 0.000000e+00, double* %4
store double 1.000000e+00, double* %3
br label %10
10: ; preds = %24, %9
%11 = load double, double* %3
%12 = load double, double* %2
%13 = fcmp ole double %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load double, double* %3
%16 = fadd double %15, 1.000000e+00
%17 = call i32 @pow(i32 -1, double %16)
%18 = sitofp i32 %17 to double
%19 = load double, double* %3
%20 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %19, double -1.000000e+00)
%21 = fdiv double %18, %20
%22 = load double, double* %4
%23 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %21, double %22)
store double %23, double* %4
br label %24
24: ; preds = %14
%25 = load double, double* %3
%26 = fadd double %25, 1.000000e+00
store double %26, double* %3
br label %10
27: ; preds = %10
%28 = load double, double* %2
%29 = load double, double* %4
%30 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %28, double %29)
br label %31
31: ; preds = %27
%32 = load double, double* %2
%33 = fmul double %32, 1.000000e+01
store double %33, double* %2
br label %6
34: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%7.lf %lf\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi double [ 0.000000e+00, %0 ], [ %15, %1 ]
%3 = phi double [ 1.000000e+00, %0 ], [ %10, %1 ]
%4 = fadd double %3, 1.000000e+00
%5 = tail call i32 @pow(i32 -1, double %4)
%6 = sitofp i32 %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %3, double 2.000000e+00, double -1.000000e+00)
%8 = fdiv double %6, %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double 4.000000e+00, double %2)
%10 = fadd double %4, 1.000000e+00
%11 = tail call i32 @pow(i32 -1, double %10)
%12 = sitofp i32 %11 to double
%13 = tail call double @llvm.fmuladd.f64(double %4, double 2.000000e+00, double -1.000000e+00)
%14 = fdiv double %12, %13
%15 = tail call double @llvm.fmuladd.f64(double %14, double 4.000000e+00, double %9)
%16 = fcmp ugt double %10, 1.000000e+02
br i1 %16, label %17, label %1
17: ; preds = %1
%18 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 1.000000e+02, double %15)
br label %19
19: ; preds = %19, %17
%20 = phi double [ %27, %19 ], [ 0.000000e+00, %17 ]
%21 = phi double [ %22, %19 ], [ 1.000000e+00, %17 ]
%22 = fadd double %21, 1.000000e+00
%23 = tail call i32 @pow(i32 -1, double %22)
%24 = sitofp i32 %23 to double
%25 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double -1.000000e+00)
%26 = fdiv double %24, %25
%27 = tail call double @llvm.fmuladd.f64(double %26, double 4.000000e+00, double %20)
%28 = fcmp ugt double %22, 1.000000e+03
br i1 %28, label %29, label %19
29: ; preds = %19
%30 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 1.000000e+03, double %27)
br label %31
31: ; preds = %31, %29
%32 = phi double [ %39, %31 ], [ 0.000000e+00, %29 ]
%33 = phi double [ %34, %31 ], [ 1.000000e+00, %29 ]
%34 = fadd double %33, 1.000000e+00
%35 = tail call i32 @pow(i32 -1, double %34)
%36 = sitofp i32 %35 to double
%37 = tail call double @llvm.fmuladd.f64(double %33, double 2.000000e+00, double -1.000000e+00)
%38 = fdiv double %36, %37
%39 = tail call double @llvm.fmuladd.f64(double %38, double 4.000000e+00, double %32)
%40 = fcmp ugt double %34, 1.000000e+04
br i1 %40, label %41, label %31
41: ; preds = %31
%42 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 1.000000e+04, double %39)
br label %43
43: ; preds = %43, %41
%44 = phi double [ %51, %43 ], [ 0.000000e+00, %41 ]
%45 = phi double [ %46, %43 ], [ 1.000000e+00, %41 ]
%46 = fadd double %45, 1.000000e+00
%47 = tail call i32 @pow(i32 -1, double %46)
%48 = sitofp i32 %47 to double
%49 = tail call double @llvm.fmuladd.f64(double %45, double 2.000000e+00, double -1.000000e+00)
%50 = fdiv double %48, %49
%51 = tail call double @llvm.fmuladd.f64(double %50, double 4.000000e+00, double %44)
%52 = fcmp ugt double %46, 1.000000e+05
br i1 %52, label %53, label %43
53: ; preds = %43
%54 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 1.000000e+05, double %51)
br label %55
55: ; preds = %55, %53
%56 = phi double [ %63, %55 ], [ 0.000000e+00, %53 ]
%57 = phi double [ %58, %55 ], [ 1.000000e+00, %53 ]
%58 = fadd double %57, 1.000000e+00
%59 = tail call i32 @pow(i32 -1, double %58)
%60 = sitofp i32 %59 to double
%61 = tail call double @llvm.fmuladd.f64(double %57, double 2.000000e+00, double -1.000000e+00)
%62 = fdiv double %60, %61
%63 = tail call double @llvm.fmuladd.f64(double %62, double 4.000000e+00, double %56)
%64 = fcmp ugt double %58, 1.000000e+06
br i1 %64, label %65, label %55
65: ; preds = %55
%66 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 1.000000e+06, double %63)
ret i32 0
}