#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 pow(double, double);
int /*<<< orphan*/ printf(char *, double);
int main(int argv, char **argc) {
  int i = 0;
  int numSteps = 11;
  double piSummation = 0.0;
  for (i = 0; i < numSteps; i++) {
    piSummation += (1.0 / (pow(16.0, (double)i))) *
                   ((4.0 / (8.0 * i + 1.0)) - (2.0 / (8.0 * i + 4.0)) -
                    (1.0 / (8.0 * i + 5.0)) - (1.0 / (8.0 * i + 6.0)));
  }
  printf("Pi = %.15f\n", piSummation);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xb,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1250 <main+0x130>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xec4(%rip),%xmm0
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe84(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe7b(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe67(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0xe83(%rip),%xmm2
divsd  %xmm1,%xmm2
cvtsi2sdl -0x14(%rbp),%xmm3
movsd  0xe52(%rip),%xmm1
mulsd  %xmm1,%xmm3
movsd  0xe66(%rip),%xmm1
addsd  %xmm1,%xmm3
movsd  0xe52(%rip),%xmm1
divsd  %xmm3,%xmm1
subsd  %xmm1,%xmm2
cvtsi2sdl -0x14(%rbp),%xmm3
movsd  0xe25(%rip),%xmm1
mulsd  %xmm1,%xmm3
movsd  0xe29(%rip),%xmm1
addsd  %xmm1,%xmm3
movsd  0xe05(%rip),%xmm1
divsd  %xmm3,%xmm1
subsd  %xmm1,%xmm2
cvtsi2sdl -0x14(%rbp),%xmm3
movsd  0xdf8(%rip),%xmm1
mulsd  %xmm1,%xmm3
movsd  0xdf4(%rip),%xmm1
addsd  %xmm1,%xmm3
movsd  0xdd8(%rip),%xmm1
divsd  %xmm3,%xmm1
subsd  %xmm1,%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <main+0x33>
movsd  -0x20(%rbp),%xmm0
lea    0xddc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
mov    $0xb,%ebx
xorpd  %xmm2,%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm0,(%rsp)
movapd %xmm2,%xmm0
mulsd  0xea9(%rip),%xmm0
call   1040 <exp2@plt>
movsd  0xea4(%rip),%xmm4
movapd %xmm4,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  0xe9a(%rip),%xmm2
unpcklpd %xmm2,%xmm2
movapd %xmm2,%xmm3
addpd  0xe9a(%rip),%xmm3
divsd  %xmm0,%xmm1
movapd 0xe9e(%rip),%xmm0
divpd  %xmm3,%xmm0
addpd  0xea2(%rip),%xmm2
movapd 0xeaa(%rip),%xmm3
divpd  %xmm2,%xmm3
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
subsd  %xmm2,%xmm0
movsd  0x8(%rsp),%xmm2
subsd  %xmm3,%xmm0
unpckhpd %xmm3,%xmm3
subsd  %xmm3,%xmm0
mulsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
addsd  %xmm4,%xmm2
add    $0xffffffff,%ebx
jne    1140 <main+0x20>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Pi = %.15f\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 11, i32* %7
store double 0.000000e+00, double* %8
store i32 0, i32* %6
br label %9
9: ; preds = %39, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %42
13: ; preds = %9
%14 = load i32, i32* %6
%15 = sitofp i32 %14 to double
%16 = call double @pow(double 1.600000e+01, double %15)
%17 = fdiv double 1.000000e+00, %16
%18 = load i32, i32* %6
%19 = sitofp i32 %18 to double
%20 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %19, double 1.000000e+00)
%21 = fdiv double 4.000000e+00, %20
%22 = load i32, i32* %6
%23 = sitofp i32 %22 to double
%24 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %23, double 4.000000e+00)
%25 = fdiv double 2.000000e+00, %24
%26 = fsub double %21, %25
%27 = load i32, i32* %6
%28 = sitofp i32 %27 to double
%29 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %28, double 5.000000e+00)
%30 = fdiv double 1.000000e+00, %29
%31 = fsub double %26, %30
%32 = load i32, i32* %6
%33 = sitofp i32 %32 to double
%34 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %33, double 6.000000e+00)
%35 = fdiv double 1.000000e+00, %34
%36 = fsub double %31, %35
%37 = load double, double* %8
%38 = call double @llvm.fmuladd.f64(double %17, double %36, double %37)
store double %38, double* %8
br label %39
39: ; preds = %13
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %9
42: ; preds = %9
%43 = load double, double* %8
%44 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %43)
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@.str = [12 x i8] c"Pi = %.15f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi double [ 0.000000e+00, %2 ], [ %22, %3 ]
%5 = phi i32 [ 0, %2 ], [ %23, %3 ]
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 4.000000e+00
%8 = tail call double @exp2(double %7)
%9 = fdiv double 1.000000e+00, %8
%10 = insertelement <2 x double> poison, double %6, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> <double 8.000000e+00, double 8.000000e+00>, <2 x double> <double 1.000000e+00, double 4.000000e+00>)
%13 = fdiv <2 x double> <double 4.000000e+00, double 2.000000e+00>, %12
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%15 = fsub <2 x double> %13, %14
%16 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> <double 8.000000e+00, double 8.000000e+00>, <2 x double> <double 5.000000e+00, double 6.000000e+00>)
%17 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %16
%18 = fsub <2 x double> %15, %17
%19 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%20 = fsub <2 x double> %18, %19
%21 = extractelement <2 x double> %20, i64 0
%22 = tail call double @llvm.fmuladd.f64(double %9, double %21, double %4)
%23 = add nuw nsw i32 %5, 1
%24 = icmp eq i32 %23, 11
br i1 %24, label %25, label %3
25: ; preds = %3
%26 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double %22)
ret i32 0
}