#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 atoi(char *);
double pow(double, double);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **arg) {
  if (argc != 2) {
    printf("Wrong number of arguments.");
    return 1;
  }
  double f1 = 0.0;
  double f2 = 0.0;
  double x1 = 1.0 / 5.0;
  double x2 = 1.0 / 239.0;
  long ite = pow(10, atoi(arg[1]));
  double nnn;
  for (double n = 1; n < ite; n++) {
    nnn = (2 * n) - 1;
    f1 += (pow((-1), (n + 1)) * pow(x1, nnn) / (nnn));
    f2 += (pow((-1), (n + 1)) * pow(x2, nnn) / (nnn));
  }
  double pi = 16.0 * f1 - 4.0 * f2;
  printf("Pi is =\x1B[35m %.22f\x1B[0m, almost\nProper pi is about = "
         "3.141592653590\n",
         pi);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116a <main+0x3a>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12f7 <main+0x1c7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe81(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
movaps %xmm0,%xmm1
movsd  0xe5c(%rip),%xmm0
call   1040 <pow@plt>
cvttsd2si %xmm0,%rax
mov    %rax,-0x38(%rbp)
movsd  0xe3e(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm1
cvtsi2sdq -0x38(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    129f <main+0x16f>
movsd  -0x48(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe43(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe02(%rip),%xmm1
addsd  -0x48(%rbp),%xmm1
movsd  0xe25(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xdb9(%rip),%xmm1
addsd  -0x48(%rbp),%xmm1
movsd  0xddc(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x40(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xd70(%rip),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    11c7 <main+0x97>
movsd  -0x18(%rbp),%xmm0
movsd  0xd7c(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd50(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xd6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x78,%rsp
cmp    $0x2,%edi
jne    126c <main+0x13c>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
movapd %xmm0,%xmm1
movsd  0xeae(%rip),%xmm0
call   1040 <pow@plt>
cvttsd2si %xmm0,%rax
cmp    $0x2,%rax
jl     1284 <main+0x154>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm1,%xmm1
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,0x60(%rsp)
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe7c(%rip),%xmm2
addsd  %xmm2,%xmm1
movapd %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xe5c(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movapd %xmm0,0x50(%rsp)
movsd  0xe49(%rip),%xmm0
movaps 0x10(%rsp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,0x40(%rsp)
movsd  0xe2a(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <pow@plt>
movaps %xmm0,0x30(%rsp)
movsd  0xe22(%rip),%xmm0
movaps 0x10(%rsp),%xmm1
call   1040 <pow@plt>
movapd 0x60(%rsp),%xmm1
movapd 0x50(%rsp),%xmm2
unpcklpd 0x30(%rsp),%xmm2
movapd 0x40(%rsp),%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm2,%xmm3
movapd 0x10(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm3
addpd  %xmm3,%xmm1
movsd  0x28(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
ja     1180 <main+0x50>
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
mulsd  0xdc6(%rip),%xmm0
jmp    1290 <main+0x160>
lea    0xdcd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x78,%rsp
ret
xorpd  %xmm1,%xmm1
movsd  0xd78(%rip),%xmm0
mulsd  0xda0(%rip),%xmm1
addsd  %xmm0,%xmm1
lea    0xdb8(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Wrong number of arguments.\00"
@.str.1 = [68 x i8] c"Pi is =\1B[35m %.22f\1B[0m, almost\0AProper pi is about = 3.141592653590\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i64
%11 = alloca double
%12 = alloca double
%13 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %66
18: ; preds = %2
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 2.000000e-01, double* %8
store double 0x3F712358E75D3033, double* %9
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call double @atoi(i8* %21)
%23 = call double @pow(double 1.000000e+01, double %22)
%24 = fptosi double %23 to i64
store i64 %24, i64* %10
store double 1.000000e+00, double* %12
br label %25
25: ; preds = %55, %18
%26 = load double, double* %12
%27 = load i64, i64* %10
%28 = sitofp i64 %27 to double
%29 = fcmp olt double %26, %28
br i1 %29, label %30, label %58
30: ; preds = %25
%31 = load double, double* %12
%32 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %31, double -1.000000e+00)
store double %32, double* %11
%33 = load double, double* %12
%34 = fadd double %33, 1.000000e+00
%35 = call double @pow(double -1.000000e+00, double %34)
%36 = load double, double* %8
%37 = load double, double* %11
%38 = call double @pow(double %36, double %37)
%39 = fmul double %35, %38
%40 = load double, double* %11
%41 = fdiv double %39, %40
%42 = load double, double* %6
%43 = fadd double %42, %41
store double %43, double* %6
%44 = load double, double* %12
%45 = fadd double %44, 1.000000e+00
%46 = call double @pow(double -1.000000e+00, double %45)
%47 = load double, double* %9
%48 = load double, double* %11
%49 = call double @pow(double %47, double %48)
%50 = fmul double %46, %49
%51 = load double, double* %11
%52 = fdiv double %50, %51
%53 = load double, double* %7
%54 = fadd double %53, %52
store double %54, double* %7
br label %55
55: ; preds = %30
%56 = load double, double* %12
%57 = fadd double %56, 1.000000e+00
store double %57, double* %12
br label %25
58: ; preds = %25
%59 = load double, double* %6
%60 = load double, double* %7
%61 = fmul double 4.000000e+00, %60
%62 = fneg double %61
%63 = call double @llvm.fmuladd.f64(double 1.600000e+01, double %59, double %62)
store double %63, double* %13
%64 = load double, double* %13
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), double %64)
store i32 0, i32* %3
br label %66
66: ; preds = %58, %16
%67 = load i32, i32* %3
ret i32 %67
}

LLVM IR (-O2):
@.str = [27 x i8] c"Wrong number of arguments.\00"
@.str.1 = [68 x i8] c"Pi is =\1B[35m %.22f\1B[0m, almost\0AProper pi is about = 3.141592653590\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %42
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call double @atoi(i8* %8)
%10 = tail call double @pow(double 1.000000e+01, double %9)
%11 = fptosi double %10 to i64
%12 = sitofp i64 %11 to double
%13 = icmp sgt i64 %11, 1
br i1 %13, label %23, label %18
14: ; preds = %23
%15 = extractelement <2 x double> %40, i64 1
%16 = fmul double %15, -4.000000e+00
%17 = extractelement <2 x double> %40, i64 0
br label %18
18: ; preds = %14, %6
%19 = phi double [ -0.000000e+00, %6 ], [ %16, %14 ]
%20 = phi double [ 0.000000e+00, %6 ], [ %17, %14 ]
%21 = tail call double @llvm.fmuladd.f64(double %20, double 1.600000e+01, double %19)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0), double %21)
br label %42
23: ; preds = %6, %23
%24 = phi double [ %27, %23 ], [ 1.000000e+00, %6 ]
%25 = phi <2 x double> [ %40, %23 ], [ zeroinitializer, %6 ]
%26 = tail call double @llvm.fmuladd.f64(double %24, double 2.000000e+00, double -1.000000e+00)
%27 = fadd double %24, 1.000000e+00
%28 = tail call double @pow(double -1.000000e+00, double %27)
%29 = tail call double @pow(double 2.000000e-01, double %26)
%30 = tail call double @pow(double -1.000000e+00, double %27)
%31 = tail call double @pow(double 0x3F712358E75D3033, double %26)
%32 = insertelement <2 x double> poison, double %28, i64 0
%33 = insertelement <2 x double> %32, double %30, i64 1
%34 = insertelement <2 x double> poison, double %29, i64 0
%35 = insertelement <2 x double> %34, double %31, i64 1
%36 = fmul <2 x double> %33, %35
%37 = insertelement <2 x double> poison, double %26, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = fdiv <2 x double> %36, %38
%40 = fadd <2 x double> %25, %39
%41 = fcmp olt double %27, %12
br i1 %41, label %23, label %14
42: ; preds = %18, %4
%43 = phi i32 [ 1, %4 ], [ 0, %18 ]
ret i32 %43
}