#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 timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ off_t;
typedef int /*<<< orphan*/ cpu_set_t;
typedef int /*<<< orphan*/ __pid_t;

/* Variables and functions */
int MAP_ANON;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
size_t _loc_freq();
size_t _rdtsc();
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, ...);
int getopt(int, char **, char *);
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ mmap(int /*<<< orphan*/ *, size_t, int, int, int,
                int /*<<< orphan*/);
int /*<<< orphan*/ optarg;
int pin_cpu(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int triad(int, double, double *, double *, double *);
int /*<<< orphan*/ usage();
void main(int argc, char **argv) {
  double *a, *b, *c, xx = 0.01, bw, avg_bw, best_bw = -1.0;
  char *buf1, *buf2, *buf3;
  int i, j, k, offset_a = 0, offset_b = 0, offset_c = 0, mult = 1, iter = 100,
               c_val;
  int len, mem_level, level_size[4], cpu, cpu_run, bytes_per, scale;
  __pid_t pid = 0;
  int cpu_setsize;
  cpu_set_t mask;
  size_t start, stop, run_time, call_start, call_stop, call_run_time,
      total_bytes = 0;
  size_t sum_run_time = 0, run_time_k = 0, init_start, init_end, init_run;
  struct timespec start_t, stop_t;
  size_t total = 0;
  struct timeval start_time, stop_time;
  int ret_int, fd = -1;
  size_t gotten_time, freq_val;
  off_t offset = 0;
  size_t buf_size;
  if (argc < 3) {
    printf("triad driver needs at least 3 arguments, cpu_init, cpu_run, "
           "cache_level, [call count multiplier  def = 1], [offset a, "
           "offset_b, offset_c  defaults = 0] \n");
    printf(" argc = %d\n", argc);
    usage();
    err(1, "bad arguments");
  }
  len = 4 * 8192 * 8 * 1024;
  while ((c_val = getopt(argc, argv, "i:r:l:m:a:b:c")) != -1) {
    switch (c_val) {
    case 'i':
      cpu = atoi(optarg);
      break;
    case 'r':
      cpu_run = atoi(optarg);
      break;
    case 'l':
      mem_level = atoi(optarg);
      break;
    case 'm':
      mult = atoi(optarg);
      break;
    case 'a':
      offset_a = atoi(optarg);
      break;
    case 'b':
      offset_b = atoi(optarg);
      break;
    case 'c':
      offset_c = atoi(optarg);
      break;
    default:
      err(1, "unknown option %c", c_val);
    }
  }
  iter = iter * mult;
  if (pin_cpu(pid, cpu) == -1) {
    err(1, "failed to set affinity");
  } else {
    fprintf(stderr, " process pinned to core %d for initialization\n", cpu);
  }
  level_size[0] = 16 * 1024;
  level_size[1] = 256 * 1024;
  level_size[2] = 8 * 1024 * 1024;
  level_size[3] = 4 * 8192 * 8 * 1024;
  fprintf(stderr, "len = %d, mem_level = %d, iter = %d, mult = %d\n", len,
          mem_level, iter, mult);
  len = level_size[mem_level] / 32;
  fprintf(stderr, "len = %d, mem_level = %d, iter = %d, mult = %d\n", len,
          mem_level, iter, mult);
  scale = level_size[3] / (32 * len);
  fprintf(stderr,
          "len = %d, mem_level = %d, iter = %d, mult = %d, scale = %d\n", len,
          mem_level, iter, mult, scale);
  iter = iter * scale * mult;
  fprintf(stderr, "len = %d, mem_level = %d, iter = %d, mult = %d\n", len,
          mem_level, iter, mult);
  buf_size = sizeof(double) * len;
  buf1 = (char *)mmap(NULL, buf_size, PROT_READ | PROT_WRITE,
                      MAP_PRIVATE | MAP_ANON, fd, offset);
  buf2 = (char *)mmap(NULL, buf_size, PROT_READ | PROT_WRITE,
                      MAP_PRIVATE | MAP_ANON, fd, offset);
  buf3 = (char *)mmap(NULL, buf_size, PROT_READ | PROT_WRITE,
                      MAP_PRIVATE | MAP_ANON, fd, offset);
  a = (double *)buf1;
  b = (double *)buf2;
  c = (double *)buf3;
  for (i = 0; i < len; i++) {
    a[i] = 0.;
    b[i] = 10.;
    c[i] = 10.;
  }
  if (pin_cpu(pid, cpu_run) == -1) {
    err(1, "failed to set affinity");
  } else {
    fprintf(stderr, " process pinned to core %d for triad run\n", cpu_run);
  }
  printf(" calling triad %d times with len = %d\n", iter, len);
  ret_int = gettimeofday(&start_time, NULL);
  call_start = _rdtsc();
  for (i = 0; i < iter; i++) {
    start = _rdtsc();
    bytes_per = triad(len, xx, a, b, c);
    stop = _rdtsc();
    run_time = stop - start;
    xx += 0.01;
    total_bytes += len * bytes_per;
    bw = (double)(len * bytes_per) / (double)run_time;
    if (bw > best_bw)
      best_bw = bw;
  }
  call_stop = _rdtsc();
  freq_val = _loc_freq();
  ret_int = gettimeofday(&stop_time, NULL);
  gotten_time = (size_t)(stop_time.tv_sec - start_time.tv_sec) * 1000000;
  gotten_time += (size_t)(stop_time.tv_usec - start_time.tv_usec);
  call_run_time = call_stop - call_start;
  avg_bw = (double)(total_bytes) / (double)call_run_time;
  printf(" transfering %zd bytes from memory level %d took %zd cycles/call and "
         "a total of %zd\n",
         total_bytes, mem_level, run_time, call_run_time);
  printf(" run time = %zd\n", call_run_time);
  printf(" gettimeofday_run time = %zd\n", gotten_time);
  printf("frequency = %zd\n", freq_val);
  printf(" average bytes/cycle = %f\n", avg_bw);
  printf(" best bytes/cycle = %f\n", best_bw);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe2e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe19(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x1,-0x7c(%rbp)
movl   $0x64,-0x80(%rbp)
movl   $0x0,-0xb4(%rbp)
movq   $0x0,-0xf8(%rbp)
movq   $0x0,-0x100(%rbp)
movq   $0x0,-0x108(%rbp)
movq   $0x0,-0x138(%rbp)
movl   $0xffffffff,-0x160(%rbp)
ff ff ff
movl   $0x0,-0x174(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    129c <main+0xdc>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   10b0 <usage@plt>
mov    $0x1,%edi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
movl   $0x10000000,-0x88(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x84(%rbp)
cmp    $0xffffffff,%eax
je     13bb <main+0x1fb>
mov    -0x84(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x188(%rbp)
sub    $0x11,%eax
ja     139d <main+0x1dd>
mov    -0x188(%rbp),%rax
lea    0xd4f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0xa4(%rbp)
jmp    13b6 <main+0x1f6>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0xa8(%rbp)
jmp    13b6 <main+0x1f6>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0x8c(%rbp)
jmp    13b6 <main+0x1f6>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0x7c(%rbp)
jmp    13b6 <main+0x1f6>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0x70(%rbp)
jmp    13b6 <main+0x1f6>
mov    0x2c80(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0x74(%rbp)
jmp    13b6 <main+0x1f6>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
call   10d0 <atoi@plt>
mov    %eax,-0x78(%rbp)
jmp    13b6 <main+0x1f6>
mov    -0x84(%rbp),%edx
mov    $0x1,%edi
lea    0xd9b(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    12a6 <main+0xe6>
mov    -0x80(%rbp),%eax
imul   -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0xb4(%rbp),%edi
mov    -0xa4(%rbp),%esi
call   1060 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    13f7 <main+0x237>
mov    $0x1,%edi
lea    0xd71(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    1414 <main+0x254>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
mov    -0xa4(%rbp),%edx
lea    0xd66(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4000,-0xa0(%rbp)
movl   $0x40000,-0x9c(%rbp)
movl   $0x800000,-0x98(%rbp)
movl   $0x10000000,-0x94(%rbp)
mov    0x2b8d(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movslq -0x8c(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    0x2b46(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xcfb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x94(%rbp),%eax
mov    -0x88(%rbp),%ecx
shl    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0xb0(%rbp)
mov    0x2b03(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
mov    -0xb0(%rbp),%eax
lea    0xce2(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x80(%rbp),%eax
imul   -0xb0(%rbp),%eax
imul   -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    0x2abe(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xc73(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movslq -0x88(%rbp),%rax
shl    $0x3,%rax
mov    %rax,-0x180(%rbp)
mov    -0x180(%rbp),%rsi
mov    0x2a9a(%rip),%rax
mov    (%rax),%edx
mov    0x2a69(%rip),%rax
or     (%rax),%edx
mov    0x2a50(%rip),%rax
mov    (%rax),%ecx
mov    0x2a4f(%rip),%rax
or     (%rax),%ecx
mov    -0x160(%rbp),%r8d
mov    -0x174(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1030 <mmap@plt>
mov    %rax,-0x50(%rbp)
mov    -0x180(%rbp),%rsi
mov    0x2a54(%rip),%rax
mov    (%rax),%edx
mov    0x2a23(%rip),%rax
or     (%rax),%edx
mov    0x2a0a(%rip),%rax
mov    (%rax),%ecx
mov    0x2a09(%rip),%rax
or     (%rax),%ecx
mov    -0x160(%rbp),%r8d
mov    -0x174(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1030 <mmap@plt>
mov    %rax,-0x58(%rbp)
mov    -0x180(%rbp),%rsi
mov    0x2a0e(%rip),%rax
mov    (%rax),%edx
mov    0x29dd(%rip),%rax
or     (%rax),%edx
mov    0x29c4(%rip),%rax
mov    (%rax),%ecx
mov    0x29c3(%rip),%rax
or     (%rax),%ecx
mov    -0x160(%rbp),%r8d
mov    -0x174(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1030 <mmap@plt>
mov    %rax,-0x60(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    1690 <main+0x4d0>
mov    -0x18(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0x9a8(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0x993(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1639 <main+0x479>
mov    -0xb4(%rbp),%edi
mov    -0xa8(%rbp),%esi
call   1060 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    16c2 <main+0x502>
mov    $0x1,%edi
lea    0xaa6(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    16df <main+0x51f>
mov    0x2907(%rip),%rax
mov    (%rax),%edi
mov    -0xa8(%rbp),%edx
lea    0xb36(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x80(%rbp),%esi
mov    -0x88(%rbp),%edx
lea    0xb49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x148(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    %eax,-0x15c(%rbp)
mov    $0x0,%al
call   10a0 <_rdtsc@plt>
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    183b <main+0x67b>
xor    %eax,%eax
mov    %al,-0x189(%rbp)
call   10a0 <_rdtsc@plt>
mov    %rax,-0xc8(%rbp)
mov    -0x88(%rbp),%edi
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1080 <triad@plt>
mov    %eax,%ecx
mov    -0x189(%rbp),%al
mov    %ecx,-0xac(%rbp)
call   10a0 <_rdtsc@plt>
mov    %rax,-0xd0(%rbp)
mov    -0xd0(%rbp),%rax
mov    -0xc8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xd8(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0x86c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x88(%rbp),%eax
mov    -0xac(%rbp),%ecx
imul   %ecx,%eax
movslq %eax,%rcx
mov    -0xf8(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0xf8(%rbp)
mov    -0x88(%rbp),%eax
mov    -0xac(%rbp),%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
movaps 0x83e(%rip),%xmm2
movq   -0xd8(%rbp),%xmm1
ff
punpckldq %xmm2,%xmm1
movapd 0x83a(%rip),%xmm2
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x48(%rbp),%xmm0
jbe    1828 <main+0x668>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    182d <main+0x66d>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1721 <main+0x561>
xor    %eax,%eax
mov    %eax,-0x190(%rbp)
mov    %al,-0x191(%rbp)
call   10a0 <_rdtsc@plt>
mov    %rax,%rcx
mov    -0x191(%rbp),%al
mov    %rcx,-0xe8(%rbp)
call   10e0 <_loc_freq@plt>
mov    %rax,%rcx
mov    -0x190(%rbp),%eax
mov    %rcx,-0x170(%rbp)
mov    %eax,%esi
lea    -0x158(%rbp),%rdi
call   1050 <gettimeofday@plt>
mov    %eax,-0x15c(%rbp)
mov    -0x150(%rbp),%rax
mov    -0x140(%rbp),%rcx
sub    %rcx,%rax
imul   $0xf4240,%rax,%rax
mov    %rax,-0x168(%rbp)
mov    -0x158(%rbp),%rcx
mov    -0x148(%rbp),%rax
sub    %rax,%rcx
mov    -0x168(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x168(%rbp)
mov    -0xe8(%rbp),%rax
mov    -0xe0(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xf0(%rbp)
movaps 0x739(%rip),%xmm3
movq   -0xf8(%rbp),%xmm0
ff
punpckldq %xmm3,%xmm0
movapd 0x735(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0xf0(%rbp),%xmm1
ff
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0xf8(%rbp),%rsi
mov    -0x8c(%rbp),%edx
mov    -0xd8(%rbp),%rcx
mov    -0xf0(%rbp),%r8
lea    0x90f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xf0(%rbp),%rsi
lea    0x94f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x168(%rbp),%rsi
lea    0x94b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x170(%rbp),%rsi
lea    0x954(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0x952(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0x95a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x2,%edi
jg     1221 <main+0x51>
lea    0x10ab(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   10c0 <usage@plt>
lea    0xe8f(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10a0 <err@plt>
movl   $0x1,0x10(%rsp)
lea    0xe82(%rip),%r13
lea    0xe19(%rip),%r12
mov    0x2dba(%rip),%r14
jmp    1248 <main+0x78>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10d0 <getopt@plt>
lea    -0x61(%rax),%ecx
cmp    $0x11,%ecx
ja     129d <main+0xcd>
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,%r15d
jmp    1248 <main+0x78>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x1c(%rsp)
jmp    1248 <main+0x78>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x10(%rsp)
jmp    1248 <main+0x78>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x20(%rsp)
jmp    1248 <main+0x78>
cmp    $0xffffffff,%eax
je     12b9 <main+0xe9>
mov    $0x1,%edi
lea    0xe12(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10a0 <err@plt>
jmp    1248 <main+0x78>
imul   $0x64,0x10(%rsp),%r14d
xor    %edi,%edi
mov    %r15d,%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     12ea <main+0x11a>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
lea    0xe0b(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    12fd <main+0x12d>
lea    0xde1(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10a0 <err@plt>
movapd 0xcfb(%rip),%xmm0
movapd %xmm0,0x70(%rsp)
mov    0x2cbe(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
mov    $0x10000000,%edx
mov    0x1c(%rsp),%ebp
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    0x10(%rsp),%r15d
mov    %r15d,%r9d
xor    %eax,%eax
call   1080 <fprintf@plt>
movslq %ebp,%r12
mov    0x70(%rsp,%r12,4),%r13d
lea    0x1f(%r13),%ebp
test   %r13d,%r13d
cmovns %r13d,%ebp
mov    %ebp,%ebx
sar    $0x5,%ebx
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r14d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1080 <fprintf@plt>
and    $0xffffffe0,%ebp
mov    $0x10000000,%eax
xor    %edx,%edx
idiv   %ebp
mov    %eax,%ebp
mov    0x2c49(%rip),%rax
mov    (%rax),%edi
mov    %ebp,(%rsp)
lea    0xdb5(%rip),%rsi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r14d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1080 <fprintf@plt>
imul   %r15d,%r14d
imul   %ebp,%r14d
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xd5b(%rip),%rsi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r14d,%r8d
mov    %r15d,%r9d
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %ebx,0x18(%rsp)
movslq %ebx,%rbp
shl    $0x3,%rbp
mov    0x2c0f(%rip),%rax
mov    0x2be0(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rax,%r15
mov    0x2bc2(%rip),%rbx
mov    0x2bc3(%rip),%r12
mov    (%r12),%ecx
or     (%rbx),%ecx
xor    %edi,%edi
mov    %rbp,%rsi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    0x2bab(%rip),%rcx
mov    (%rcx),%edx
or     (%r15),%edx
mov    %rax,%r15
mov    (%r12),%ecx
or     (%rbx),%ecx
xor    %edi,%edi
mov    %rbp,%rsi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    0x2b83(%rip),%rcx
mov    (%rcx),%edx
mov    %r15,%r12
mov    0x2b9f(%rip),%rcx
or     (%rcx),%edx
mov    %rax,%rbx
mov    0x2b63(%rip),%rax
mov    (%rax),%ecx
mov    0x2b52(%rip),%rax
or     (%rax),%ecx
xor    %edi,%edi
mov    %rbp,%rsi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%r15
cmp    $0x20,%r13d
mov    %rbx,%r13
mov    0x20(%rsp),%ebp
jl     164d <main+0x47d>
mov    0x18(%rsp),%ecx
mov    %ecx,%ebx
cmp    $0x4,%ecx
jae    14a1 <main+0x2d1>
xor    %ecx,%ecx
jmp    15ea <main+0x41a>
mov    %ebp,%r11d
lea    (%r12,%rbx,8),%rcx
lea    0x0(,%rbx,8),%rbp
add    %r13,%rbp
lea    (%r15,%rbx,8),%rsi
cmp    %rbp,%r12
setb   %r9b
cmp    %rcx,%r13
setb   %r10b
cmp    %rsi,%r12
setb   %dl
cmp    %rcx,%r15
setb   %dil
cmp    %rsi,%r13
setb   %sil
cmp    %rbp,%r15
setb   %r8b
xor    %ecx,%ecx
test   %r10b,%r9b
jne    15e7 <main+0x417>
and    %dil,%dl
mov    %r11d,%ebp
jne    15ea <main+0x41a>
and    %r8b,%sil
jne    15ea <main+0x41a>
mov    %ebx,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     15dd <main+0x40d>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
xorpd  %xmm0,%xmm0
movapd 0xade(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd %xmm0,(%r12,%rdx,8)
movupd %xmm0,0x10(%r12,%rdx,8)
movupd %xmm1,0x0(%r13,%rdx,8)
movupd %xmm1,0x10(%r13,%rdx,8)
movupd %xmm1,(%r15,%rdx,8)
movupd %xmm1,0x10(%r15,%rdx,8)
movupd %xmm0,0x20(%r12,%rdx,8)
movupd %xmm0,0x30(%r12,%rdx,8)
movupd %xmm1,0x20(%r13,%rdx,8)
movupd %xmm1,0x30(%r13,%rdx,8)
movupd %xmm1,0x20(%r15,%rdx,8)
movupd %xmm1,0x30(%r15,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1540 <main+0x370>
test   $0x1,%sil
je     15d6 <main+0x406>
xorpd  %xmm0,%xmm0
movupd %xmm0,(%r12,%rdx,8)
movupd %xmm0,0x10(%r12,%rdx,8)
movapd 0xa55(%rip),%xmm0
movupd %xmm0,0x0(%r13,%rdx,8)
movupd %xmm0,0x10(%r13,%rdx,8)
movupd %xmm0,(%r15,%rdx,8)
movupd %xmm0,0x10(%r15,%rdx,8)
cmp    %rbx,%rcx
jne    15ea <main+0x41a>
jmp    164d <main+0x47d>
xor    %edx,%edx
test   $0x1,%sil
jne    15a2 <main+0x3d2>
jmp    15d6 <main+0x406>
mov    %r11d,%ebp
mov    %rcx,%rsi
not    %rsi
movabs $0x4024000000000000,%rdx
test   $0x1,%bl
je     1614 <main+0x444>
movq   $0x0,(%r12,%rcx,8)
mov    %rdx,0x0(%r13,%rcx,8)
mov    %rdx,(%r15,%rcx,8)
or     $0x1,%rcx
add    %rbx,%rsi
je     164d <main+0x47d>
nopl   0x0(%rax)
movq   $0x0,(%r12,%rcx,8)
mov    %rdx,0x0(%r13,%rcx,8)
mov    %rdx,(%r15,%rcx,8)
movq   $0x0,0x8(%r12,%rcx,8)
mov    %rdx,0x8(%r13,%rcx,8)
mov    %rdx,0x8(%r15,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rbx
jne    1620 <main+0x450>
xor    %edi,%edi
mov    %ebp,%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     1676 <main+0x4a6>
mov    0x296e(%rip),%rax
mov    (%rax),%edi
lea    0xb19(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    1689 <main+0x4b9>
lea    0xa55(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10a0 <err@plt>
lea    0xb1e(%rip),%rdi
xor    %ebp,%ebp
mov    %r14d,%esi
mov    0x18(%rsp),%ebx
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x60(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,0x30(%rsp)
test   %r14d,%r14d
jle    1792 <main+0x5c2>
movsd  0x975(%rip),%xmm1
movsd  0x975(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %ebp,%ebp
mov    %r12,0x48(%rsp)
mov    %r13,0x40(%rsp)
mov    %r15,0x38(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,0x20(%rsp)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r13
mov    %ebx,%edi
movsd  0x10(%rsp),%xmm0
mov    0x48(%rsp),%rsi
mov    0x40(%rsp),%rdx
mov    0x38(%rsp),%rcx
call   1090 <triad@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r12
sub    %r13,%r12
movsd  0x10(%rsp),%xmm0
addsd  0x90e(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
imul   0x18(%rsp),%r15d
movslq %r15d,%rax
mov    0x18(%rsp),%ebx
add    %rax,%rbp
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movq   %r12,%xmm0
punpckldq 0x8bc(%rip),%xmm0
subpd  0x8c4(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
maxsd  0x20(%rsp),%xmm2
movapd %xmm2,%xmm1
add    $0xffffffff,%r14d
jne    16f0 <main+0x520>
jmp    179a <main+0x5ca>
movsd  0x8a6(%rip),%xmm2
movsd  %xmm2,0x10(%rsp)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r15
xor    %eax,%eax
call   10f0 <_loc_freq@plt>
mov    %rax,%r14
lea    0x50(%rsp),%rdi
xor    %esi,%esi
call   1060 <gettimeofday@plt>
mov    0x50(%rsp),%rbx
mov    0x58(%rsp),%rax
sub    0x68(%rsp),%rax
sub    0x60(%rsp),%rbx
imul   $0xf4240,%rax,%rax
add    %rax,%rbx
sub    0x30(%rsp),%r15
movq   %rbp,%xmm0
movdqa 0x830(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0x834(%rip),%xmm2
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movq   %r15,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm3
movapd %xmm3,0x20(%rsp)
lea    0x99f(%rip),%rdi
mov    %rbp,%rsi
mov    0x1c(%rsp),%edx
mov    %r12,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9d9(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9d9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9e6(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x9e6(%rip),%rdi
movaps 0x20(%rsp),%xmm0
mov    $0x1,%al
call   1050 <printf@plt>
lea    0x9ee(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
%struct.timeval = type { i64, i64 }
@.str = [154 x i8] c"triad driver needs at least 3 arguments, cpu_init, cpu_run, cache_level, [call count multiplier def = 1], [offset a, offset_b, offset_c defaults = 0] \0A\00"
@.str.1 = [12 x i8] c" argc = %d\0A\00"
@.str.2 = [14 x i8] c"bad arguments\00"
@.str.3 = [14 x i8] c"i:r:l:m:a:b:c\00"
@optarg = global i32 0
@.str.4 = [18 x i8] c"unknown option %c\00"
@.str.5 = [23 x i8] c"failed to set affinity\00"
@stderr = global i32 0
@.str.6 = [47 x i8] c" process pinned to core %d for initialization\0A\00"
@.str.7 = [48 x i8] c"len = %d, mem_level = %d, iter = %d, mult = %d\0A\00"
@.str.8 = [60 x i8] c"len = %d, mem_level = %d, iter = %d, mult = %d, scale = %d\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANON = global i32 0
@.str.9 = [42 x i8] c" process pinned to core %d for triad run\0A\00"
@.str.10 = [39 x i8] c" calling triad %d times with len = %d\0A\00"
@.str.11 = [85 x i8] c" transfering %zd bytes from memory level %d took %zd cycles/call and a total of %zd\0A\00"
@.str.12 = [17 x i8] c" run time = %zd\0A\00"
@.str.13 = [30 x i8] c" gettimeofday_run time = %zd\0A\00"
@.str.14 = [17 x i8] c"frequency = %zd\0A\00"
@.str.15 = [27 x i8] c" average bytes/cycle = %f\0A\00"
@.str.16 = [24 x i8] c" best bytes/cycle = %f\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double*
%6 = alloca double*
%7 = alloca double*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca [4 x i32]
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i64
%35 = alloca i64
%36 = alloca i64
%37 = alloca i64
%38 = alloca i64
%39 = alloca i64
%40 = alloca i64
%41 = alloca i64
%42 = alloca i64
%43 = alloca i64
%44 = alloca i64
%45 = alloca i64
%46 = alloca %struct.timespec
%47 = alloca %struct.timespec
%48 = alloca i64
%49 = alloca %struct.timeval
%50 = alloca %struct.timeval
%51 = alloca i32
%52 = alloca i32
%53 = alloca i64
%54 = alloca i64
%55 = alloca i32
%56 = alloca i64
store i32 %0, i32* %3
store i8** %1, i8*** %4
store double 1.000000e-02, double* %8
store double -1.000000e+00, double* %11
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 1, i32* %21
store i32 100, i32* %22
store i32 0, i32* %31
store i64 0, i64* %40
store i64 0, i64* %41
store i64 0, i64* %42
store i64 0, i64* %48
store i32 -1, i32* %52
store i32 0, i32* %55
%57 = load i32, i32* %3
%58 = icmp slt i32 %57, 3
br i1 %58, label %59, label %65
59: ; preds = %2
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
%61 = load i32, i32* %3
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %61)
%63 = call i32 (...) @usage()
%64 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %65
65: ; preds = %59, %2
store i32 268435456, i32* %24
br label %66
66: ; preds = %97, %65
%67 = load i32, i32* %3
%68 = load i8**, i8*** %4
%69 = call i32 @getopt(i32 %67, i8** %68, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 %69, i32* %23
%70 = icmp ne i32 %69, -1
br i1 %70, label %71, label %98
71: ; preds = %66
%72 = load i32, i32* %23
switch i32 %72, label %94 [
i32 105, label %73
i32 114, label %76
i32 108, label %79
i32 109, label %82
i32 97, label %85
i32 98, label %88
i32 99, label %91
]
73: ; preds = %71
%74 = load i32, i32* @optarg
%75 = call i32 @atoi(i32 %74)
store i32 %75, i32* %27
br label %97
76: ; preds = %71
%77 = load i32, i32* @optarg
%78 = call i32 @atoi(i32 %77)
store i32 %78, i32* %28
br label %97
79: ; preds = %71
%80 = load i32, i32* @optarg
%81 = call i32 @atoi(i32 %80)
store i32 %81, i32* %25
br label %97
82: ; preds = %71
%83 = load i32, i32* @optarg
%84 = call i32 @atoi(i32 %83)
store i32 %84, i32* %21
br label %97
85: ; preds = %71
%86 = load i32, i32* @optarg
%87 = call i32 @atoi(i32 %86)
store i32 %87, i32* %18
br label %97
88: ; preds = %71
%89 = load i32, i32* @optarg
%90 = call i32 @atoi(i32 %89)
store i32 %90, i32* %19
br label %97
91: ; preds = %71
%92 = load i32, i32* @optarg
%93 = call i32 @atoi(i32 %92)
store i32 %93, i32* %20
br label %97
94: ; preds = %71
%95 = load i32, i32* %23
%96 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %95)
br label %97
97: ; preds = %94, %91, %88, %85, %82, %79, %76, %73
br label %66
98: ; preds = %66
%99 = load i32, i32* %22
%100 = load i32, i32* %21
%101 = mul nsw i32 %99, %100
store i32 %101, i32* %22
%102 = load i32, i32* %31
%103 = load i32, i32* %27
%104 = call i32 @pin_cpu(i32 %102, i32 %103)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %108
106: ; preds = %98
%107 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %112
108: ; preds = %98
%109 = load i32, i32* @stderr
%110 = load i32, i32* %27
%111 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32 %110)
br label %112
112: ; preds = %108, %106
%113 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 0
store i32 16384, i32* %113
%114 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 1
store i32 262144, i32* %114
%115 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 2
store i32 8388608, i32* %115
%116 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 3
store i32 268435456, i32* %116
%117 = load i32, i32* @stderr
%118 = load i32, i32* %24
%119 = load i32, i32* %25
%120 = load i32, i32* %22
%121 = load i32, i32* %21
%122 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %118, i32 %119, i32 %120, i32 %121)
%123 = load i32, i32* %25
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = sdiv i32 %126, 32
store i32 %127, i32* %24
%128 = load i32, i32* @stderr
%129 = load i32, i32* %24
%130 = load i32, i32* %25
%131 = load i32, i32* %22
%132 = load i32, i32* %21
%133 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %129, i32 %130, i32 %131, i32 %132)
%134 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 3
%135 = load i32, i32* %134
%136 = load i32, i32* %24
%137 = mul nsw i32 32, %136
%138 = sdiv i32 %135, %137
store i32 %138, i32* %30
%139 = load i32, i32* @stderr
%140 = load i32, i32* %24
%141 = load i32, i32* %25
%142 = load i32, i32* %22
%143 = load i32, i32* %21
%144 = load i32, i32* %30
%145 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %139, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 %140, i32 %141, i32 %142, i32 %143, i32 %144)
%146 = load i32, i32* %22
%147 = load i32, i32* %30
%148 = mul nsw i32 %146, %147
%149 = load i32, i32* %21
%150 = mul nsw i32 %148, %149
store i32 %150, i32* %22
%151 = load i32, i32* @stderr
%152 = load i32, i32* %24
%153 = load i32, i32* %25
%154 = load i32, i32* %22
%155 = load i32, i32* %21
%156 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %152, i32 %153, i32 %154, i32 %155)
%157 = load i32, i32* %24
%158 = sext i32 %157 to i64
%159 = mul i64 8, %158
store i64 %159, i64* %56
%160 = load i64, i64* %56
%161 = load i32, i32* @PROT_READ
%162 = load i32, i32* @PROT_WRITE
%163 = or i32 %161, %162
%164 = load i32, i32* @MAP_PRIVATE
%165 = load i32, i32* @MAP_ANON
%166 = or i32 %164, %165
%167 = load i32, i32* %52
%168 = load i32, i32* %55
%169 = call i64 @mmap(i32* null, i64 %160, i32 %163, i32 %166, i32 %167, i32 %168)
%170 = inttoptr i64 %169 to i8*
store i8* %170, i8** %12
%171 = load i64, i64* %56
%172 = load i32, i32* @PROT_READ
%173 = load i32, i32* @PROT_WRITE
%174 = or i32 %172, %173
%175 = load i32, i32* @MAP_PRIVATE
%176 = load i32, i32* @MAP_ANON
%177 = or i32 %175, %176
%178 = load i32, i32* %52
%179 = load i32, i32* %55
%180 = call i64 @mmap(i32* null, i64 %171, i32 %174, i32 %177, i32 %178, i32 %179)
%181 = inttoptr i64 %180 to i8*
store i8* %181, i8** %13
%182 = load i64, i64* %56
%183 = load i32, i32* @PROT_READ
%184 = load i32, i32* @PROT_WRITE
%185 = or i32 %183, %184
%186 = load i32, i32* @MAP_PRIVATE
%187 = load i32, i32* @MAP_ANON
%188 = or i32 %186, %187
%189 = load i32, i32* %52
%190 = load i32, i32* %55
%191 = call i64 @mmap(i32* null, i64 %182, i32 %185, i32 %188, i32 %189, i32 %190)
%192 = inttoptr i64 %191 to i8*
store i8* %192, i8** %14
%193 = load i8*, i8** %12
%194 = bitcast i8* %193 to double*
store double* %194, double** %5
%195 = load i8*, i8** %13
%196 = bitcast i8* %195 to double*
store double* %196, double** %6
%197 = load i8*, i8** %14
%198 = bitcast i8* %197 to double*
store double* %198, double** %7
store i32 0, i32* %15
br label %199
199: ; preds = %216, %112
%200 = load i32, i32* %15
%201 = load i32, i32* %24
%202 = icmp slt i32 %200, %201
br i1 %202, label %203, label %219
203: ; preds = %199
%204 = load double*, double** %5
%205 = load i32, i32* %15
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double, double* %204, i64 %206
store double 0.000000e+00, double* %207
%208 = load double*, double** %6
%209 = load i32, i32* %15
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds double, double* %208, i64 %210
store double 1.000000e+01, double* %211
%212 = load double*, double** %7
%213 = load i32, i32* %15
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %212, i64 %214
store double 1.000000e+01, double* %215
br label %216
216: ; preds = %203
%217 = load i32, i32* %15
%218 = add nsw i32 %217, 1
store i32 %218, i32* %15
br label %199
219: ; preds = %199
%220 = load i32, i32* %31
%221 = load i32, i32* %28
%222 = call i32 @pin_cpu(i32 %220, i32 %221)
%223 = icmp eq i32 %222, -1
br i1 %223, label %224, label %226
224: ; preds = %219
%225 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %230
226: ; preds = %219
%227 = load i32, i32* @stderr
%228 = load i32, i32* %28
%229 = call i32 (i32, i8*, i32, ...) @fprintf(i32 %227, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i32 %228)
br label %230
230: ; preds = %226, %224
%231 = load i32, i32* %22
%232 = load i32, i32* %24
%233 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i32 %231, i32 %232)
%234 = call i32 @gettimeofday(%struct.timeval* %49, i32* null)
store i32 %234, i32* %51
%235 = call i64 (...) @_rdtsc()
store i64 %235, i64* %37
store i32 0, i32* %15
br label %236
236: ; preds = %273, %230
%237 = load i32, i32* %15
%238 = load i32, i32* %22
%239 = icmp slt i32 %237, %238
br i1 %239, label %240, label %276
240: ; preds = %236
%241 = call i64 (...) @_rdtsc()
store i64 %241, i64* %34
%242 = load i32, i32* %24
%243 = load double, double* %8
%244 = load double*, double** %5
%245 = load double*, double** %6
%246 = load double*, double** %7
%247 = call i32 @triad(i32 %242, double %243, double* %244, double* %245, double* %246)
store i32 %247, i32* %29
%248 = call i64 (...) @_rdtsc()
store i64 %248, i64* %35
%249 = load i64, i64* %35
%250 = load i64, i64* %34
%251 = sub i64 %249, %250
store i64 %251, i64* %36
%252 = load double, double* %8
%253 = fadd double %252, 1.000000e-02
store double %253, double* %8
%254 = load i32, i32* %24
%255 = load i32, i32* %29
%256 = mul nsw i32 %254, %255
%257 = sext i32 %256 to i64
%258 = load i64, i64* %40
%259 = add i64 %258, %257
store i64 %259, i64* %40
%260 = load i32, i32* %24
%261 = load i32, i32* %29
%262 = mul nsw i32 %260, %261
%263 = sitofp i32 %262 to double
%264 = load i64, i64* %36
%265 = uitofp i64 %264 to double
%266 = fdiv double %263, %265
store double %266, double* %9
%267 = load double, double* %9
%268 = load double, double* %11
%269 = fcmp ogt double %267, %268
br i1 %269, label %270, label %272
270: ; preds = %240
%271 = load double, double* %9
store double %271, double* %11
br label %272
272: ; preds = %270, %240
br label %273
273: ; preds = %272
%274 = load i32, i32* %15
%275 = add nsw i32 %274, 1
store i32 %275, i32* %15
br label %236
276: ; preds = %236
%277 = call i64 (...) @_rdtsc()
store i64 %277, i64* %38
%278 = call i64 (...) @_loc_freq()
store i64 %278, i64* %54
%279 = call i32 @gettimeofday(%struct.timeval* %50, i32* null)
store i32 %279, i32* %51
%280 = getelementptr inbounds %struct.timeval, %struct.timeval* %50, i32 0, i32 1
%281 = load i64, i64* %280
%282 = getelementptr inbounds %struct.timeval, %struct.timeval* %49, i32 0, i32 1
%283 = load i64, i64* %282
%284 = sub nsw i64 %281, %283
%285 = mul i64 %284, 1000000
store i64 %285, i64* %53
%286 = getelementptr inbounds %struct.timeval, %struct.timeval* %50, i32 0, i32 0
%287 = load i64, i64* %286
%288 = getelementptr inbounds %struct.timeval, %struct.timeval* %49, i32 0, i32 0
%289 = load i64, i64* %288
%290 = sub nsw i64 %287, %289
%291 = load i64, i64* %53
%292 = add i64 %291, %290
store i64 %292, i64* %53
%293 = load i64, i64* %38
%294 = load i64, i64* %37
%295 = sub i64 %293, %294
store i64 %295, i64* %39
%296 = load i64, i64* %40
%297 = uitofp i64 %296 to double
%298 = load i64, i64* %39
%299 = uitofp i64 %298 to double
%300 = fdiv double %297, %299
store double %300, double* %10
%301 = load i64, i64* %40
%302 = load i32, i32* %25
%303 = load i64, i64* %36
%304 = load i64, i64* %39
%305 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.11, i64 0, i64 0), i64 %301, i32 %302, i64 %303, i64 %304)
%306 = load i64, i64* %39
%307 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i64 %306)
%308 = load i64, i64* %53
%309 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0), i64 %308)
%310 = load i64, i64* %54
%311 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i64 %310)
%312 = load double, double* %10
%313 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), double %312)
%314 = load double, double* %11
%315 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), double %314)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@.str.1 = [12 x i8] c" argc = %d\0A\00"
@.str.2 = [14 x i8] c"bad arguments\00"
@.str.3 = [14 x i8] c"i:r:l:m:a:b:c\00"
@optarg = global i32 0
@.str.4 = [18 x i8] c"unknown option %c\00"
@.str.5 = [23 x i8] c"failed to set affinity\00"
@stderr = global i32 0
@.str.6 = [47 x i8] c" process pinned to core %d for initialization\0A\00"
@.str.7 = [48 x i8] c"len = %d, mem_level = %d, iter = %d, mult = %d\0A\00"
@.str.8 = [60 x i8] c"len = %d, mem_level = %d, iter = %d, mult = %d, scale = %d\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANON = global i32 0
@.str.9 = [42 x i8] c" process pinned to core %d for triad run\0A\00"
@.str.10 = [39 x i8] c" calling triad %d times with len = %d\0A\00"
@.str.11 = [85 x i8] c" transfering %zd bytes from memory level %d took %zd cycles/call and a total of %zd\0A\00"
@.str.12 = [17 x i8] c" run time = %zd\0A\00"
@.str.13 = [30 x i8] c" gettimeofday_run time = %zd\0A\00"
@.str.14 = [17 x i8] c"frequency = %zd\0A\00"
@.str.15 = [27 x i8] c" average bytes/cycle = %f\0A\00"
@.str.16 = [24 x i8] c" best bytes/cycle = %f\0A\00"
@str = [153 x i8] c"triad driver needs at least 3 arguments, cpu_init, cpu_run, cache_level, [call count multiplier def = 1], [offset a, offset_b, offset_c defaults = 0] \00"
define void @main(i32 %0, i8** %1) {
%3 = alloca <4 x i32>
%4 = alloca %struct.timeval
%5 = alloca %struct.timeval
%6 = bitcast <4 x i32>* %3 to i8*
%7 = bitcast %struct.timeval* %4 to i8*
%8 = bitcast %struct.timeval* %5 to i8*
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([153 x i8], [153 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%13 = tail call i32 (...) @usage()
%14 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %10, %2
br label %16
16: ; preds = %45, %15
%17 = phi i32 [ undef, %15 ], [ %46, %45 ]
%18 = phi i32 [ undef, %15 ], [ %47, %45 ]
%19 = phi i32 [ undef, %15 ], [ %48, %45 ]
%20 = phi i32 [ 1, %15 ], [ %49, %45 ]
%21 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
switch i32 %21, label %43 [
i32 -1, label %50
i32 105, label %22
i32 114, label %25
i32 108, label %28
i32 109, label %31
i32 97, label %34
i32 98, label %37
i32 99, label %40
]
22: ; preds = %16
%23 = load i32, i32* @optarg
%24 = tail call i32 @atoi(i32 %23)
br label %45
25: ; preds = %16
%26 = load i32, i32* @optarg
%27 = tail call i32 @atoi(i32 %26)
br label %45
28: ; preds = %16
%29 = load i32, i32* @optarg
%30 = tail call i32 @atoi(i32 %29)
br label %45
31: ; preds = %16
%32 = load i32, i32* @optarg
%33 = tail call i32 @atoi(i32 %32)
br label %45
34: ; preds = %16
%35 = load i32, i32* @optarg
%36 = tail call i32 @atoi(i32 %35)
br label %45
37: ; preds = %16
%38 = load i32, i32* @optarg
%39 = tail call i32 @atoi(i32 %38)
br label %45
40: ; preds = %16
%41 = load i32, i32* @optarg
%42 = tail call i32 @atoi(i32 %41)
br label %45
43: ; preds = %16
%44 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %21)
br label %45
45: ; preds = %43, %40, %37, %34, %31, %28, %25, %22
%46 = phi i32 [ %17, %43 ], [ %17, %40 ], [ %17, %37 ], [ %17, %34 ], [ %17, %31 ], [ %17, %28 ], [ %27, %25 ], [ %17, %22 ]
%47 = phi i32 [ %18, %43 ], [ %18, %40 ], [ %18, %37 ], [ %18, %34 ], [ %18, %31 ], [ %18, %28 ], [ %18, %25 ], [ %24, %22 ]
%48 = phi i32 [ %19, %43 ], [ %19, %40 ], [ %19, %37 ], [ %19, %34 ], [ %19, %31 ], [ %30, %28 ], [ %19, %25 ], [ %19, %22 ]
%49 = phi i32 [ %20, %43 ], [ %20, %40 ], [ %20, %37 ], [ %20, %34 ], [ %33, %31 ], [ %20, %28 ], [ %20, %25 ], [ %20, %22 ]
br label %16
50: ; preds = %16
%51 = mul nsw i32 %20, 100
%52 = tail call i32 @pin_cpu(i32 0, i32 %18)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %59
56: ; preds = %50
%57 = load i32, i32* @stderr
%58 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32 %18)
br label %59
59: ; preds = %56, %54
store <4 x i32> <i32 16384, i32 262144, i32 8388608, i32 268435456>, <4 x i32>* %3
%60 = load i32, i32* @stderr
%61 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 268435456, i32 %19, i32 %51, i32 %20)
%62 = sext i32 %19 to i64
%63 = getelementptr inbounds <4 x i32>, <4 x i32>* %3, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = sdiv i32 %64, 32
%66 = load i32, i32* @stderr
%67 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %65, i32 %19, i32 %51, i32 %20)
%68 = shl nsw i32 %65, 5
%69 = sdiv i32 268435456, %68
%70 = load i32, i32* @stderr
%71 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 %65, i32 %19, i32 %51, i32 %20, i32 %69)
%72 = mul i32 %51, %20
%73 = mul i32 %72, %69
%74 = load i32, i32* @stderr
%75 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %65, i32 %19, i32 %73, i32 %20)
%76 = sext i32 %65 to i64
%77 = shl nsw i64 %76, 3
%78 = load i32, i32* @PROT_READ
%79 = load i32, i32* @PROT_WRITE
%80 = or i32 %79, %78
%81 = load i32, i32* @MAP_PRIVATE
%82 = load i32, i32* @MAP_ANON
%83 = or i32 %82, %81
%84 = tail call i64 @mmap(i32* null, i64 %77, i32 %80, i32 %83, i32 -1, i32 0)
%85 = load i32, i32* @PROT_READ
%86 = load i32, i32* @PROT_WRITE
%87 = or i32 %86, %85
%88 = load i32, i32* @MAP_PRIVATE
%89 = load i32, i32* @MAP_ANON
%90 = or i32 %89, %88
%91 = tail call i64 @mmap(i32* null, i64 %77, i32 %87, i32 %90, i32 -1, i32 0)
%92 = load i32, i32* @PROT_READ
%93 = load i32, i32* @PROT_WRITE
%94 = or i32 %93, %92
%95 = load i32, i32* @MAP_PRIVATE
%96 = load i32, i32* @MAP_ANON
%97 = or i32 %96, %95
%98 = tail call i64 @mmap(i32* null, i64 %77, i32 %94, i32 %97, i32 -1, i32 0)
%99 = inttoptr i64 %84 to double*
%100 = inttoptr i64 %84 to i8*
%101 = inttoptr i64 %91 to double*
%102 = inttoptr i64 %91 to i8*
%103 = inttoptr i64 %98 to double*
%104 = inttoptr i64 %98 to i8*
%105 = icmp sgt i32 %64, 31
br i1 %105, label %106, label %210
106: ; preds = %59
%107 = zext i32 %65 to i64
%108 = icmp ult i32 %65, 4
br i1 %108, label %185, label %109
109: ; preds = %106
%110 = getelementptr double, double* %99, i64 %107
%111 = bitcast double* %110 to i8*
%112 = getelementptr double, double* %101, i64 %107
%113 = bitcast double* %112 to i8*
%114 = getelementptr double, double* %103, i64 %107
%115 = bitcast double* %114 to i8*
%116 = icmp ult i8* %100, %113
%117 = icmp ult i8* %102, %111
%118 = and i1 %116, %117
%119 = icmp ult i8* %100, %115
%120 = icmp ult i8* %104, %111
%121 = and i1 %119, %120
%122 = or i1 %118, %121
%123 = icmp ult i8* %102, %115
%124 = icmp ult i8* %104, %113
%125 = and i1 %123, %124
%126 = or i1 %122, %125
br i1 %126, label %185, label %127
127: ; preds = %109
%128 = and i64 %107, 4294967292
%129 = add nsw i64 %128, -4
%130 = lshr exact i64 %129, 2
%131 = add nuw nsw i64 %130, 1
%132 = and i64 %131, 1
%133 = icmp eq i64 %129, 0
br i1 %133, label %167, label %134
134: ; preds = %127
%135 = and i64 %131, 9223372036854775806
br label %136
136: ; preds = %136, %134
%137 = phi i64 [ 0, %134 ], [ %164, %136 ]
%138 = phi i64 [ 0, %134 ], [ %165, %136 ]
%139 = getelementptr inbounds double, double* %99, i64 %137
%140 = bitcast double* %139 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %140
%141 = getelementptr inbounds double, double* %139, i64 2
%142 = bitcast double* %141 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %142
%143 = getelementptr inbounds double, double* %101, i64 %137
%144 = bitcast double* %143 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %144
%145 = getelementptr inbounds double, double* %143, i64 2
%146 = bitcast double* %145 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %146
%147 = getelementptr inbounds double, double* %103, i64 %137
%148 = bitcast double* %147 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %148
%149 = getelementptr inbounds double, double* %147, i64 2
%150 = bitcast double* %149 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %150
%151 = or i64 %137, 4
%152 = getelementptr inbounds double, double* %99, i64 %151
%153 = bitcast double* %152 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %153
%154 = getelementptr inbounds double, double* %152, i64 2
%155 = bitcast double* %154 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %155
%156 = getelementptr inbounds double, double* %101, i64 %151
%157 = bitcast double* %156 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %157
%158 = getelementptr inbounds double, double* %156, i64 2
%159 = bitcast double* %158 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %159
%160 = getelementptr inbounds double, double* %103, i64 %151
%161 = bitcast double* %160 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %161
%162 = getelementptr inbounds double, double* %160, i64 2
%163 = bitcast double* %162 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %163
%164 = add nuw i64 %137, 8
%165 = add i64 %138, 2
%166 = icmp eq i64 %165, %135
br i1 %166, label %167, label %136
167: ; preds = %136, %127
%168 = phi i64 [ 0, %127 ], [ %164, %136 ]
%169 = icmp eq i64 %132, 0
br i1 %169, label %183, label %170
170: ; preds = %167
%171 = getelementptr inbounds double, double* %99, i64 %168
%172 = bitcast double* %171 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %172
%173 = getelementptr inbounds double, double* %171, i64 2
%174 = bitcast double* %173 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %174
%175 = getelementptr inbounds double, double* %101, i64 %168
%176 = bitcast double* %175 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %176
%177 = getelementptr inbounds double, double* %175, i64 2
%178 = bitcast double* %177 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %178
%179 = getelementptr inbounds double, double* %103, i64 %168
%180 = bitcast double* %179 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %180
%181 = getelementptr inbounds double, double* %179, i64 2
%182 = bitcast double* %181 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %182
br label %183
183: ; preds = %167, %170
%184 = icmp eq i64 %128, %107
br i1 %184, label %210, label %185
185: ; preds = %109, %106, %183
%186 = phi i64 [ 0, %109 ], [ 0, %106 ], [ %128, %183 ]
%187 = xor i64 %186, -1
%188 = and i64 %107, 1
%189 = icmp eq i64 %188, 0
br i1 %189, label %195, label %190
190: ; preds = %185
%191 = getelementptr inbounds double, double* %99, i64 %186
store double 0.000000e+00, double* %191
%192 = getelementptr inbounds double, double* %101, i64 %186
store double 1.000000e+01, double* %192
%193 = getelementptr inbounds double, double* %103, i64 %186
store double 1.000000e+01, double* %193
%194 = or i64 %186, 1
br label %195
195: ; preds = %190, %185
%196 = phi i64 [ %186, %185 ], [ %194, %190 ]
%197 = sub nsw i64 0, %107
%198 = icmp eq i64 %187, %197
br i1 %198, label %210, label %199
199: ; preds = %195, %199
%200 = phi i64 [ %208, %199 ], [ %196, %195 ]
%201 = getelementptr inbounds double, double* %99, i64 %200
store double 0.000000e+00, double* %201
%202 = getelementptr inbounds double, double* %101, i64 %200
store double 1.000000e+01, double* %202
%203 = getelementptr inbounds double, double* %103, i64 %200
store double 1.000000e+01, double* %203
%204 = add nuw nsw i64 %200, 1
%205 = getelementptr inbounds double, double* %99, i64 %204
store double 0.000000e+00, double* %205
%206 = getelementptr inbounds double, double* %101, i64 %204
store double 1.000000e+01, double* %206
%207 = getelementptr inbounds double, double* %103, i64 %204
store double 1.000000e+01, double* %207
%208 = add nuw nsw i64 %200, 2
%209 = icmp eq i64 %208, %107
br i1 %209, label %210, label %199
210: ; preds = %195, %199, %183, %59
%211 = tail call i32 @pin_cpu(i32 0, i32 %17)
%212 = icmp eq i32 %211, -1
br i1 %212, label %213, label %215
213: ; preds = %210
%214 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %218
215: ; preds = %210
%216 = load i32, i32* @stderr
%217 = tail call i32 (i32, i8*, i32, ...) @fprintf(i32 %216, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0), i32 %17)
br label %218
218: ; preds = %215, %213
%219 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i32 %73, i32 %65)
%220 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%221 = tail call i64 (...) @_rdtsc()
%222 = icmp sgt i32 %73, 0
br i1 %222, label %223, label %243
223: ; preds = %218, %223
%224 = phi double [ %232, %223 ], [ 1.000000e-02, %218 ]
%225 = phi double [ %240, %223 ], [ -1.000000e+00, %218 ]
%226 = phi i32 [ %241, %223 ], [ 0, %218 ]
%227 = phi i64 [ %235, %223 ], [ 0, %218 ]
%228 = tail call i64 (...) @_rdtsc()
%229 = tail call i32 @triad(i32 %65, double %224, double* %99, double* %101, double* %103)
%230 = tail call i64 (...) @_rdtsc()
%231 = sub i64 %230, %228
%232 = fadd double %224, 1.000000e-02
%233 = mul nsw i32 %229, %65
%234 = sext i32 %233 to i64
%235 = add i64 %227, %234
%236 = sitofp i32 %233 to double
%237 = uitofp i64 %231 to double
%238 = fdiv double %236, %237
%239 = fcmp ogt double %238, %225
%240 = select i1 %239, double %238, double %225
%241 = add nuw nsw i32 %226, 1
%242 = icmp eq i32 %241, %73
br i1 %242, label %243, label %223
243: ; preds = %223, %218
%244 = phi i64 [ 0, %218 ], [ %235, %223 ]
%245 = phi i64 [ undef, %218 ], [ %231, %223 ]
%246 = phi double [ -1.000000e+00, %218 ], [ %240, %223 ]
%247 = tail call i64 (...) @_rdtsc()
%248 = tail call i64 (...) @_loc_freq()
%249 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%250 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 1
%251 = load i64, i64* %250
%252 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%253 = load i64, i64* %252
%254 = sub nsw i64 %251, %253
%255 = mul i64 %254, 1000000
%256 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i64 0, i32 0
%257 = load i64, i64* %256
%258 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%259 = load i64, i64* %258
%260 = sub i64 %257, %259
%261 = add i64 %260, %255
%262 = sub i64 %247, %221
%263 = uitofp i64 %244 to double
%264 = uitofp i64 %262 to double
%265 = fdiv double %263, %264
%266 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @.str.11, i64 0, i64 0), i64 %244, i32 %19, i64 %245, i64 %262)
%267 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i64 %262)
%268 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.13, i64 0, i64 0), i64 %261)
%269 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i64 0, i64 0), i64 %248)
%270 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.15, i64 0, i64 0), double %265)
%271 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), double %246)
ret void
}