#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 */
struct timeb {
  int time;
  int millitm;
};
typedef int /*<<< orphan*/ old_tsc;
typedef int /*<<< orphan*/ old_mperf;
typedef int /*<<< orphan*/ old_aperf;
typedef int /*<<< orphan*/ new_tsc;
typedef int /*<<< orphan*/ new_mperf;
typedef int /*<<< orphan*/ new_aperf;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(unsigned int, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ O_RDONLY;
scalar_t__ errno;
int /*<<< orphan*/ ftime(struct timeb *);
unsigned int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ pread(unsigned int, long long *, int, int);
int /*<<< orphan*/ printf(char *, long long, ...);
scalar_t__ sched_setaffinity(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
int /*<<< orphan*/ sqrt(unsigned int);
char *strerror(scalar_t__);
unsigned int strtol(char *, char **, int);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  unsigned int i, cpu, fd;
  char msr_file_name[64];
  long long tsc, old_tsc, new_tsc;
  long long aperf, old_aperf, new_aperf;
  long long mperf, old_mperf, new_mperf;
  struct timeb before, after;
  long long int start, finish, total;
  cpu_set_t cpuset;
  if (argc != 2) {
    usage(argv[0]);
    return 1;
  }
  errno = 0;
  cpu = strtol(argv[1], (char **)NULL, 10);
  if (errno) {
    usage(argv[0]);
    return 1;
  }
  sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
  fd = open(msr_file_name, O_RDONLY);
  if (fd == -1) {
    printf("/dev/cpu/%d/msr: %s\n", cpu, strerror(errno));
    return 4;
  }
  CPU_ZERO(&cpuset);
  CPU_SET(cpu, &cpuset);
  if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
    perror("Failed to set cpu affinity");
    return 1;
  }
  ftime(&before);
  pread(fd, &old_tsc, sizeof(old_tsc), 0x10);
  pread(fd, &old_aperf, sizeof(old_mperf), 0xe7);
  pread(fd, &old_mperf, sizeof(old_aperf), 0xe8);
  for (i = 0; i < 0x8fffffff; i++) {
    sqrt(i);
  }
  ftime(&after);
  pread(fd, &new_tsc, sizeof(new_tsc), 0x10);
  pread(fd, &new_aperf, sizeof(new_mperf), 0xe7);
  pread(fd, &new_mperf, sizeof(new_aperf), 0xe8);
  tsc = new_tsc - old_tsc;
  aperf = new_aperf - old_aperf;
  mperf = new_mperf - old_mperf;
  start = before.time * 1000 + before.millitm;
  finish = after.time * 1000 + after.millitm;
  total = finish - start;
  printf("runTime: %4.2f\n", 1.0 * total / 1000);
  printf("freq: %7.0f\n", tsc / (1.0 * aperf / (1.0 * mperf)) / total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     120b <main+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f6 <main+0x326>
mov    0x2dc6(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d9f(%rip),%rax
cmpq   $0x0,(%rax)
je     125b <main+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f6 <main+0x326>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xda7(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2d6f(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12ca <main+0xfa>
mov    -0x18(%rbp),%eax
mov    %rax,-0xe0(%rbp)
mov    0x2d3a(%rip),%rax
mov    (%rax),%rdi
call   10d0 <strerror@plt>
mov    -0xe0(%rbp),%rsi
mov    %rax,%rdx
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x4,-0x4(%rbp)
jmp    14f6 <main+0x326>
lea    -0xd4(%rbp),%rdi
call   1070 <CPU_ZERO@plt>
mov    -0x18(%rbp),%edi
lea    -0xd4(%rbp),%rsi
call   10e0 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0xd4(%rbp),%rdx
call   1040 <sched_setaffinity@plt>
cmp    $0x0,%rax
je     131a <main+0x14a>
lea    0xd2c(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f6 <main+0x326>
lea    -0xb0(%rbp),%rdi
call   10f0 <ftime@plt>
mov    -0x1c(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x8,%edx
mov    $0x10,%ecx
call   10b0 <pread@plt>
mov    -0x1c(%rbp),%edi
lea    -0x88(%rbp),%rsi
mov    $0x8,%edx
mov    $0xe7,%ecx
call   10b0 <pread@plt>
mov    -0x1c(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x8,%edx
mov    $0xe8,%ecx
call   10b0 <pread@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x8fffffff,-0x14(%rbp)
jae    1398 <main+0x1c8>
mov    -0x14(%rbp),%edi
call   10a0 <sqrt@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1375 <main+0x1a5>
lea    -0xb8(%rbp),%rdi
call   10f0 <ftime@plt>
mov    -0x1c(%rbp),%edi
lea    -0x78(%rbp),%rsi
mov    $0x8,%edx
mov    $0x10,%ecx
call   10b0 <pread@plt>
mov    -0x1c(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x8,%edx
mov    $0xe7,%ecx
call   10b0 <pread@plt>
mov    -0x1c(%rbp),%edi
lea    -0xa8(%rbp),%rsi
mov    $0x8,%edx
mov    $0xe8,%ecx
call   10b0 <pread@plt>
mov    -0x78(%rbp),%rax
sub    -0x70(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x90(%rbp),%rax
sub    -0x88(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0xa8(%rbp),%rax
sub    -0xa0(%rbp),%rax
mov    %rax,-0x98(%rbp)
imul   $0x3e8,-0xb0(%rbp),%eax
add    -0xac(%rbp),%eax
cltq
mov    %rax,-0xc0(%rbp)
imul   $0x3e8,-0xb8(%rbp),%eax
add    -0xb4(%rbp),%eax
cltq
mov    %rax,-0xc8(%rbp)
mov    -0xc8(%rbp),%rax
sub    -0xc0(%rbp),%rax
mov    %rax,-0xd0(%rbp)
cvtsi2sdq -0xd0(%rbp),%xmm1
ff ff
movsd  0xb89(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xb85(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rsi
lea    0xbbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cvtsi2sdq -0x68(%rbp),%xmm0
cvtsi2sdq -0x80(%rbp),%xmm2
movsd  0xb52(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdq -0x98(%rbp),%xmm3
ff ff
movsd  0xb3d(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdq -0xd0(%rbp),%xmm1
ff ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rsi
lea    0xb78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbp
cmp    $0x2,%edi
jne    1209 <main+0x39>
mov    0x2dec(%rip),%r15
movq   $0x0,(%r15)
mov    0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
cmpq   $0x0,(%r15)
je     1227 <main+0x57>
mov    0x0(%rbp),%rdi
call   1060 <usage@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
lea    0xdd8(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %eax,%edx
call   10c0 <sprintf@plt>
mov    0x2da2(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     1447 <main+0x277>
mov    %eax,%r14d
lea    0x4c(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <CPU_ZERO@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   10e0 <CPU_SET@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbp,%rdx
call   1040 <sched_setaffinity@plt>
test   %rax,%rax
jne    146f <main+0x29f>
lea    0x8(%rsp),%rdi
call   10f0 <ftime@plt>
lea    0x40(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
mov    $0x10,%ecx
call   10b0 <pread@plt>
lea    0x30(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
mov    $0xe7,%ecx
call   10b0 <pread@plt>
lea    0x20(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
mov    $0xe8,%ecx
call   10b0 <pread@plt>
nopl   0x0(%rax)
mov    %ebx,%edi
call   10a0 <sqrt@plt>
lea    0x1(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x2(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x3(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x4(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x5(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x6(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x7(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x8(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0x9(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0xa(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0xb(%rbx),%edi
call   10a0 <sqrt@plt>
lea    0xc(%rbx),%edi
call   10a0 <sqrt@plt>
add    $0xd,%ebx
cmp    $0x8fffffff,%ebx
jne    12e0 <main+0x110>
mov    %rsp,%rdi
call   10f0 <ftime@plt>
lea    0x38(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
mov    $0x10,%ecx
call   10b0 <pread@plt>
lea    0x28(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
mov    $0xe7,%ecx
call   10b0 <pread@plt>
lea    0x18(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
mov    $0xe8,%ecx
call   10b0 <pread@plt>
mov    0x38(%rsp),%r14
sub    0x40(%rsp),%r14
mov    0x28(%rsp),%r15
sub    0x30(%rsp),%r15
mov    0x18(%rsp),%rbp
sub    0x20(%rsp),%rbp
movslq 0x8(%rsp),%rax
imul   $0x3e8,%rax,%rax
movslq 0xc(%rsp),%rcx
add    %rax,%rcx
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rax
movslq 0x4(%rsp),%rdx
add    %rax,%rdx
sub    %rcx,%rdx
cvtsi2sd %rdx,%xmm0
movsd  %xmm0,0x10(%rsp)
divsd  0xc06(%rip),%xmm0
cvttsd2si %xmm0,%rsi
lea    0xc42(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
cvtsi2sd %r15,%xmm1
cvtsi2sd %rbp,%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
divsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%rsi
lea    0xc1d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1217 <main+0x47>
mov    %ebx,%ebx
mov    (%r15),%rdi
call   10d0 <strerror@plt>
lea    0xbc0(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x4,%ebx
jmp    1217 <main+0x47>
lea    0xbb7(%rip),%rdi
call   1090 <perror@plt>
jmp    1212 <main+0x42>

LLVM IR (-O0):
%struct.timeb = type { i32, i32 }
@errno = global i64 0
@.str = [16 x i8] c"/dev/cpu/%d/msr\00"
@O_RDONLY = global i32 0
@.str.1 = [21 x i8] c"/dev/cpu/%d/msr: %s\0A\00"
@.str.2 = [27 x i8] c"Failed to set cpu affinity\00"
@.str.3 = [16 x i8] c"runTime: %4.2f\0A\00"
@.str.4 = [13 x i8] c"freq: %7.0f\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 i32
%9 = alloca [64 x i8]
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i64
%19 = alloca %struct.timeb
%20 = alloca %struct.timeb
%21 = alloca i64
%22 = alloca i64
%23 = alloca i64
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 2
br i1 %26, label %27, label %32
27: ; preds = %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 @usage(i8* %30)
store i32 1, i32* %3
br label %139
32: ; preds = %2
store i64 0, i64* @errno
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @strtol(i8* %35, i8** null, i32 10)
store i32 %36, i32* %7
%37 = load i64, i64* @errno
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %32
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 0
%42 = load i8*, i8** %41
%43 = call i32 @usage(i8* %42)
store i32 1, i32* %3
br label %139
44: ; preds = %32
%45 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%46 = load i32, i32* %7
%47 = call i32 @sprintf(i8* %45, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %46)
%48 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%49 = load i32, i32* @O_RDONLY
%50 = call i32 @open(i8* %48, i32 %49)
store i32 %50, i32* %8
%51 = load i32, i32* %8
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %59
53: ; preds = %44
%54 = load i32, i32* %7
%55 = zext i32 %54 to i64
%56 = load i64, i64* @errno
%57 = call i8* @strerror(i64 %56)
%58 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %55, i8* %57)
store i32 4, i32* %3
br label %139
59: ; preds = %44
%60 = call i32 @CPU_ZERO(i32* %24)
%61 = load i32, i32* %7
%62 = call i32 @CPU_SET(i32 %61, i32* %24)
%63 = call i64 @sched_setaffinity(i32 0, i32 4, i32* %24)
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %59
%66 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %139
67: ; preds = %59
%68 = call i32 @ftime(%struct.timeb* %19)
%69 = load i32, i32* %8
%70 = call i32 @pread(i32 %69, i64* %11, i32 8, i32 16)
%71 = load i32, i32* %8
%72 = call i32 @pread(i32 %71, i64* %14, i32 8, i32 231)
%73 = load i32, i32* %8
%74 = call i32 @pread(i32 %73, i64* %17, i32 8, i32 232)
store i32 0, i32* %6
br label %75
75: ; preds = %81, %67
%76 = load i32, i32* %6
%77 = icmp ult i32 %76, -1879048193
br i1 %77, label %78, label %84
78: ; preds = %75
%79 = load i32, i32* %6
%80 = call i32 @sqrt(i32 %79)
br label %81
81: ; preds = %78
%82 = load i32, i32* %6
%83 = add i32 %82, 1
store i32 %83, i32* %6
br label %75
84: ; preds = %75
%85 = call i32 @ftime(%struct.timeb* %20)
%86 = load i32, i32* %8
%87 = call i32 @pread(i32 %86, i64* %12, i32 8, i32 16)
%88 = load i32, i32* %8
%89 = call i32 @pread(i32 %88, i64* %15, i32 8, i32 231)
%90 = load i32, i32* %8
%91 = call i32 @pread(i32 %90, i64* %18, i32 8, i32 232)
%92 = load i64, i64* %12
%93 = load i64, i64* %11
%94 = sub nsw i64 %92, %93
store i64 %94, i64* %10
%95 = load i64, i64* %15
%96 = load i64, i64* %14
%97 = sub nsw i64 %95, %96
store i64 %97, i64* %13
%98 = load i64, i64* %18
%99 = load i64, i64* %17
%100 = sub nsw i64 %98, %99
store i64 %100, i64* %16
%101 = getelementptr inbounds %struct.timeb, %struct.timeb* %19, i32 0, i32 0
%102 = load i32, i32* %101
%103 = mul nsw i32 %102, 1000
%104 = getelementptr inbounds %struct.timeb, %struct.timeb* %19, i32 0, i32 1
%105 = load i32, i32* %104
%106 = add nsw i32 %103, %105
%107 = sext i32 %106 to i64
store i64 %107, i64* %21
%108 = getelementptr inbounds %struct.timeb, %struct.timeb* %20, i32 0, i32 0
%109 = load i32, i32* %108
%110 = mul nsw i32 %109, 1000
%111 = getelementptr inbounds %struct.timeb, %struct.timeb* %20, i32 0, i32 1
%112 = load i32, i32* %111
%113 = add nsw i32 %110, %112
%114 = sext i32 %113 to i64
store i64 %114, i64* %22
%115 = load i64, i64* %22
%116 = load i64, i64* %21
%117 = sub nsw i64 %115, %116
store i64 %117, i64* %23
%118 = load i64, i64* %23
%119 = sitofp i64 %118 to double
%120 = fmul double 1.000000e+00, %119
%121 = fdiv double %120, 1.000000e+03
%122 = fptosi double %121 to i64
%123 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 %122)
%124 = load i64, i64* %10
%125 = sitofp i64 %124 to double
%126 = load i64, i64* %13
%127 = sitofp i64 %126 to double
%128 = fmul double 1.000000e+00, %127
%129 = load i64, i64* %16
%130 = sitofp i64 %129 to double
%131 = fmul double 1.000000e+00, %130
%132 = fdiv double %128, %131
%133 = fdiv double %125, %132
%134 = load i64, i64* %23
%135 = sitofp i64 %134 to double
%136 = fdiv double %133, %135
%137 = fptosi double %136 to i64
%138 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i64 %137)
store i32 0, i32* %3
br label %139
139: ; preds = %84, %65, %53, %39, %27
%140 = load i32, i32* %3
ret i32 %140
}

LLVM IR (-O2):
%struct.timeb = type { i32, i32 }
@errno = global i64 0
@.str = [16 x i8] c"/dev/cpu/%d/msr\00"
@O_RDONLY = global i32 0
@.str.1 = [21 x i8] c"/dev/cpu/%d/msr: %s\0A\00"
@.str.2 = [27 x i8] c"Failed to set cpu affinity\00"
@.str.3 = [16 x i8] c"runTime: %4.2f\0A\00"
@.str.4 = [13 x i8] c"freq: %7.0f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [64 x i8]
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca %struct.timeb
%11 = alloca %struct.timeb
%12 = alloca i32
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%14 = bitcast i64* %4 to i8*
%15 = bitcast i64* %5 to i8*
%16 = bitcast i64* %6 to i8*
%17 = bitcast i64* %7 to i8*
%18 = bitcast i64* %8 to i8*
%19 = bitcast i64* %9 to i8*
%20 = bitcast %struct.timeb* %10 to i8*
%21 = bitcast %struct.timeb* %11 to i8*
%22 = bitcast i32* %12 to i8*
%23 = icmp eq i32 %0, 2
br i1 %23, label %27, label %24
24: ; preds = %2
%25 = load i8*, i8** %1
%26 = tail call i32 @usage(i8* %25)
br label %128
27: ; preds = %2
store i64 0, i64* @errno
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = tail call i32 @strtol(i8* nocapture %29, i8** null, i32 10)
%31 = load i64, i64* @errno
%32 = icmp eq i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %27
%34 = load i8*, i8** %1
%35 = tail call i32 @usage(i8* %34)
br label %128
36: ; preds = %27
%37 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %30)
%38 = load i32, i32* @O_RDONLY
%39 = call i32 @open(i8* %13, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %46
41: ; preds = %36
%42 = zext i32 %30 to i64
%43 = load i64, i64* @errno
%44 = tail call i8* @strerror(i64 %43)
%45 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i64 %42, i8* %44)
br label %128
46: ; preds = %36
%47 = call i32 @CPU_ZERO(i32* %12)
%48 = call i32 @CPU_SET(i32 %30, i32* %12)
%49 = call i64 @sched_setaffinity(i32 0, i32 4, i32* %12)
%50 = icmp eq i64 %49, 0
br i1 %50, label %53, label %51
51: ; preds = %46
%52 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %128
53: ; preds = %46
%54 = call i32 @ftime(%struct.timeb* %10)
%55 = call i32 @pread(i32 %39, i64* %4, i32 8, i32 16)
%56 = call i32 @pread(i32 %39, i64* %6, i32 8, i32 231)
%57 = call i32 @pread(i32 %39, i64* %8, i32 8, i32 232)
br label %58
58: ; preds = %58, %53
%59 = phi i32 [ 0, %53 ], [ %85, %58 ]
%60 = call i32 @sqrt(i32 %59)
%61 = add nuw i32 %59, 1
%62 = call i32 @sqrt(i32 %61)
%63 = add nuw i32 %59, 2
%64 = call i32 @sqrt(i32 %63)
%65 = add nuw i32 %59, 3
%66 = call i32 @sqrt(i32 %65)
%67 = add nuw i32 %59, 4
%68 = call i32 @sqrt(i32 %67)
%69 = add nuw i32 %59, 5
%70 = call i32 @sqrt(i32 %69)
%71 = add nuw i32 %59, 6
%72 = call i32 @sqrt(i32 %71)
%73 = add nuw i32 %59, 7
%74 = call i32 @sqrt(i32 %73)
%75 = add nuw i32 %59, 8
%76 = call i32 @sqrt(i32 %75)
%77 = add nuw i32 %59, 9
%78 = call i32 @sqrt(i32 %77)
%79 = add nuw i32 %59, 10
%80 = call i32 @sqrt(i32 %79)
%81 = add nuw i32 %59, 11
%82 = call i32 @sqrt(i32 %81)
%83 = add nuw i32 %59, 12
%84 = call i32 @sqrt(i32 %83)
%85 = add nuw i32 %59, 13
%86 = icmp eq i32 %85, -1879048193
br i1 %86, label %87, label %58
87: ; preds = %58
%88 = call i32 @ftime(%struct.timeb* %11)
%89 = call i32 @pread(i32 %39, i64* %5, i32 8, i32 16)
%90 = call i32 @pread(i32 %39, i64* %7, i32 8, i32 231)
%91 = call i32 @pread(i32 %39, i64* %9, i32 8, i32 232)
%92 = load i64, i64* %5
%93 = load i64, i64* %4
%94 = sub nsw i64 %92, %93
%95 = load i64, i64* %7
%96 = load i64, i64* %6
%97 = sub nsw i64 %95, %96
%98 = load i64, i64* %9
%99 = load i64, i64* %8
%100 = sub nsw i64 %98, %99
%101 = getelementptr inbounds %struct.timeb, %struct.timeb* %10, i64 0, i32 0
%102 = load i32, i32* %101
%103 = mul nsw i32 %102, 1000
%104 = getelementptr inbounds %struct.timeb, %struct.timeb* %10, i64 0, i32 1
%105 = load i32, i32* %104
%106 = add nsw i32 %103, %105
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds %struct.timeb, %struct.timeb* %11, i64 0, i32 0
%109 = load i32, i32* %108
%110 = mul nsw i32 %109, 1000
%111 = getelementptr inbounds %struct.timeb, %struct.timeb* %11, i64 0, i32 1
%112 = load i32, i32* %111
%113 = add nsw i32 %110, %112
%114 = sext i32 %113 to i64
%115 = sub nsw i64 %114, %107
%116 = sitofp i64 %115 to double
%117 = fdiv double %116, 1.000000e+03
%118 = fptosi double %117 to i64
%119 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 %118)
%120 = sitofp i64 %94 to double
%121 = sitofp i64 %97 to double
%122 = sitofp i64 %100 to double
%123 = fdiv double %121, %122
%124 = fdiv double %120, %123
%125 = fdiv double %124, %116
%126 = fptosi double %125 to i64
%127 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i64 %126)
br label %128
128: ; preds = %87, %51, %41, %33, %24
%129 = phi i32 [ 1, %24 ], [ 1, %33 ], [ 4, %41 ], [ 1, %51 ], [ 0, %87 ]
ret i32 %129
}