#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(long long);
int /*<<< orphan*/ pmm_timer_result();
int /*<<< orphan*/ pmm_timer_start();
int /*<<< orphan*/ pmm_timer_stop();
scalar_t__ sscanf(char *, char *, double *);
int main(int argc, char **argv) {
  long long complexity;
  double a;
  double b;
  double c;
  double i;
  if (argc != 1 + 1) {
    return 1;
  }
  if (sscanf(argv[1], "%lf", &i) == 0) {
    return 2;
  }
  complexity = 2 * (long long)i;
  a = M_PI;
  b = M_E;
  pmm_timer_init(complexity);
  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    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1250 <main+0xf0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6d(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
jne    11ba <main+0x5a>
movl   $0x2,-0x4(%rbp)
jmp    1250 <main+0xf0>
cvttsd2si -0x38(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    0x2e19(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2df9(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <pmm_timer_init@plt>
mov    $0x0,%al
call   1070 <pmm_timer_start@plt>
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1234 <main+0xd4>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  0xdda(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11f8 <main+0x98>
mov    $0x0,%al
call   1080 <pmm_timer_stop@plt>
mov    $0x0,%al
call   1050 <pmm_timer_result@plt>
mov    $0x0,%al
call   1040 <pmm_timer_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0x1,%ebx
cmp    $0x2,%edi
jne    11ec <main+0x8c>
mov    0x8(%rsi),%rdi
lea    0xe8e(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11e7 <main+0x87>
cvttsd2si 0x8(%rsp),%rdi
add    %rdi,%rdi
call   1030 <pmm_timer_init@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <pmm_timer_start@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11d0 <main+0x70>
movsd  0xe47(%rip),%xmm2
nopl   0x0(%rax)
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
ja     11c0 <main+0x60>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1080 <pmm_timer_stop@plt>
xor    %eax,%eax
call   1050 <pmm_timer_result@plt>
xor    %eax,%eax
call   1040 <pmm_timer_destroy@plt>
jmp    11ec <main+0x8c>
mov    $0x2,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\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 %28
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 %28, label %11
11: ; preds = %6
%12 = load double, double* %3
%13 = fptosi double %12 to i64
%14 = shl nsw i64 %13, 1
%15 = call i32 @pmm_timer_init(i64 %14)
%16 = call i32 (...) @pmm_timer_start()
%17 = load double, double* %3
%18 = fcmp ogt double %17, 0.000000e+00
br i1 %18, label %19, label %24
19: ; preds = %11, %19
%20 = phi double [ %21, %19 ], [ %17, %11 ]
%21 = fadd double %20, -1.000000e+00
%22 = fcmp ogt double %21, 0.000000e+00
br i1 %22, label %19, label %23
23: ; preds = %19
store double %21, double* %3
br label %24
24: ; preds = %23, %11
%25 = call i32 (...) @pmm_timer_stop()
%26 = call i32 (...) @pmm_timer_result()
%27 = call i32 (...) @pmm_timer_destroy()
br label %28
28: ; preds = %6, %2, %24
%29 = phi i32 [ 0, %24 ], [ 1, %2 ], [ 2, %6 ]
ret i32 %29
}