#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 pitoprecision(int);
double pow(int, int);
int /*<<< orphan*/ printf(char *, double, int, double);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int n = 5;
  if (argc > 1) {
    n = strtol(argv[1], NULL, 10);
  }
  double pi = pitoprecision(n);
  printf("10**3=%f, pi(%d) is %1.20f\n", pow(10, 3), n, pi);
  return 0;
}


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   $0x5,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1180 <main+0x40>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <pitoprecision@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0xa,%edi
mov    $0x3,%esi
call   1060 <pow@plt>
mov    -0x14(%rbp),%esi
movsd  -0x20(%rbp),%xmm1
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x5,%ebx
cmp    $0x2,%edi
jl     1161 <main+0x21>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebx
mov    %ebx,%edi
call   1030 <pitoprecision@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xa,%edi
mov    $0x3,%esi
call   1060 <pow@plt>
lea    0xe7c(%rip),%rdi
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm1
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"10**3=%f, pi(%d) is %1.20f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strtol(i8* %13, i32* null, i32 10)
store i32 %14, i32* %6
br label %15
15: ; preds = %10, %2
%16 = load i32, i32* %6
%17 = call double @pitoprecision(i32 %16)
store double %17, double* %7
%18 = call double @pow(i32 10, i32 3)
%19 = load i32, i32* %6
%20 = load double, double* %7
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %18, i32 %19, double %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"10**3=%f, pi(%d) is %1.20f\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 @strtol(i8* nocapture %6, i32* null, i32 10)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 5, %2 ]
%10 = tail call double @pitoprecision(i32 %9)
%11 = tail call double @pow(i32 10, i32 3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %11, i32 %9, double %10)
ret i32 0
}