#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 M_E;
double M_PI;
int /*<<< orphan*/ pmm_timer_destroy();
int /*<<< orphan*/ pmm_timer_init();
int /*<<< orphan*/ pmm_timer_result();
int /*<<< orphan*/ pmm_timer_start();
int /*<<< orphan*/ pmm_timer_stop();
int /*<<< orphan*/ printf(char *, double);
scalar_t__ sscanf(char *, char *, double *);
int main(int argc, char **argv) {
  double a;
  double b;
  double c;
  double i;
  if (argc != 1 + 1) {
    return 1;
  }
  if (sscanf(argv[1], "%lf", &i) == 0) {
    return 2;
  }
  printf("%f\n", i);
  a = M_PI;
  b = M_E;
  pmm_timer_init();
  pmm_timer_start();
  while (i > 0.0) {
    c = a * b;
    i = i - 1.0;
  }
  pmm_timer_stop();
  pmm_timer_result();
  pmm_timer_destroy();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1261 <main+0xf1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5d(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x0,%rax
jne    11ca <main+0x5a>
movl   $0x2,-0x4(%rbp)
jmp    1261 <main+0xf1>
movsd  -0x30(%rbp),%xmm0
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e06(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2de6(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <pmm_timer_init@plt>
mov    $0x0,%al
call   1080 <pmm_timer_start@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1245 <main+0xd5>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xdc9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1209 <main+0x99>
mov    $0x0,%al
call   1090 <pmm_timer_stop@plt>
mov    $0x0,%al
call   1060 <pmm_timer_result@plt>
mov    $0x0,%al
call   1050 <pmm_timer_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%ebx
cmp    $0x2,%edi
jne    120c <main+0x9c>
mov    0x8(%rsi),%rdi
lea    0xe7a(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1070 <sscanf@plt>
test   %rax,%rax
je     1207 <main+0x97>
movsd  0x8(%rsp),%xmm0
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <pmm_timer_init@plt>
xor    %eax,%eax
call   1080 <pmm_timer_start@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11f0 <main+0x80>
movsd  0xe29(%rip),%xmm2
nopw   0x0(%rax,%rax,1)
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
ja     11e0 <main+0x70>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1090 <pmm_timer_stop@plt>
xor    %eax,%eax
call   1060 <pmm_timer_result@plt>
xor    %eax,%eax
call   1050 <pmm_timer_destroy@plt>
jmp    120c <main+0x9c>
mov    $0x2,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [4 x i8] c"%f\0A\00"
@M_PI = global double 0.000000e+00
@M_E = global double 0.000000e+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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %3
br label %40
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @sscanf(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %9)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 2, i32* %3
br label %40
20: ; preds = %13
%21 = load double, double* %9
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = load double, double* @M_PI
store double %23, double* %6
%24 = load double, double* @M_E
store double %24, double* %7
%25 = call i32 (...) @pmm_timer_init()
%26 = call i32 (...) @pmm_timer_start()
br label %27
27: ; preds = %30, %20
%28 = load double, double* %9
%29 = fcmp ogt double %28, 0.000000e+00
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load double, double* %6
%32 = load double, double* %7
%33 = fmul double %31, %32
store double %33, double* %8
%34 = load double, double* %9
%35 = fsub double %34, 1.000000e+00
store double %35, double* %9
br label %27
36: ; preds = %27
%37 = call i32 (...) @pmm_timer_stop()
%38 = call i32 (...) @pmm_timer_result()
%39 = call i32 (...) @pmm_timer_destroy()
store i32 0, i32* %3
br label %40
40: ; preds = %36, %19, %12
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [4 x i8] c"%f\0A\00"
@M_PI = global double 0.000000e+00
@M_E = global double 0.000000e+00
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %27
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @sscanf(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %27, label %11
11: ; preds = %6
%12 = load double, double* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = call i32 (...) @pmm_timer_init()
%15 = call i32 (...) @pmm_timer_start()
%16 = load double, double* %3
%17 = fcmp ogt double %16, 0.000000e+00
br i1 %17, label %18, label %23
18: ; preds = %11, %18
%19 = phi double [ %20, %18 ], [ %16, %11 ]
%20 = fadd double %19, -1.000000e+00
%21 = fcmp ogt double %20, 0.000000e+00
br i1 %21, label %18, label %22
22: ; preds = %18
store double %20, double* %3
br label %23
23: ; preds = %22, %11
%24 = call i32 (...) @pmm_timer_stop()
%25 = call i32 (...) @pmm_timer_result()
%26 = call i32 (...) @pmm_timer_destroy()
br label %27
27: ; preds = %6, %2, %23
%28 = phi i32 [ 0, %23 ], [ 1, %2 ], [ 2, %6 ]
ret i32 %28
}