#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 */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ sscanf(char *, char *, int *);
main(int argc, char **argv) {
  extern float itimerread(int timerid);
  extern void itimerinit(int timerid, int setval);
  int loops, i;
  float before, after;
  sscanf(argv[1], "%d", &loops);
  itimerinit(1, 1000);
  before = itimerread(1);
  for (i = 0; i < loops; i++)
    ;
  after = itimerread(1);
  printf("%f\n", before - after);
}


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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9b(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
mov    $0x1,%edi
mov    $0x3e8,%esi
call   1050 <itimerinit@plt>
mov    $0x1,%edi
call   1040 <itimerread@plt>
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11b2 <main+0x72>
jmp    11a4 <main+0x64>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1193 <main+0x53>
mov    $0x1,%edi
call   1040 <itimerread@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
lea    0xeb4(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1060 <sscanf@plt>
mov    $0x1,%edi
mov    $0x3e8,%esi
call   1050 <itimerinit@plt>
mov    $0x1,%edi
call   1040 <itimerread@plt>
movss  %xmm0,(%rsp)
mov    $0x1,%edi
call   1040 <itimerread@plt>
movss  (%rsp),%xmm1
subss  %xmm0,%xmm1
lea    0xe75(%rip),%rdi
movaps %xmm1,%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%f\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 float
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%14 = call float @itimerread(i32 1)
store float %14, float* %8
store i32 0, i32* %7
br label %15
15: ; preds = %20, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %15
br label %20
20: ; preds = %19
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %15
23: ; preds = %15
%24 = call float @itimerread(i32 1)
store float %24, float* %9
%25 = load float, float* %8
%26 = load float, float* %9
%27 = fsub float %25, %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %27)
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = call float @itimerread(i32 1)
%9 = call float @itimerread(i32 1)
%10 = fsub float %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %10)
ret i32 0
}