#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ cpu_set_t;
typedef int /*<<< orphan*/ __pid_t;

/* Variables and functions */
unsigned long long _rdtsc();
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
char *malloc(int);
int /*<<< orphan*/ optarg;
int pin_cpu(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int triad(int, int, double *, double *, int *);
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;
  int inner = 8, mod_inner, *index;
  unsigned long long start, stop, run_time, call_start, call_stop,
      call_run_time, total_bytes = 0;
  __pid_t pid = 0;
  int cpu_setsize;
  cpu_set_t mask;
  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);
  mod_inner = len % inner;
  if (mod_inner != 0)
    err(1, " buffer size len not divisible by inner, %d, mod_inner = %d", inner,
        mod_inner);
  buf1 = malloc(sizeof(double) * len + 4096 + 1024);
  fprintf(stderr, " buf1 = %p\n", buf1);
  buf1 = buf1 + (0x1000 - (unsigned int)buf1 & 0xFFF) + offset_a;
  fprintf(stderr, " buf1 = %p\n", buf1);
  a = (double *)buf1;
  buf2 = malloc(sizeof(double) * len + 4096 + 1024);
  fprintf(stderr, " buf2 = %p\n", buf2);
  buf2 = buf2 + (0x1000 - (unsigned int)buf2 & 0xFFF) + offset_b;
  fprintf(stderr, " buf2 = %p\n", buf2);
  b = (double *)buf2;
  buf3 = malloc(sizeof(double) * len + 4096 + 1024);
  fprintf(stderr, " buf3 = %p\n", buf3);
  buf3 = buf3 + (0x1000 - (unsigned int)buf3 & 0xFFF) + offset_c;
  fprintf(stderr, " buf3 = %p\n", buf3);
  c = (double *)buf3;
  for (i = 0; i < len; i++) {
    a[i] = 0.;
    b[i] = 10.;
    c[i] = 10.;
  }
  len = len / inner;
  index = (int *)malloc(len * sizeof(int));
  if (index == NULL)
    err(1, "malloc of index failed");
  j = 0;
  for (i = 0; i < len; i++) {
    index[i] = j;
    j += inner;
  }
  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);
  call_start = _rdtsc();
  for (i = 0; i < iter; i++) {
    start = _rdtsc();
    bytes_per = triad(len, inner, a, b, index);
    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();
  call_run_time = call_stop - call_start;
  avg_bw = (double)(total_bytes) / (double)call_run_time;
  printf(" transfering %lld bytes from memory level %d took %lld cycles\n",
         total_bytes, mem_level, run_time);
  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    $0x120,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xe4e(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe39(%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   $0x8,-0xb4(%rbp)
movq   $0x0,-0xf8(%rbp)
movl   $0x0,-0xfc(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    1251 <main+0xb1>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   10a0 <usage@plt>
mov    $0x1,%edi
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
movl   $0x10000000,-0x88(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xed3(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x84(%rbp)
cmp    $0xffffffff,%eax
je     1370 <main+0x1d0>
mov    -0x84(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x110(%rbp)
sub    $0x11,%eax
ja     1352 <main+0x1b2>
mov    -0x110(%rbp),%rax
lea    0xd9a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0xa4(%rbp)
jmp    136b <main+0x1cb>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0xa8(%rbp)
jmp    136b <main+0x1cb>
mov    0x2d10(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x8c(%rbp)
jmp    136b <main+0x1cb>
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x7c(%rbp)
jmp    136b <main+0x1cb>
mov    0x2ce1(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x70(%rbp)
jmp    136b <main+0x1cb>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x74(%rbp)
jmp    136b <main+0x1cb>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
call   10c0 <atoi@plt>
mov    %eax,-0x78(%rbp)
jmp    136b <main+0x1cb>
mov    -0x84(%rbp),%edx
mov    $0x1,%edi
lea    0xde6(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
jmp    125b <main+0xbb>
mov    -0x80(%rbp),%eax
imul   -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0xfc(%rbp),%edi
mov    -0xa4(%rbp),%esi
call   1040 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    13ac <main+0x20c>
mov    $0x1,%edi
lea    0xdbc(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
jmp    13c9 <main+0x229>
mov    0x2c25(%rip),%rax
mov    (%rax),%edi
mov    -0xa4(%rbp),%edx
lea    0xdb1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x4000,-0xa0(%rbp)
movl   $0x40000,-0x9c(%rbp)
movl   $0x800000,-0x98(%rbp)
movl   $0x10000000,-0x94(%rbp)
mov    0x2be0(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xd8d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movslq -0x8c(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    0x2b99(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xd46(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x94(%rbp),%eax
mov    -0x88(%rbp),%ecx
shl    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0xb0(%rbp)
mov    0x2b56(%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    0xd2d(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x80(%rbp),%eax
imul   -0xb0(%rbp),%eax
imul   -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    0x2b11(%rip),%rax
mov    (%rax),%edi
mov    -0x88(%rbp),%edx
mov    -0x8c(%rbp),%ecx
mov    -0x80(%rbp),%r8d
mov    -0x7c(%rbp),%r9d
lea    0xcbe(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x88(%rbp),%eax
cltd
idivl  -0xb4(%rbp)
mov    %edx,-0xb8(%rbp)
cmpl   $0x0,-0xb8(%rbp)
je     152a <main+0x38a>
mov    -0xb4(%rbp),%edx
mov    -0xb8(%rbp),%ecx
mov    $0x1,%edi
lea    0xceb(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
movslq -0x88(%rbp),%rax
shl    $0x3,%rax
add    $0x1000,%rax
add    $0x400,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    0x2a85(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rdx
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x50(%rbp),%rax
mov    -0x50(%rbp),%rcx
mov    %ecx,%edx
mov    $0x1000,%ecx
sub    %edx,%ecx
and    $0xfff,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
movslq -0x70(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    0x2a43(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rdx
lea    0xca8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x18(%rbp)
movslq -0x88(%rbp),%rax
shl    $0x3,%rax
add    $0x1000,%rax
add    $0x400,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    0x29fe(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%rdx
lea    0xc6f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x58(%rbp),%rax
mov    -0x58(%rbp),%rcx
mov    %ecx,%edx
mov    $0x1000,%ecx
sub    %edx,%ecx
and    $0xfff,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
movslq -0x74(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    0x29bc(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%rdx
lea    0xc2d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x58(%rbp),%rax
mov    %rax,-0x20(%rbp)
movslq -0x88(%rbp),%rax
shl    $0x3,%rax
add    $0x1000,%rax
add    $0x400,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    0x2977(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%rdx
lea    0xbf4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x60(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    %ecx,%edx
mov    $0x1000,%ecx
sub    %edx,%ecx
and    $0xfff,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    0x2935(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%rdx
lea    0xbb2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    171d <main+0x57d>
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  0x91b(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  0x906(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    16c6 <main+0x526>
mov    -0x88(%rbp),%eax
cltd
idivl  -0xb4(%rbp)
mov    %eax,-0x88(%rbp)
movslq -0x88(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0xc0(%rbp)
cmpq   $0x0,-0xc0(%rbp)
jne    176a <main+0x5ca>
mov    $0x1,%edi
lea    0xb0b(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
movl   $0x0,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x88(%rbp),%eax
jge    17b2 <main+0x612>
mov    -0x68(%rbp),%edx
mov    -0xc0(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xb4(%rbp),%eax
add    -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1778 <main+0x5d8>
mov    -0xfc(%rbp),%edi
mov    -0xa8(%rbp),%esi
call   1040 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    17e4 <main+0x644>
mov    $0x1,%edi
lea    0x984(%rip),%rsi
mov    $0x0,%al
call   1070 <err@plt>
jmp    1801 <main+0x661>
mov    0x27ed(%rip),%rax
mov    (%rax),%edi
mov    -0xa8(%rbp),%edx
lea    0xa8b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x80(%rbp),%esi
mov    -0x88(%rbp),%edx
lea    0xa9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1090 <_rdtsc@plt>
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x80(%rbp),%eax
jge    194b <main+0x7ab>
xor    %eax,%eax
mov    %al,-0x111(%rbp)
call   1090 <_rdtsc@plt>
mov    %rax,-0xc8(%rbp)
mov    -0x88(%rbp),%edi
mov    -0xb4(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0xc0(%rbp),%r8
call   1060 <triad@plt>
mov    %eax,%ecx
mov    -0x111(%rbp),%al
mov    %ecx,-0xac(%rbp)
call   1090 <_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  0x75c(%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 0x72e(%rip),%xmm2
movq   -0xd8(%rbp),%xmm1
ff
punpckldq %xmm2,%xmm1
movapd 0x72a(%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    1938 <main+0x798>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    193d <main+0x79d>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    182d <main+0x68d>
xor    %eax,%eax
call   1090 <_rdtsc@plt>
mov    %rax,-0xe8(%rbp)
mov    -0xe8(%rbp),%rax
mov    -0xe0(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xf0(%rbp)
movaps 0x6a8(%rip),%xmm3
movq   -0xf8(%rbp),%xmm0
ff
punpckldq %xmm3,%xmm0
movapd 0x6a4(%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
lea    0x8fc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0x928(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0x930(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%rbx
mov    %edi,%r13d
cmp    $0x2,%edi
jg     1213 <main+0x53>
lea    0x1163(%rip),%rdi
call   1030 <puts@plt>
lea    0xf31(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   10c0 <usage@plt>
lea    0xf25(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
movl   $0x1,0x10(%rsp)
lea    0xf18(%rip),%r12
lea    0xeaf(%rip),%rbp
mov    0x2dc8(%rip),%r14
movl   $0x0,0x30(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x20(%rsp)
jmp    1260 <main+0xa0>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x30(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   10d0 <getopt@plt>
lea    -0x61(%rax),%ecx
cmp    $0x11,%ecx
ja     12d3 <main+0x113>
movslq 0x0(%rbp,%rcx,4),%rcx
add    %rbp,%rcx
jmp    *%rcx
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x20(%rsp)
jmp    1260 <main+0xa0>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x18(%rsp)
jmp    1260 <main+0xa0>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,%r15d
jmp    1260 <main+0xa0>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x2c(%rsp)
jmp    1260 <main+0xa0>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x10(%rsp)
jmp    1260 <main+0xa0>
mov    (%r14),%edi
call   10e0 <atoi@plt>
mov    %eax,0x50(%rsp)
jmp    1260 <main+0xa0>
cmp    $0xffffffff,%eax
je     12f2 <main+0x132>
mov    $0x1,%edi
lea    0xe64(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <err@plt>
jmp    1260 <main+0xa0>
imul   $0x64,0x10(%rsp),%r14d
xor    %edi,%edi
mov    %r15d,%esi
call   1060 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     1323 <main+0x163>
mov    0x2cca(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    1336 <main+0x176>
lea    0xe30(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
movdqa 0xcc2(%rip),%xmm0
movdqa %xmm0,0x80(%rsp)
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%r12
mov    %r12,%rsi
mov    $0x10000000,%edx
mov    0x2c(%rsp),%ebx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    0x10(%rsp),%r13d
mov    %r13d,%r9d
xor    %eax,%eax
call   1070 <fprintf@plt>
movslq %ebx,%rbx
mov    0x80(%rsp,%rbx,4),%eax
lea    0x1f(%rax),%ebp
test   %eax,%eax
mov    %rax,0x48(%rsp)
cmovns %eax,%ebp
mov    %ebp,%r15d
sar    $0x5,%r15d
mov    0x2c3c(%rip),%rax
mov    (%rax),%edi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %r13d,%r9d
xor    %eax,%eax
call   1070 <fprintf@plt>
and    $0xffffffe0,%ebp
mov    $0x10000000,%eax
xor    %edx,%edx
idiv   %ebp
mov    %eax,%r12d
mov    0x2c0f(%rip),%rbp
mov    0x0(%rbp),%edi
mov    %eax,(%rsp)
lea    0xdfa(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %r13d,%r9d
xor    %eax,%eax
call   1070 <fprintf@plt>
imul   %r13d,%r14d
imul   %r12d,%r14d
mov    0x0(%rbp),%edi
lea    0xda6(%rip),%rsi
mov    %r15d,%edx
mov    %ebx,%ecx
mov    %r14d,0x5c(%rsp)
mov    %r14d,%r8d
mov    %r13d,%r9d
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0x7(%r15),%eax
test   %r15d,%r15d
cmovns %r15d,%eax
and    $0xfffffff8,%eax
mov    %r15d,%ecx
sub    %eax,%ecx
je     143e <main+0x27e>
lea    0xddf(%rip),%rsi
mov    $0x1,%edi
mov    $0x8,%edx
xor    %eax,%eax
call   1090 <err@plt>
lea    0x1400(,%r15,8),%r14d
mov    %r14d,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    0x2b80(%rip),%r13
mov    0x0(%r13),%edi
lea    0xde5(%rip),%r12
mov    %r12,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %ebx,%eax
neg    %eax
and    $0xfff,%eax
add    %rbx,%rax
movslq 0x20(%rsp),%rdx
add    %rax,%rdx
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %rdx,0x20(%rsp)
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14d,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    0x0(%r13),%edi
lea    0xda7(%rip),%rbp
mov    %rbp,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %ebx,%r12d
neg    %r12d
and    $0xfff,%r12d
mov    %rbx,0x78(%rsp)
lea    (%rbx,%r12,1),%rdx
movslq 0x18(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    %rdx,0x68(%rsp)
add    %rax,%rdx
mov    %rdx,0x18(%rsp)
mov    0x0(%r13),%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14d,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    0x0(%r13),%edi
lea    0xd55(%rip),%rbx
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %ebp,%r14d
neg    %r14d
and    $0xfff,%r14d
mov    %rbp,0x70(%rsp)
lea    (%r14,%rbp,1),%rdx
movslq 0x30(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    %rdx,0x60(%rsp)
lea    (%rdx,%rax,1),%rbp
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
cmpl   $0x20,0x48(%rsp)
jl     16e2 <main+0x522>
lea    -0x1(%r15),%eax
lea    0x8(,%rax,8),%rdx
xor    %ebx,%ebx
mov    0x20(%rsp),%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r15d,%eax
cmp    $0x4,%r15d
jae    158a <main+0x3ca>
mov    0x18(%rsp),%rdx
jmp    16b9 <main+0x4f9>
mov    %eax,%ebx
and    $0xfffffffc,%ebx
lea    -0x4(%rbx),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%r8d
and    $0x3,%r8d
cmp    $0xc,%rcx
jae    15bc <main+0x3fc>
xor    %esi,%esi
mov    0x10(%rsp),%r9
mov    0x30(%rsp),%r13
jmp    1658 <main+0x498>
and    $0xfffffffffffffffc,%rdx
mov    0x10(%rsp),%r9
mov    0x68(%rsp),%rcx
lea    (%r9,%rcx,1),%rdi
add    $0x70,%rdi
mov    0x30(%rsp),%r13
mov    0x60(%rsp),%rcx
add    %r13,%rcx
add    $0x70,%rcx
xor    %esi,%esi
movdqa 0xa23(%rip),%xmm0
nopl   (%rax)
movdqu %xmm0,-0x70(%rdi,%rsi,8)
movdqu %xmm0,-0x60(%rdi,%rsi,8)
movdqu %xmm0,-0x70(%rcx,%rsi,8)
movdqu %xmm0,-0x60(%rcx,%rsi,8)
movdqu %xmm0,-0x50(%rdi,%rsi,8)
movdqu %xmm0,-0x40(%rdi,%rsi,8)
movdqu %xmm0,-0x50(%rcx,%rsi,8)
movdqu %xmm0,-0x40(%rcx,%rsi,8)
movdqu %xmm0,-0x30(%rdi,%rsi,8)
movdqu %xmm0,-0x20(%rdi,%rsi,8)
movdqu %xmm0,-0x30(%rcx,%rsi,8)
movdqu %xmm0,-0x20(%rcx,%rsi,8)
movdqu %xmm0,-0x10(%rdi,%rsi,8)
movdqu %xmm0,(%rdi,%rsi,8)
movdqu %xmm0,-0x10(%rcx,%rsi,8)
movdqu %xmm0,(%rcx,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rdx
jne    15f0 <main+0x430>
test   %r8,%r8
je     16af <main+0x4ef>
lea    (%r14,%rsi,8),%rcx
add    0x70(%rsp),%rcx
add    %r13,%rcx
add    $0x10,%rcx
lea    (%r12,%rsi,8),%rdx
add    0x78(%rsp),%rdx
add    %r9,%rdx
add    $0x10,%rdx
shl    $0x5,%r8
xor    %esi,%esi
movdqa 0x985(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movdqu %xmm0,-0x10(%rdx,%rsi,1)
movdqu %xmm0,(%rdx,%rsi,1)
movdqu %xmm0,-0x10(%rcx,%rsi,1)
movdqu %xmm0,(%rcx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r8
jne    1690 <main+0x4d0>
cmp    %rax,%rbx
mov    0x18(%rsp),%rdx
je     16e2 <main+0x522>
movabs $0x4024000000000000,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,(%rdx,%rbx,8)
mov    %rcx,0x0(%rbp,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rax
jne    16d0 <main+0x510>
mov    0x48(%rsp),%rbx
lea    0xff(%rbx),%ebp
test   %ebx,%ebx
cmovns %ebx,%ebp
sar    $0x8,%ebp
lea    0x0(,%rbp,4),%edi
call   10a0 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
jne    171c <main+0x55c>
lea    0xb5c(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
cmp    $0x100,%ebx
mov    0x50(%rsp),%ebx
mov    0x5c(%rsp),%r13d
jl     18b0 <main+0x6f0>
mov    %ebp,%eax
cmp    $0x8,%ebp
jae    1741 <main+0x581>
xor    %ecx,%ecx
xor    %edx,%edx
jmp    18a0 <main+0x6e0>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rdi
mov    %rdi,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
mov    %esi,%edx
and    $0x3,%edx
cmp    $0x18,%rdi
jae    176f <main+0x5af>
movdqa 0x8b8(%rip),%xmm0
xor    %edi,%edi
jmp    1840 <main+0x680>
and    $0xfffffffffffffffc,%rsi
movdqa 0x8a5(%rip),%xmm0
xor    %edi,%edi
movdqa 0x8aa(%rip),%xmm8
movdqa 0x8b1(%rip),%xmm9
movdqa 0x8b8(%rip),%xmm10
movdqa 0x8c0(%rip),%xmm4
movdqa 0x8c8(%rip),%xmm5
movdqa 0x8d0(%rip),%xmm6
movdqa 0x8d8(%rip),%xmm7
movdqa 0x8e0(%rip),%xmm1
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqu %xmm0,(%r15,%rdi,4)
movdqu %xmm2,0x10(%r15,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqu %xmm2,0x20(%r15,%rdi,4)
movdqu %xmm3,0x30(%r15,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqu %xmm2,0x40(%r15,%rdi,4)
movdqu %xmm3,0x50(%r15,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqu %xmm2,0x60(%r15,%rdi,4)
movdqu %xmm3,0x70(%r15,%rdi,4)
add    $0x20,%rdi
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffc,%rsi
jne    17c0 <main+0x600>
test   %rdx,%rdx
je     1890 <main+0x6d0>
lea    (%r15,%rdi,4),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movdqa 0x7d5(%rip),%xmm1
movdqa 0x7dd(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movdqa %xmm0,%xmm3
paddd  %xmm1,%xmm3
movdqu %xmm0,-0x10(%rsi,%rdi,1)
movdqu %xmm3,(%rsi,%rdi,1)
paddd  %xmm2,%xmm0
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    1870 <main+0x6b0>
cmp    %rax,%rcx
je     18b0 <main+0x6f0>
lea    0x0(,%rcx,8),%edx
nopl   0x0(%rax)
mov    %edx,(%r15,%rcx,4)
add    $0x8,%edx
add    $0x1,%rcx
cmp    %rcx,%rax
jne    18a0 <main+0x6e0>
xor    %edi,%edi
mov    %ebx,%esi
call   1060 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     18d9 <main+0x719>
mov    0x2713(%rip),%rax
mov    (%rax),%edi
lea    0x9b5(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    18ec <main+0x72c>
lea    0x87a(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
lea    0x9ba(%rip),%rdi
xor    %ebx,%ebx
mov    %r13d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,0x48(%rsp)
test   %r13d,%r13d
jle    19ca <main+0x80a>
movsd  0x7b2(%rip),%xmm0
xor    %ebx,%ebx
mov    %rbp,0x50(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x30(%rsp)
mov    %rbx,0x10(%rsp)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r12
mov    0x50(%rsp),%rbx
mov    %ebx,%edi
mov    $0x8,%esi
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    %r15,%r8
call   1080 <triad@plt>
mov    %r15,%rbp
mov    %eax,%r15d
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r14
sub    %r12,%r14
imul   %ebx,%r15d
mov    0x10(%rsp),%rbx
movslq %r15d,%rax
mov    %rbp,%r15
add    %rax,%rbx
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
movq   %r14,%xmm0
punpckldq 0x714(%rip),%xmm0
subpd  0x71c(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
maxsd  0x30(%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0xffffffff,%r13d
jne    1930 <main+0x770>
jmp    19d2 <main+0x812>
movq   0x6fe(%rip),%xmm2
movq   %xmm2,0x10(%rsp)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
sub    0x48(%rsp),%rax
movq   %rbx,%xmm0
movdqa 0x6bf(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0x6c3(%rip),%xmm2
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movq   %rax,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm3
movapd %xmm3,0x30(%rsp)
lea    0x89d(%rip),%rdi
mov    %rbx,%rsi
mov    0x2c(%rsp),%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8c4(%rip),%rdi
movaps 0x30(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0x8cc(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.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"
@.str.9 = [60 x i8] c" buffer size len not divisible by inner, %d, mod_inner = %d\00"
@.str.10 = [12 x i8] c" buf1 = %p\0A\00"
@.str.11 = [12 x i8] c" buf2 = %p\0A\00"
@.str.12 = [12 x i8] c" buf3 = %p\0A\00"
@.str.13 = [23 x i8] c"malloc of index failed\00"
@.str.14 = [42 x i8] c" process pinned to core %d for triad run\0A\00"
@.str.15 = [39 x i8] c" calling triad %d times with len = %d\0A\00"
@.str.16 = [63 x i8] c" transfering %lld bytes from memory level %d took %lld cycles\0A\00"
@.str.17 = [27 x i8] c" average bytes/cycle = %f\0A\00"
@.str.18 = [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 i32
%42 = alloca i32
%43 = alloca i32
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 8, i32* %31
store i64 0, i64* %40
store i32 0, i32* %41
%44 = load i32, i32* %3
%45 = icmp slt i32 %44, 3
br i1 %45, label %46, label %52
46: ; preds = %2
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0))
%48 = load i32, i32* %3
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = call i32 (...) @usage()
%51 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %46, %2
store i32 268435456, i32* %24
br label %53
53: ; preds = %84, %52
%54 = load i32, i32* %3
%55 = load i8**, i8*** %4
%56 = call i32 @getopt(i32 %54, i8** %55, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 %56, i32* %23
%57 = icmp ne i32 %56, -1
br i1 %57, label %58, label %85
58: ; preds = %53
%59 = load i32, i32* %23
switch i32 %59, label %81 [
i32 105, label %60
i32 114, label %63
i32 108, label %66
i32 109, label %69
i32 97, label %72
i32 98, label %75
i32 99, label %78
]
60: ; preds = %58
%61 = load i32, i32* @optarg
%62 = call i32 @atoi(i32 %61)
store i32 %62, i32* %27
br label %84
63: ; preds = %58
%64 = load i32, i32* @optarg
%65 = call i32 @atoi(i32 %64)
store i32 %65, i32* %28
br label %84
66: ; preds = %58
%67 = load i32, i32* @optarg
%68 = call i32 @atoi(i32 %67)
store i32 %68, i32* %25
br label %84
69: ; preds = %58
%70 = load i32, i32* @optarg
%71 = call i32 @atoi(i32 %70)
store i32 %71, i32* %21
br label %84
72: ; preds = %58
%73 = load i32, i32* @optarg
%74 = call i32 @atoi(i32 %73)
store i32 %74, i32* %18
br label %84
75: ; preds = %58
%76 = load i32, i32* @optarg
%77 = call i32 @atoi(i32 %76)
store i32 %77, i32* %19
br label %84
78: ; preds = %58
%79 = load i32, i32* @optarg
%80 = call i32 @atoi(i32 %79)
store i32 %80, i32* %20
br label %84
81: ; preds = %58
%82 = load i32, i32* %23
%83 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %82)
br label %84
84: ; preds = %81, %78, %75, %72, %69, %66, %63, %60
br label %53
85: ; preds = %53
%86 = load i32, i32* %22
%87 = load i32, i32* %21
%88 = mul nsw i32 %86, %87
store i32 %88, i32* %22
%89 = load i32, i32* %41
%90 = load i32, i32* %27
%91 = call i32 @pin_cpu(i32 %89, i32 %90)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %95
93: ; preds = %85
%94 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %99
95: ; preds = %85
%96 = load i32, i32* @stderr
%97 = load i32, i32* %27
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32 %97)
br label %99
99: ; preds = %95, %93
%100 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 0
store i32 16384, i32* %100
%101 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 1
store i32 262144, i32* %101
%102 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 2
store i32 8388608, i32* %102
%103 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 3
store i32 268435456, i32* %103
%104 = load i32, i32* @stderr
%105 = load i32, i32* %24
%106 = load i32, i32* %25
%107 = load i32, i32* %22
%108 = load i32, i32* %21
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %105, i32 %106, i32 %107, i32 %108)
%110 = load i32, i32* %25
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 %111
%113 = load i32, i32* %112
%114 = sdiv i32 %113, 32
store i32 %114, i32* %24
%115 = load i32, i32* @stderr
%116 = load i32, i32* %24
%117 = load i32, i32* %25
%118 = load i32, i32* %22
%119 = load i32, i32* %21
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %116, i32 %117, i32 %118, i32 %119)
%121 = getelementptr inbounds [4 x i32], [4 x i32]* %26, i64 0, i64 3
%122 = load i32, i32* %121
%123 = load i32, i32* %24
%124 = mul nsw i32 32, %123
%125 = sdiv i32 %122, %124
store i32 %125, i32* %30
%126 = load i32, i32* @stderr
%127 = load i32, i32* %24
%128 = load i32, i32* %25
%129 = load i32, i32* %22
%130 = load i32, i32* %21
%131 = load i32, i32* %30
%132 = call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 %127, i32 %128, i32 %129, i32 %130, i32 %131)
%133 = load i32, i32* %22
%134 = load i32, i32* %30
%135 = mul nsw i32 %133, %134
%136 = load i32, i32* %21
%137 = mul nsw i32 %135, %136
store i32 %137, i32* %22
%138 = load i32, i32* @stderr
%139 = load i32, i32* %24
%140 = load i32, i32* %25
%141 = load i32, i32* %22
%142 = load i32, i32* %21
%143 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %139, i32 %140, i32 %141, i32 %142)
%144 = load i32, i32* %24
%145 = load i32, i32* %31
%146 = srem i32 %144, %145
store i32 %146, i32* %32
%147 = load i32, i32* %32
%148 = icmp ne i32 %147, 0
br i1 %148, label %149, label %153
149: ; preds = %99
%150 = load i32, i32* %31
%151 = load i32, i32* %32
%152 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 %150, i32 %151)
br label %153
153: ; preds = %149, %99
%154 = load i32, i32* %24
%155 = sext i32 %154 to i64
%156 = mul i64 8, %155
%157 = add i64 %156, 4096
%158 = add i64 %157, 1024
%159 = trunc i64 %158 to i32
%160 = call i8* @malloc(i32 %159)
store i8* %160, i8** %12
%161 = load i32, i32* @stderr
%162 = load i8*, i8** %12
%163 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %162)
%164 = load i8*, i8** %12
%165 = load i8*, i8** %12
%166 = ptrtoint i8* %165 to i32
%167 = sub i32 4096, %166
%168 = and i32 %167, 4095
%169 = zext i32 %168 to i64
%170 = getelementptr inbounds i8, i8* %164, i64 %169
%171 = load i32, i32* %18
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i8, i8* %170, i64 %172
store i8* %173, i8** %12
%174 = load i32, i32* @stderr
%175 = load i8*, i8** %12
%176 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %175)
%177 = load i8*, i8** %12
%178 = bitcast i8* %177 to double*
store double* %178, double** %5
%179 = load i32, i32* %24
%180 = sext i32 %179 to i64
%181 = mul i64 8, %180
%182 = add i64 %181, 4096
%183 = add i64 %182, 1024
%184 = trunc i64 %183 to i32
%185 = call i8* @malloc(i32 %184)
store i8* %185, i8** %13
%186 = load i32, i32* @stderr
%187 = load i8*, i8** %13
%188 = call i32 (i32, i8*, ...) @fprintf(i32 %186, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %187)
%189 = load i8*, i8** %13
%190 = load i8*, i8** %13
%191 = ptrtoint i8* %190 to i32
%192 = sub i32 4096, %191
%193 = and i32 %192, 4095
%194 = zext i32 %193 to i64
%195 = getelementptr inbounds i8, i8* %189, i64 %194
%196 = load i32, i32* %19
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds i8, i8* %195, i64 %197
store i8* %198, i8** %13
%199 = load i32, i32* @stderr
%200 = load i8*, i8** %13
%201 = call i32 (i32, i8*, ...) @fprintf(i32 %199, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %200)
%202 = load i8*, i8** %13
%203 = bitcast i8* %202 to double*
store double* %203, double** %6
%204 = load i32, i32* %24
%205 = sext i32 %204 to i64
%206 = mul i64 8, %205
%207 = add i64 %206, 4096
%208 = add i64 %207, 1024
%209 = trunc i64 %208 to i32
%210 = call i8* @malloc(i32 %209)
store i8* %210, i8** %14
%211 = load i32, i32* @stderr
%212 = load i8*, i8** %14
%213 = call i32 (i32, i8*, ...) @fprintf(i32 %211, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %212)
%214 = load i8*, i8** %14
%215 = load i8*, i8** %14
%216 = ptrtoint i8* %215 to i32
%217 = sub i32 4096, %216
%218 = and i32 %217, 4095
%219 = zext i32 %218 to i64
%220 = getelementptr inbounds i8, i8* %214, i64 %219
%221 = load i32, i32* %20
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds i8, i8* %220, i64 %222
store i8* %223, i8** %14
%224 = load i32, i32* @stderr
%225 = load i8*, i8** %14
%226 = call i32 (i32, i8*, ...) @fprintf(i32 %224, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %225)
%227 = load i8*, i8** %14
%228 = bitcast i8* %227 to double*
store double* %228, double** %7
store i32 0, i32* %15
br label %229
229: ; preds = %246, %153
%230 = load i32, i32* %15
%231 = load i32, i32* %24
%232 = icmp slt i32 %230, %231
br i1 %232, label %233, label %249
233: ; preds = %229
%234 = load double*, double** %5
%235 = load i32, i32* %15
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds double, double* %234, i64 %236
store double 0.000000e+00, double* %237
%238 = load double*, double** %6
%239 = load i32, i32* %15
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds double, double* %238, i64 %240
store double 1.000000e+01, double* %241
%242 = load double*, double** %7
%243 = load i32, i32* %15
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds double, double* %242, i64 %244
store double 1.000000e+01, double* %245
br label %246
246: ; preds = %233
%247 = load i32, i32* %15
%248 = add nsw i32 %247, 1
store i32 %248, i32* %15
br label %229
249: ; preds = %229
%250 = load i32, i32* %24
%251 = load i32, i32* %31
%252 = sdiv i32 %250, %251
store i32 %252, i32* %24
%253 = load i32, i32* %24
%254 = sext i32 %253 to i64
%255 = mul i64 %254, 4
%256 = trunc i64 %255 to i32
%257 = call i8* @malloc(i32 %256)
%258 = bitcast i8* %257 to i32*
store i32* %258, i32** %33
%259 = load i32*, i32** %33
%260 = icmp eq i32* %259, null
br i1 %260, label %261, label %263
261: ; preds = %249
%262 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %263
263: ; preds = %261, %249
store i32 0, i32* %16
store i32 0, i32* %15
br label %264
264: ; preds = %277, %263
%265 = load i32, i32* %15
%266 = load i32, i32* %24
%267 = icmp slt i32 %265, %266
br i1 %267, label %268, label %280
268: ; preds = %264
%269 = load i32, i32* %16
%270 = load i32*, i32** %33
%271 = load i32, i32* %15
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i32, i32* %270, i64 %272
store i32 %269, i32* %273
%274 = load i32, i32* %31
%275 = load i32, i32* %16
%276 = add nsw i32 %275, %274
store i32 %276, i32* %16
br label %277
277: ; preds = %268
%278 = load i32, i32* %15
%279 = add nsw i32 %278, 1
store i32 %279, i32* %15
br label %264
280: ; preds = %264
%281 = load i32, i32* %41
%282 = load i32, i32* %28
%283 = call i32 @pin_cpu(i32 %281, i32 %282)
%284 = icmp eq i32 %283, -1
br i1 %284, label %285, label %287
285: ; preds = %280
%286 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %291
287: ; preds = %280
%288 = load i32, i32* @stderr
%289 = load i32, i32* %28
%290 = call i32 (i32, i8*, ...) @fprintf(i32 %288, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.14, i64 0, i64 0), i32 %289)
br label %291
291: ; preds = %287, %285
%292 = load i32, i32* %22
%293 = load i32, i32* %24
%294 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0), i32 %292, i32 %293)
%295 = call i64 (...) @_rdtsc()
store i64 %295, i64* %37
store i32 0, i32* %15
br label %296
296: ; preds = %333, %291
%297 = load i32, i32* %15
%298 = load i32, i32* %22
%299 = icmp slt i32 %297, %298
br i1 %299, label %300, label %336
300: ; preds = %296
%301 = call i64 (...) @_rdtsc()
store i64 %301, i64* %34
%302 = load i32, i32* %24
%303 = load i32, i32* %31
%304 = load double*, double** %5
%305 = load double*, double** %6
%306 = load i32*, i32** %33
%307 = call i32 @triad(i32 %302, i32 %303, double* %304, double* %305, i32* %306)
store i32 %307, i32* %29
%308 = call i64 (...) @_rdtsc()
store i64 %308, i64* %35
%309 = load i64, i64* %35
%310 = load i64, i64* %34
%311 = sub i64 %309, %310
store i64 %311, i64* %36
%312 = load double, double* %8
%313 = fadd double %312, 1.000000e-02
store double %313, double* %8
%314 = load i32, i32* %24
%315 = load i32, i32* %29
%316 = mul nsw i32 %314, %315
%317 = sext i32 %316 to i64
%318 = load i64, i64* %40
%319 = add i64 %318, %317
store i64 %319, i64* %40
%320 = load i32, i32* %24
%321 = load i32, i32* %29
%322 = mul nsw i32 %320, %321
%323 = sitofp i32 %322 to double
%324 = load i64, i64* %36
%325 = uitofp i64 %324 to double
%326 = fdiv double %323, %325
store double %326, double* %9
%327 = load double, double* %9
%328 = load double, double* %11
%329 = fcmp ogt double %327, %328
br i1 %329, label %330, label %332
330: ; preds = %300
%331 = load double, double* %9
store double %331, double* %11
br label %332
332: ; preds = %330, %300
br label %333
333: ; preds = %332
%334 = load i32, i32* %15
%335 = add nsw i32 %334, 1
store i32 %335, i32* %15
br label %296
336: ; preds = %296
%337 = call i64 (...) @_rdtsc()
store i64 %337, i64* %38
%338 = load i64, i64* %38
%339 = load i64, i64* %37
%340 = sub i64 %338, %339
store i64 %340, i64* %39
%341 = load i64, i64* %40
%342 = uitofp i64 %341 to double
%343 = load i64, i64* %39
%344 = uitofp i64 %343 to double
%345 = fdiv double %342, %344
store double %345, double* %10
%346 = load i64, i64* %40
%347 = load i32, i32* %25
%348 = load i64, i64* %36
%349 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.16, i64 0, i64 0), i64 %346, i32 %347, i64 %348)
%350 = load double, double* %10
%351 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.17, i64 0, i64 0), double %350)
%352 = load double, double* %11
%353 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), double %352)
ret void
}

LLVM IR (-O2):
@.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"
@.str.9 = [60 x i8] c" buffer size len not divisible by inner, %d, mod_inner = %d\00"
@.str.10 = [12 x i8] c" buf1 = %p\0A\00"
@.str.11 = [12 x i8] c" buf2 = %p\0A\00"
@.str.12 = [12 x i8] c" buf3 = %p\0A\00"
@.str.13 = [23 x i8] c"malloc of index failed\00"
@.str.14 = [42 x i8] c" process pinned to core %d for triad run\0A\00"
@.str.15 = [39 x i8] c" calling triad %d times with len = %d\0A\00"
@.str.16 = [63 x i8] c" transfering %lld bytes from memory level %d took %lld cycles\0A\00"
@.str.17 = [27 x i8] c" average bytes/cycle = %f\0A\00"
@.str.18 = [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 = bitcast <4 x i32>* %3 to i8*
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([153 x i8], [153 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%9 = tail call i32 (...) @usage()
%10 = 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 %11
11: ; preds = %6, %2
br label %12
12: ; preds = %44, %11
%13 = phi i32 [ undef, %11 ], [ %45, %44 ]
%14 = phi i32 [ undef, %11 ], [ %46, %44 ]
%15 = phi i32 [ undef, %11 ], [ %47, %44 ]
%16 = phi i32 [ 1, %11 ], [ %48, %44 ]
%17 = phi i32 [ 0, %11 ], [ %49, %44 ]
%18 = phi i32 [ 0, %11 ], [ %50, %44 ]
%19 = phi i32 [ 0, %11 ], [ %51, %44 ]
%20 = 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 %20, label %42 [
i32 -1, label %52
i32 105, label %21
i32 114, label %24
i32 108, label %27
i32 109, label %30
i32 97, label %33
i32 98, label %36
i32 99, label %39
]
21: ; preds = %12
%22 = load i32, i32* @optarg
%23 = tail call i32 @atoi(i32 %22)
br label %44
24: ; preds = %12
%25 = load i32, i32* @optarg
%26 = tail call i32 @atoi(i32 %25)
br label %44
27: ; preds = %12
%28 = load i32, i32* @optarg
%29 = tail call i32 @atoi(i32 %28)
br label %44
30: ; preds = %12
%31 = load i32, i32* @optarg
%32 = tail call i32 @atoi(i32 %31)
br label %44
33: ; preds = %12
%34 = load i32, i32* @optarg
%35 = tail call i32 @atoi(i32 %34)
br label %44
36: ; preds = %12
%37 = load i32, i32* @optarg
%38 = tail call i32 @atoi(i32 %37)
br label %44
39: ; preds = %12
%40 = load i32, i32* @optarg
%41 = tail call i32 @atoi(i32 %40)
br label %44
42: ; preds = %12
%43 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %20)
br label %44
44: ; preds = %42, %39, %36, %33, %30, %27, %24, %21
%45 = phi i32 [ %13, %42 ], [ %13, %39 ], [ %13, %36 ], [ %13, %33 ], [ %13, %30 ], [ %13, %27 ], [ %26, %24 ], [ %13, %21 ]
%46 = phi i32 [ %14, %42 ], [ %14, %39 ], [ %14, %36 ], [ %14, %33 ], [ %14, %30 ], [ %14, %27 ], [ %14, %24 ], [ %23, %21 ]
%47 = phi i32 [ %15, %42 ], [ %15, %39 ], [ %15, %36 ], [ %15, %33 ], [ %15, %30 ], [ %29, %27 ], [ %15, %24 ], [ %15, %21 ]
%48 = phi i32 [ %16, %42 ], [ %16, %39 ], [ %16, %36 ], [ %16, %33 ], [ %32, %30 ], [ %16, %27 ], [ %16, %24 ], [ %16, %21 ]
%49 = phi i32 [ %17, %42 ], [ %41, %39 ], [ %17, %36 ], [ %17, %33 ], [ %17, %30 ], [ %17, %27 ], [ %17, %24 ], [ %17, %21 ]
%50 = phi i32 [ %18, %42 ], [ %18, %39 ], [ %38, %36 ], [ %18, %33 ], [ %18, %30 ], [ %18, %27 ], [ %18, %24 ], [ %18, %21 ]
%51 = phi i32 [ %19, %42 ], [ %19, %39 ], [ %19, %36 ], [ %35, %33 ], [ %19, %30 ], [ %19, %27 ], [ %19, %24 ], [ %19, %21 ]
br label %12
52: ; preds = %12
%53 = mul nsw i32 %16, 100
%54 = tail call i32 @pin_cpu(i32 0, i32 %14)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = 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 %61
58: ; preds = %52
%59 = load i32, i32* @stderr
%60 = tail call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32 %14)
br label %61
61: ; preds = %58, %56
store <4 x i32> <i32 16384, i32 262144, i32 8388608, i32 268435456>, <4 x i32>* %3
%62 = load i32, i32* @stderr
%63 = tail call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 268435456, i32 %15, i32 %53, i32 %16)
%64 = sext i32 %15 to i64
%65 = getelementptr inbounds <4 x i32>, <4 x i32>* %3, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = sdiv i32 %66, 32
%68 = load i32, i32* @stderr
%69 = tail call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %67, i32 %15, i32 %53, i32 %16)
%70 = shl nsw i32 %67, 5
%71 = sdiv i32 268435456, %70
%72 = load i32, i32* @stderr
%73 = tail call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.8, i64 0, i64 0), i32 %67, i32 %15, i32 %53, i32 %16, i32 %71)
%74 = mul i32 %53, %16
%75 = mul i32 %74, %71
%76 = load i32, i32* @stderr
%77 = tail call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %67, i32 %15, i32 %75, i32 %16)
%78 = srem i32 %67, 8
%79 = icmp eq i32 %78, 0
br i1 %79, label %82, label %80
80: ; preds = %61
%81 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 8, i32 %78)
br label %82
82: ; preds = %80, %61
%83 = shl nsw i32 %67, 3
%84 = add nsw i32 %83, 5120
%85 = tail call i8* @malloc(i32 %84)
%86 = load i32, i32* @stderr
%87 = tail call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %85)
%88 = ptrtoint i8* %85 to i64
%89 = sub i64 0, %88
%90 = and i64 %89, 4095
%91 = getelementptr inbounds i8, i8* %85, i64 %90
%92 = sext i32 %19 to i64
%93 = getelementptr inbounds i8, i8* %91, i64 %92
%94 = load i32, i32* @stderr
%95 = tail call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i8* %93)
%96 = bitcast i8* %93 to double*
%97 = tail call i8* @malloc(i32 %84)
%98 = load i32, i32* @stderr
%99 = tail call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %97)
%100 = ptrtoint i8* %97 to i64
%101 = sub i64 0, %100
%102 = and i64 %101, 4095
%103 = getelementptr inbounds i8, i8* %97, i64 %102
%104 = sext i32 %18 to i64
%105 = getelementptr inbounds i8, i8* %103, i64 %104
%106 = load i32, i32* @stderr
%107 = tail call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %105)
%108 = bitcast i8* %105 to double*
%109 = tail call i8* @malloc(i32 %84)
%110 = load i32, i32* @stderr
%111 = tail call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %109)
%112 = ptrtoint i8* %109 to i64
%113 = sub i64 0, %112
%114 = and i64 %113, 4095
%115 = getelementptr inbounds i8, i8* %109, i64 %114
%116 = sext i32 %17 to i64
%117 = getelementptr inbounds i8, i8* %115, i64 %116
%118 = load i32, i32* @stderr
%119 = tail call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0), i8* %117)
%120 = bitcast i8* %117 to double*
%121 = icmp sgt i32 %66, 31
br i1 %121, label %122, label %206
122: ; preds = %82
%123 = add nsw i32 %67, -1
%124 = zext i32 %123 to i64
%125 = shl nuw nsw i64 %124, 3
%126 = add nuw nsw i64 %125, 8
%127 = zext i32 %67 to i64
%128 = icmp ult i32 %67, 4
br i1 %128, label %198, label %129
129: ; preds = %122
%130 = and i64 %127, 4294967292
%131 = add nsw i64 %130, -4
%132 = lshr exact i64 %131, 2
%133 = add nuw nsw i64 %132, 1
%134 = and i64 %133, 3
%135 = icmp ult i64 %131, 12
br i1 %135, label %179, label %136
136: ; preds = %129
%137 = and i64 %133, 9223372036854775804
br label %138
138: ; preds = %138, %136
%139 = phi i64 [ 0, %136 ], [ %176, %138 ]
%140 = phi i64 [ 0, %136 ], [ %177, %138 ]
%141 = getelementptr inbounds double, double* %108, i64 %139
%142 = bitcast double* %141 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %142
%143 = getelementptr inbounds double, double* %141, i64 2
%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* %120, i64 %139
%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* %145, i64 2
%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 = or i64 %139, 4
%150 = getelementptr inbounds double, double* %108, i64 %149
%151 = bitcast double* %150 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %151
%152 = getelementptr inbounds double, double* %150, i64 2
%153 = bitcast double* %152 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %153
%154 = getelementptr inbounds double, double* %120, i64 %149
%155 = bitcast double* %154 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %155
%156 = getelementptr inbounds double, double* %154, i64 2
%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 = or i64 %139, 8
%159 = getelementptr inbounds double, double* %108, i64 %158
%160 = bitcast double* %159 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %160
%161 = getelementptr inbounds double, double* %159, i64 2
%162 = bitcast double* %161 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %162
%163 = getelementptr inbounds double, double* %120, i64 %158
%164 = bitcast double* %163 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %164
%165 = getelementptr inbounds double, double* %163, i64 2
%166 = bitcast double* %165 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %166
%167 = or i64 %139, 12
%168 = getelementptr inbounds double, double* %108, i64 %167
%169 = bitcast double* %168 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %169
%170 = getelementptr inbounds double, double* %168, i64 2
%171 = bitcast double* %170 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %171
%172 = getelementptr inbounds double, double* %120, i64 %167
%173 = bitcast double* %172 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %173
%174 = getelementptr inbounds double, double* %172, i64 2
%175 = bitcast double* %174 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %175
%176 = add nuw i64 %139, 16
%177 = add nuw i64 %140, 4
%178 = icmp eq i64 %177, %137
br i1 %178, label %179, label %138
179: ; preds = %138, %129
%180 = phi i64 [ 0, %129 ], [ %176, %138 ]
%181 = icmp eq i64 %134, 0
br i1 %181, label %196, label %182
182: ; preds = %179, %182
%183 = phi i64 [ %193, %182 ], [ %180, %179 ]
%184 = phi i64 [ %194, %182 ], [ 0, %179 ]
%185 = getelementptr inbounds double, double* %108, i64 %183
%186 = bitcast double* %185 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %186
%187 = getelementptr inbounds double, double* %185, i64 2
%188 = bitcast double* %187 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %188
%189 = getelementptr inbounds double, double* %120, i64 %183
%190 = bitcast double* %189 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %190
%191 = getelementptr inbounds double, double* %189, i64 2
%192 = bitcast double* %191 to <2 x double>*
store <2 x double> <double 1.000000e+01, double 1.000000e+01>, <2 x double>* %192
%193 = add nuw i64 %183, 4
%194 = add i64 %184, 1
%195 = icmp eq i64 %194, %134
br i1 %195, label %196, label %182
196: ; preds = %182, %179
%197 = icmp eq i64 %130, %127
br i1 %197, label %206, label %198
198: ; preds = %122, %196
%199 = phi i64 [ 0, %122 ], [ %130, %196 ]
br label %200
200: ; preds = %198, %200
%201 = phi i64 [ %204, %200 ], [ %199, %198 ]
%202 = getelementptr inbounds double, double* %108, i64 %201
store double 1.000000e+01, double* %202
%203 = getelementptr inbounds double, double* %120, i64 %201
store double 1.000000e+01, double* %203
%204 = add nuw nsw i64 %201, 1
%205 = icmp eq i64 %204, %127
br i1 %205, label %206, label %200
206: ; preds = %200, %196, %82
%207 = sdiv i32 %66, 256
%208 = shl nsw i32 %207, 2
%209 = tail call i8* @malloc(i32 %208)
%210 = bitcast i8* %209 to i32*
%211 = icmp eq i8* %209, null
br i1 %211, label %212, label %214
212: ; preds = %206
%213 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %214
214: ; preds = %212, %206
%215 = icmp sgt i32 %66, 255
br i1 %215, label %216, label %293
216: ; preds = %214
%217 = zext i32 %207 to i64
%218 = icmp ult i32 %207, 8
br i1 %218, label %283, label %219
219: ; preds = %216
%220 = and i64 %217, 4294967288
%221 = trunc i64 %220 to i32
%222 = shl i32 %221, 3
%223 = add nsw i64 %220, -8
%224 = lshr exact i64 %223, 3
%225 = add nuw nsw i64 %224, 1
%226 = and i64 %225, 3
%227 = icmp ult i64 %223, 24
br i1 %227, label %264, label %228
228: ; preds = %219
%229 = and i64 %225, 4611686018427387900
br label %230
230: ; preds = %230, %228
%231 = phi i64 [ 0, %228 ], [ %260, %230 ]
%232 = phi <4 x i32> [ <i32 0, i32 8, i32 16, i32 24>, %228 ], [ %261, %230 ]
%233 = phi i64 [ 0, %228 ], [ %262, %230 ]
%234 = add <4 x i32> %232, <i32 32, i32 32, i32 32, i32 32>
%235 = getelementptr inbounds i32, i32* %210, i64 %231
%236 = bitcast i32* %235 to <4 x i32>*
store <4 x i32> %232, <4 x i32>* %236
%237 = getelementptr inbounds i32, i32* %235, i64 4
%238 = bitcast i32* %237 to <4 x i32>*
store <4 x i32> %234, <4 x i32>* %238
%239 = or i64 %231, 8
%240 = add <4 x i32> %232, <i32 64, i32 64, i32 64, i32 64>
%241 = add <4 x i32> %232, <i32 96, i32 96, i32 96, i32 96>
%242 = getelementptr inbounds i32, i32* %210, i64 %239
%243 = bitcast i32* %242 to <4 x i32>*
store <4 x i32> %240, <4 x i32>* %243
%244 = getelementptr inbounds i32, i32* %242, i64 4
%245 = bitcast i32* %244 to <4 x i32>*
store <4 x i32> %241, <4 x i32>* %245
%246 = or i64 %231, 16
%247 = add <4 x i32> %232, <i32 128, i32 128, i32 128, i32 128>
%248 = add <4 x i32> %232, <i32 160, i32 160, i32 160, i32 160>
%249 = getelementptr inbounds i32, i32* %210, i64 %246
%250 = bitcast i32* %249 to <4 x i32>*
store <4 x i32> %247, <4 x i32>* %250
%251 = getelementptr inbounds i32, i32* %249, i64 4
%252 = bitcast i32* %251 to <4 x i32>*
store <4 x i32> %248, <4 x i32>* %252
%253 = or i64 %231, 24
%254 = add <4 x i32> %232, <i32 192, i32 192, i32 192, i32 192>
%255 = add <4 x i32> %232, <i32 224, i32 224, i32 224, i32 224>
%256 = getelementptr inbounds i32, i32* %210, i64 %253
%257 = bitcast i32* %256 to <4 x i32>*
store <4 x i32> %254, <4 x i32>* %257
%258 = getelementptr inbounds i32, i32* %256, i64 4
%259 = bitcast i32* %258 to <4 x i32>*
store <4 x i32> %255, <4 x i32>* %259
%260 = add nuw i64 %231, 32
%261 = add <4 x i32> %232, <i32 256, i32 256, i32 256, i32 256>
%262 = add i64 %233, 4
%263 = icmp eq i64 %262, %229
br i1 %263, label %264, label %230
264: ; preds = %230, %219
%265 = phi i64 [ 0, %219 ], [ %260, %230 ]
%266 = phi <4 x i32> [ <i32 0, i32 8, i32 16, i32 24>, %219 ], [ %261, %230 ]
%267 = icmp eq i64 %226, 0
br i1 %267, label %281, label %268
268: ; preds = %264, %268
%269 = phi i64 [ %277, %268 ], [ %265, %264 ]
%270 = phi <4 x i32> [ %278, %268 ], [ %266, %264 ]
%271 = phi i64 [ %279, %268 ], [ 0, %264 ]
%272 = add <4 x i32> %270, <i32 32, i32 32, i32 32, i32 32>
%273 = getelementptr inbounds i32, i32* %210, i64 %269
%274 = bitcast i32* %273 to <4 x i32>*
store <4 x i32> %270, <4 x i32>* %274
%275 = getelementptr inbounds i32, i32* %273, i64 4
%276 = bitcast i32* %275 to <4 x i32>*
store <4 x i32> %272, <4 x i32>* %276
%277 = add nuw i64 %269, 8
%278 = add <4 x i32> %270, <i32 64, i32 64, i32 64, i32 64>
%279 = add i64 %271, 1
%280 = icmp eq i64 %279, %226
br i1 %280, label %281, label %268
281: ; preds = %268, %264
%282 = icmp eq i64 %220, %217
br i1 %282, label %293, label %283
283: ; preds = %216, %281
%284 = phi i64 [ 0, %216 ], [ %220, %281 ]
%285 = phi i32 [ 0, %216 ], [ %222, %281 ]
br label %286
286: ; preds = %283, %286
%287 = phi i64 [ %291, %286 ], [ %284, %283 ]
%288 = phi i32 [ %290, %286 ], [ %285, %283 ]
%289 = getelementptr inbounds i32, i32* %210, i64 %287
store i32 %288, i32* %289
%290 = add nuw nsw i32 %288, 8
%291 = add nuw nsw i64 %287, 1
%292 = icmp eq i64 %291, %217
br i1 %292, label %293, label %286
293: ; preds = %286, %281, %214
%294 = tail call i32 @pin_cpu(i32 0, i32 %13)
%295 = icmp eq i32 %294, -1
br i1 %295, label %296, label %298
296: ; preds = %293
%297 = 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 %301
298: ; preds = %293
%299 = load i32, i32* @stderr
%300 = tail call i32 (i32, i8*, ...) @fprintf(i32 %299, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.14, i64 0, i64 0), i32 %13)
br label %301
301: ; preds = %298, %296
%302 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0), i32 %75, i32 %207)
%303 = tail call i64 (...) @_rdtsc()
%304 = icmp sgt i32 %75, 0
br i1 %304, label %305, label %323
305: ; preds = %301, %305
%306 = phi double [ %320, %305 ], [ -1.000000e+00, %301 ]
%307 = phi i32 [ %321, %305 ], [ 0, %301 ]
%308 = phi i64 [ %315, %305 ], [ 0, %301 ]
%309 = tail call i64 (...) @_rdtsc()
%310 = tail call i32 @triad(i32 %207, i32 8, double* %96, double* %108, i32* %210)
%311 = tail call i64 (...) @_rdtsc()
%312 = sub i64 %311, %309
%313 = mul nsw i32 %310, %207
%314 = sext i32 %313 to i64
%315 = add i64 %308, %314
%316 = sitofp i32 %313 to double
%317 = uitofp i64 %312 to double
%318 = fdiv double %316, %317
%319 = fcmp ogt double %318, %306
%320 = select i1 %319, double %318, double %306
%321 = add nuw nsw i32 %307, 1
%322 = icmp eq i32 %321, %75
br i1 %322, label %323, label %305
323: ; preds = %305, %301
%324 = phi i64 [ undef, %301 ], [ %312, %305 ]
%325 = phi i64 [ 0, %301 ], [ %315, %305 ]
%326 = phi double [ -1.000000e+00, %301 ], [ %320, %305 ]
%327 = tail call i64 (...) @_rdtsc()
%328 = sub i64 %327, %303
%329 = uitofp i64 %325 to double
%330 = uitofp i64 %328 to double
%331 = fdiv double %329, %330
%332 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.16, i64 0, i64 0), i64 %325, i32 %15, i64 %324)
%333 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.17, i64 0, i64 0), double %331)
%334 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), double %326)
ret void
}