#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);
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) {
    perror("Failed to open");
    return 1;
  }
  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     11fb <main+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    14bd <main+0x2fd>
mov    0x2dd6(%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    0x2daf(%rip),%rax
cmpq   $0x0,(%rax)
je     124b <main+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    14bd <main+0x2fd>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xdb7(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1295 <main+0xd5>
lea    0xd9c(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14bd <main+0x2fd>
lea    -0xd4(%rbp),%rdi
call   1070 <CPU_ZERO@plt>
mov    -0x18(%rbp),%edi
lea    -0xd4(%rbp),%rsi
call   10d0 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0xd4(%rbp),%rdx
call   1040 <sched_setaffinity@plt>
cmp    $0x0,%rax
je     12e5 <main+0x125>
lea    0xd5b(%rip),%rdi
call   1090 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    14bd <main+0x2fd>
lea    -0xb0(%rbp),%rdi
call   10e0 <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    1363 <main+0x1a3>
mov    -0x14(%rbp),%edi
call   10a0 <sqrt@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1340 <main+0x180>
lea    -0xb8(%rbp),%rdi
call   10e0 <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  0xbbe(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xbba(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rsi
lea    0xbec(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdq -0x68(%rbp),%xmm0
cvtsi2sdq -0x80(%rbp),%xmm2
movsd  0xb89(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdq -0x98(%rbp),%xmm3
ff ff
movsd  0xb74(%rip),%xmm2
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdq -0xd0(%rbp),%xmm1
ff ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rsi
lea    0xba9(%rip),%rdi
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    11f9 <main+0x39>
mov    0x2dfc(%rip),%rbx
movq   $0x0,(%rbx)
mov    0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
cmpq   $0x0,(%rbx)
je     1215 <main+0x55>
mov    0x0(%rbp),%rdi
call   1060 <usage@plt>
mov    $0x1,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r15d
lea    0xde9(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %eax,%edx
call   10c0 <sprintf@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1080 <open@plt>
cmp    $0xffffffff,%eax
je     1433 <main+0x273>
mov    %eax,%r14d
lea    0x4c(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <CPU_ZERO@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
call   10d0 <CPU_SET@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0x4,%esi
mov    %rbp,%rdx
call   1040 <sched_setaffinity@plt>
test   %rax,%rax
jne    143c <main+0x27c>
lea    0x8(%rsp),%rdi
call   10e0 <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    12d0 <main+0x110>
mov    %rsp,%rdi
call   10e0 <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),%rbp
sub    0x30(%rsp),%rbp
mov    0x18(%rsp),%rbx
sub    0x20(%rsp),%rbx
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  0xc16(%rip),%xmm0
cvttsd2si %xmm0,%rsi
lea    0xc4c(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
cvtsi2sd %rbp,%xmm1
cvtsi2sd %rbx,%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
divsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%rsi
lea    0xc2b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
jmp    1207 <main+0x47>
lea    0xbde(%rip),%rdi
jmp    1443 <main+0x283>
lea    0xbe4(%rip),%rdi
call   1090 <perror@plt>
jmp    1202 <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 = [15 x i8] c"Failed to open\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 %135
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 %135
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 %55
53: ; preds = %44
%54 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %135
55: ; preds = %44
%56 = call i32 @CPU_ZERO(i32* %24)
%57 = load i32, i32* %7
%58 = call i32 @CPU_SET(i32 %57, i32* %24)
%59 = call i64 @sched_setaffinity(i32 0, i32 4, i32* %24)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %55
%62 = 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 %135
63: ; preds = %55
%64 = call i32 @ftime(%struct.timeb* %19)
%65 = load i32, i32* %8
%66 = call i32 @pread(i32 %65, i64* %11, i32 8, i32 16)
%67 = load i32, i32* %8
%68 = call i32 @pread(i32 %67, i64* %14, i32 8, i32 231)
%69 = load i32, i32* %8
%70 = call i32 @pread(i32 %69, i64* %17, i32 8, i32 232)
store i32 0, i32* %6
br label %71
71: ; preds = %77, %63
%72 = load i32, i32* %6
%73 = icmp ult i32 %72, -1879048193
br i1 %73, label %74, label %80
74: ; preds = %71
%75 = load i32, i32* %6
%76 = call i32 @sqrt(i32 %75)
br label %77
77: ; preds = %74
%78 = load i32, i32* %6
%79 = add i32 %78, 1
store i32 %79, i32* %6
br label %71
80: ; preds = %71
%81 = call i32 @ftime(%struct.timeb* %20)
%82 = load i32, i32* %8
%83 = call i32 @pread(i32 %82, i64* %12, i32 8, i32 16)
%84 = load i32, i32* %8
%85 = call i32 @pread(i32 %84, i64* %15, i32 8, i32 231)
%86 = load i32, i32* %8
%87 = call i32 @pread(i32 %86, i64* %18, i32 8, i32 232)
%88 = load i64, i64* %12
%89 = load i64, i64* %11
%90 = sub nsw i64 %88, %89
store i64 %90, i64* %10
%91 = load i64, i64* %15
%92 = load i64, i64* %14
%93 = sub nsw i64 %91, %92
store i64 %93, i64* %13
%94 = load i64, i64* %18
%95 = load i64, i64* %17
%96 = sub nsw i64 %94, %95
store i64 %96, i64* %16
%97 = getelementptr inbounds %struct.timeb, %struct.timeb* %19, i32 0, i32 0
%98 = load i32, i32* %97
%99 = mul nsw i32 %98, 1000
%100 = getelementptr inbounds %struct.timeb, %struct.timeb* %19, i32 0, i32 1
%101 = load i32, i32* %100
%102 = add nsw i32 %99, %101
%103 = sext i32 %102 to i64
store i64 %103, i64* %21
%104 = getelementptr inbounds %struct.timeb, %struct.timeb* %20, i32 0, i32 0
%105 = load i32, i32* %104
%106 = mul nsw i32 %105, 1000
%107 = getelementptr inbounds %struct.timeb, %struct.timeb* %20, i32 0, i32 1
%108 = load i32, i32* %107
%109 = add nsw i32 %106, %108
%110 = sext i32 %109 to i64
store i64 %110, i64* %22
%111 = load i64, i64* %22
%112 = load i64, i64* %21
%113 = sub nsw i64 %111, %112
store i64 %113, i64* %23
%114 = load i64, i64* %23
%115 = sitofp i64 %114 to double
%116 = fmul double 1.000000e+00, %115
%117 = fdiv double %116, 1.000000e+03
%118 = fptosi double %117 to i64
%119 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 %118)
%120 = load i64, i64* %10
%121 = sitofp i64 %120 to double
%122 = load i64, i64* %13
%123 = sitofp i64 %122 to double
%124 = fmul double 1.000000e+00, %123
%125 = load i64, i64* %16
%126 = sitofp i64 %125 to double
%127 = fmul double 1.000000e+00, %126
%128 = fdiv double %124, %127
%129 = fdiv double %121, %128
%130 = load i64, i64* %23
%131 = sitofp i64 %130 to double
%132 = fdiv double %129, %131
%133 = fptosi double %132 to i64
%134 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i64 %133)
store i32 0, i32* %3
br label %135
135: ; preds = %80, %61, %53, %39, %27
%136 = load i32, i32* %3
ret i32 %136
}

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 = [15 x i8] c"Failed to open\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 %125
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 %125
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 %43
41: ; preds = %36
%42 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %125
43: ; preds = %36
%44 = call i32 @CPU_ZERO(i32* %12)
%45 = call i32 @CPU_SET(i32 %30, i32* %12)
%46 = call i64 @sched_setaffinity(i32 0, i32 4, i32* %12)
%47 = icmp eq i64 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %43
%49 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %125
50: ; preds = %43
%51 = call i32 @ftime(%struct.timeb* %10)
%52 = call i32 @pread(i32 %39, i64* %4, i32 8, i32 16)
%53 = call i32 @pread(i32 %39, i64* %6, i32 8, i32 231)
%54 = call i32 @pread(i32 %39, i64* %8, i32 8, i32 232)
br label %55
55: ; preds = %55, %50
%56 = phi i32 [ 0, %50 ], [ %82, %55 ]
%57 = call i32 @sqrt(i32 %56)
%58 = add nuw i32 %56, 1
%59 = call i32 @sqrt(i32 %58)
%60 = add nuw i32 %56, 2
%61 = call i32 @sqrt(i32 %60)
%62 = add nuw i32 %56, 3
%63 = call i32 @sqrt(i32 %62)
%64 = add nuw i32 %56, 4
%65 = call i32 @sqrt(i32 %64)
%66 = add nuw i32 %56, 5
%67 = call i32 @sqrt(i32 %66)
%68 = add nuw i32 %56, 6
%69 = call i32 @sqrt(i32 %68)
%70 = add nuw i32 %56, 7
%71 = call i32 @sqrt(i32 %70)
%72 = add nuw i32 %56, 8
%73 = call i32 @sqrt(i32 %72)
%74 = add nuw i32 %56, 9
%75 = call i32 @sqrt(i32 %74)
%76 = add nuw i32 %56, 10
%77 = call i32 @sqrt(i32 %76)
%78 = add nuw i32 %56, 11
%79 = call i32 @sqrt(i32 %78)
%80 = add nuw i32 %56, 12
%81 = call i32 @sqrt(i32 %80)
%82 = add nuw i32 %56, 13
%83 = icmp eq i32 %82, -1879048193
br i1 %83, label %84, label %55
84: ; preds = %55
%85 = call i32 @ftime(%struct.timeb* %11)
%86 = call i32 @pread(i32 %39, i64* %5, i32 8, i32 16)
%87 = call i32 @pread(i32 %39, i64* %7, i32 8, i32 231)
%88 = call i32 @pread(i32 %39, i64* %9, i32 8, i32 232)
%89 = load i64, i64* %5
%90 = load i64, i64* %4
%91 = sub nsw i64 %89, %90
%92 = load i64, i64* %7
%93 = load i64, i64* %6
%94 = sub nsw i64 %92, %93
%95 = load i64, i64* %9
%96 = load i64, i64* %8
%97 = sub nsw i64 %95, %96
%98 = getelementptr inbounds %struct.timeb, %struct.timeb* %10, i64 0, i32 0
%99 = load i32, i32* %98
%100 = mul nsw i32 %99, 1000
%101 = getelementptr inbounds %struct.timeb, %struct.timeb* %10, i64 0, i32 1
%102 = load i32, i32* %101
%103 = add nsw i32 %100, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds %struct.timeb, %struct.timeb* %11, i64 0, i32 0
%106 = load i32, i32* %105
%107 = mul nsw i32 %106, 1000
%108 = getelementptr inbounds %struct.timeb, %struct.timeb* %11, i64 0, i32 1
%109 = load i32, i32* %108
%110 = add nsw i32 %107, %109
%111 = sext i32 %110 to i64
%112 = sub nsw i64 %111, %104
%113 = sitofp i64 %112 to double
%114 = fdiv double %113, 1.000000e+03
%115 = fptosi double %114 to i64
%116 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i64 %115)
%117 = sitofp i64 %91 to double
%118 = sitofp i64 %94 to double
%119 = sitofp i64 %97 to double
%120 = fdiv double %118, %119
%121 = fdiv double %117, %120
%122 = fdiv double %121, %113
%123 = fptosi double %122 to i64
%124 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i64 %123)
br label %125
125: ; preds = %84, %48, %41, %33, %24
%126 = phi i32 [ 1, %24 ], [ 1, %33 ], [ 1, %41 ], [ 1, %48 ], [ 0, %84 ]
ret i32 %126
}