#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 */
typedef int /*<<< orphan*/ rdtsc;
typedef scalar_t__ __u64;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int S_IRGRP;
int S_IRUSR;
int S_IWGRP;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, scalar_t__, scalar_t__);
scalar_t__ read(int, scalar_t__ *, int);
int main(int argc, char *argv[]) {
  __u64 rdtsc = 0;
  __u64 i = 0;
  int fileStat = open(argv[1], O_RDONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
  while (read(fileStat, &rdtsc, sizeof(rdtsc)) > 0) {
    printf("%llu:\t%llu\n", ++i, rdtsc);
  }
  close(fileStat);
  return EXIT_SUCCESS;
}


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)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
mov    0x2e42(%rip),%rax
mov    (%rax),%edx
mov    0x2e51(%rip),%rax
or     (%rax),%edx
mov    0x2e38(%rip),%rax
or     (%rax),%edx
mov    0x2e47(%rip),%rax
or     (%rax),%edx
call   1060 <open@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1050 <read@plt>
cmp    $0x0,%rax
jle    11df <main+0x9f>
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rdx
lea    0xe2b(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <main+0x63>
mov    -0x24(%rbp),%edi
call   1040 <close@plt>
mov    0x2dca(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    0x8(%rsi),%rdi
mov    0x2e66(%rip),%rax
mov    0x2e77(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    0x2e7c(%rip),%rax
mov    0x2e55(%rip),%rcx
or     (%rcx),%edx
mov    (%rax),%esi
mov    0x2e62(%rip),%rax
or     (%rax),%edx
call   1060 <open@plt>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x8,%edx
call   1050 <read@plt>
test   %rax,%rax
jle    11d7 <main+0x97>
mov    $0x1,%ebx
lea    0xe59(%rip),%r14
mov    %rsp,%r15
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x8,%edx
call   1050 <read@plt>
add    $0x1,%rbx
test   %rax,%rax
jg     11b0 <main+0x70>
mov    %ebp,%edi
call   1040 <close@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@.str = [12 x i8] c"%llu:\09%llu\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i64 0, i64* %7
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = load i32, i32* @O_RDONLY
%13 = load i32, i32* @S_IRUSR
%14 = load i32, i32* @S_IWUSR
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IRGRP
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IWGRP
%19 = or i32 %17, %18
%20 = call i32 @open(i8* %11, i32 %12, i32 %19)
store i32 %20, i32* %8
br label %21
21: ; preds = %25, %2
%22 = load i32, i32* %8
%23 = call i64 @read(i32 %22, i64* %6, i32 8)
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i64, i64* %7
%27 = add nsw i64 %26, 1
store i64 %27, i64* %7
%28 = load i64, i64* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %27, i64 %28)
br label %21
30: ; preds = %21
%31 = load i32, i32* %8
%32 = call i32 @close(i32 %31)
%33 = load i32, i32* @EXIT_SUCCESS
ret i32 %33
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@.str = [12 x i8] c"%llu:\09%llu\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i32, i32* @O_RDONLY
%8 = load i32, i32* @S_IRUSR
%9 = load i32, i32* @S_IWUSR
%10 = or i32 %9, %8
%11 = load i32, i32* @S_IRGRP
%12 = or i32 %10, %11
%13 = load i32, i32* @S_IWGRP
%14 = or i32 %12, %13
%15 = tail call i32 @open(i8* %6, i32 %7, i32 %14)
%16 = call i64 @read(i32 %15, i64* %3, i32 8)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %2, %18
%19 = phi i64 [ %20, %18 ], [ 0, %2 ]
%20 = add nuw nsw i64 %19, 1
%21 = load i64, i64* %3
%22 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %20, i64 %21)
%23 = call i64 @read(i32 %15, i64* %3, i32 8)
%24 = icmp sgt i64 %23, 0
br i1 %24, label %18, label %25
25: ; preds = %18, %2
%26 = tail call i32 @close(i32 %15)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}