#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*/ off_t;
typedef int /*<<< orphan*/ cpu_set_t;
typedef int /*<<< orphan*/ __pid_t;

/* Variables and functions */
int MAP_ANON;
char *MAP_FAILED;
int MAP_HUGETLB;
int MAP_PRIVATE;
int PROT_READ;
int PROT_WRITE;
size_t _rdtsc();
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
scalar_t__ malloc(int);
void *memset(char *, int /*<<< orphan*/, size_t);
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 *, double, ...);
size_t reader(int, size_t *);
int /*<<< orphan*/ rndm_list(int *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  char *buf1;
  void *ret;
  size_t *array, *pnt, element, ret_val = 0;
  size_t array_stride;
  int i, j, k, cpu, cpu_run, line_count, stride, fd = -1;
  off_t offset = 0;
  int len = 10240000, iter = 100, mult = 1, main_ret = 0;
  double iterations;
  size_t start, stop, run_time, call_start, call_stop, call_run_time,
      total_bytes = 0;
  __pid_t pid = 0;
  size_t buf_size, jj, zero_loop, buf_by_num_seg, ind;
  size_t num_pages, page_size, var_size;
  int cpu_setsize;
  cpu_set_t mask;
  int *pattern;
  int step, c, bad;
  int *index, *index_test, lc_by_num_seg, count, num_seg = 32, huge = 0;
  unsigned int bitmask, *intstar;
  page_size = 4096;
  if (argc < 6) {
    fprintf(stderr,
            "the random walker requires at least 6 arguments (only the 7th in "
            "the list below is optional), there were %d\n",
            argc);
    usage();
    err(1, "insufficient invocation arguments");
  }
  while ((c = getopt(argc, argv, "i:r:l:s:S:m:L")) != -1) {
    switch (c) {
    case 'i':
      cpu = atoi(optarg);
      break;
    case 'r':
      cpu_run = atoi(optarg);
      break;
    case 'l':
      line_count = atoi(optarg);
      break;
    case 's':
      stride = atoi(optarg);
      break;
    case 'S':
      num_seg = atoi(optarg);
      break;
    case 'm':
      mult = atoi(optarg);
      break;
    case 'L':
      huge = 1;
      page_size = 2 * 1024 * 1024;
      break;
    default:
      err(1, "unknown option %c", c);
    }
  }
  iter = iter * mult;
  var_size = sizeof(size_t);
  fprintf(stderr, "size_t in %zd bytes\n", var_size);
  if (pin_cpu(pid, cpu) == -1) {
    err(1, "failed to set affinity");
  } else {
    fprintf(stderr, " process pinned to core %d\n", cpu);
  }
  pattern = (int *)malloc(num_seg * sizeof(int));
  if (pattern == NULL) {
    fprintf(stderr, " failed to malloc pattern for size = %d\n", num_seg);
    err(1, "malloc of pattern failed");
  }
  stride = page_size * stride + 64;
  buf_size = (size_t)line_count * (size_t)stride;
  num_pages = buf_size / page_size + 2;
  buf_size = page_size * num_pages;
  array_stride = stride / sizeof(size_t *);
  iterations = (double)iter * (double)len;
  index = (int *)malloc(line_count * sizeof(int));
  if (index == NULL) {
    fprintf(stderr, " failed to malloc index array for line_count of %d\n",
            line_count);
    err(1, "failed to malloc index");
  }
  index_test = (int *)malloc(line_count * sizeof(int));
  if (index_test == NULL) {
    fprintf(stderr, " failed to malloc index_test array for line_count of %d\n",
            line_count);
    err(1, "failed to malloc index_test");
  }
  for (i = 0; i < line_count; i++)
    index_test[i] = 0;
  if (num_seg == 1) {
    for (i = 0; i < line_count - 1; i++)
      index[i] = i;
  } else {
    rndm_list(pattern, num_seg);
    lc_by_num_seg = line_count / num_seg;
    if (lc_by_num_seg * num_seg != line_count) {
      fprintf(
          stderr,
          " line count must be a multiple of the fifth argument num_seg = %d\n",
          num_seg);
      err(1, " bad line_count");
    }
    count = 0;
    buf_by_num_seg = buf_size / num_seg;
    for (i = 0; i < lc_by_num_seg; i++) {
      step = i * num_seg;
      for (j = 0; j < num_seg - 1; j++) {
        count++;
        ind = lc_by_num_seg * pattern[j];
        index[count] = (int)pattern[j] + step;
        if (index[count] >= line_count)
          printf(" count = %d, index = %d\n", count, index[count]);
      }
      count++;
      index[count] = (i + 1) * num_seg;
    }
    index[count] = 0;
  }
  index[0] = 0;
  for (i = 0; i < line_count; i++) {
    if (index[i] > line_count)
      err(1, "index[%d] = %d", i, index[i]);
    index_test[index[i]]++;
  }
  bad = 0;
  for (i = 0; i < line_count; i++) {
    if (index_test[i] != 1) {
      bad++;
      if (bad < 64)
        fprintf(stderr, "index_test[%d] = %d\n", i, index_test[i]);
    }
  }
  fprintf(stderr, "bad = %d\n", bad);
  if (huge == 0)
    buf1 = (char *)mmap(NULL, buf_size, PROT_READ | PROT_WRITE,
                        MAP_PRIVATE | MAP_ANON, fd, offset);
  if (huge == 1)
    buf1 = (char *)mmap(NULL, buf_size, PROT_READ | PROT_WRITE,
                        MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, fd, offset);
  if (buf1 == MAP_FAILED) {
    fprintf(stderr, "mmap failed\n");
    err(1, "mmap failed");
  }
  fprintf(stderr, " buf1 = %p\n", buf1);
  zero_loop = buf_size / (size_t)var_size;
  fprintf(stderr, " buf_size = %zu, zero_loop = %zu, array_stride = %zd\n",
          buf_size, zero_loop, array_stride);
  array = (size_t *)buf1;
  ret = memset(buf1, 0, (size_t)buf_size);
  fprintf(stderr, " finished zeroing buf ret = %p\n", ret);
  for (jj = 0; jj < line_count - 1; jj++)
    array[index[jj] * array_stride] =
        (size_t)&array[index[jj + 1] * array_stride];
  fprintf(stderr, " target of last element in loop = %zx\n",
          (size_t)(array[line_count - 1] - (size_t)buf1));
  array[(size_t)array_stride * (size_t)index[line_count - 1]] =
      (size_t)&array[0];
  bad = 0;
  pnt = array;
  fprintf(stderr, " array address = %p value = %lx\n", pnt, *pnt);
  while (bad < line_count + 4) {
    pnt = (size_t *)*pnt;
    element = (size_t)(pnt - array);
    element = element / var_size;
    bad++;
    if (bad > line_count - 4)
      fprintf(stderr, "index = %d,element = %ld, address = %p, value = %lx\n",
              bad, element, pnt, *pnt);
  }
  if (pin_cpu(pid, cpu_run) == -1) {
    err(1, "cannot set cpu run affinity");
  } else {
    printf(" process pinned to core %d to run\n", cpu_run);
  }
  printf(" calling walker %d times which loops  %d times on buffer of %d lines "
         "with a stride of %d, for a total size of %zu\n",
         iter, len, line_count, stride, buf_size);
  call_start = _rdtsc();
  for (i = 0; i < iter; i++) {
    start = _rdtsc();
    ret_val = reader(len, array);
    stop = _rdtsc();
    run_time = stop - start;
  }
  call_stop = _rdtsc();
  call_run_time = call_stop - call_start;
  printf(" run time = %zd\n", call_run_time);
  printf(" average cycles per iteration = %f\n",
         (double)call_run_time / iterations);
  return main_ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0xffffffff,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x9c4000,-0x70(%rbp)
movl   $0x64,-0x74(%rbp)
movl   $0x1,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
movq   $0x0,-0xc0(%rbp)
movl   $0x0,-0xc4(%rbp)
movl   $0x20,-0x144(%rbp)
movl   $0x0,-0x148(%rbp)
movq   $0x1000,-0x100(%rbp)
cmpl   $0x6,-0x8(%rbp)
jge    128d <main+0xbd>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x0,%al
call   10c0 <usage@plt>
mov    $0x1,%edi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    1292 <main+0xc2>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeaf(%rip),%rdx
call   10e0 <getopt@plt>
mov    %eax,-0x120(%rbp)
cmp    $0xffffffff,%eax
je     13a5 <main+0x1d5>
mov    -0x120(%rbp),%eax
add    $0xffffffb4,%eax
mov    %eax,%ecx
mov    %rcx,-0x160(%rbp)
sub    $0x27,%eax
ja     1387 <main+0x1b7>
mov    -0x160(%rbp),%rax
lea    0xd43(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x58(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cf5(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x5c(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x60(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x64(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x144(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x78(%rbp)
jmp    13a0 <main+0x1d0>
movl   $0x1,-0x148(%rbp)
movq   $0x200000,-0x100(%rbp)
jmp    13a0 <main+0x1d0>
mov    -0x120(%rbp),%edx
mov    $0x1,%edi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    1292 <main+0xc2>
mov    -0x74(%rbp),%eax
imul   -0x78(%rbp),%eax
mov    %eax,-0x74(%rbp)
movq   $0x8,-0x108(%rbp)
mov    0x2c07(%rip),%rax
mov    (%rax),%edi
mov    -0x108(%rbp),%rdx
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xc4(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    1407 <main+0x237>
mov    $0x1,%edi
lea    0xd89(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    1421 <main+0x251>
mov    0x2bba(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%edx
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movslq -0x144(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
jne    1478 <main+0x2a8>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
mov    -0x144(%rbp),%edx
lea    0xd59(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
mov    -0x100(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   %rcx,%rax
add    $0x40,%rax
mov    %eax,-0x64(%rbp)
movslq -0x60(%rbp),%rax
movslq -0x64(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0xd0(%rbp)
mov    -0xd0(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x100(%rbp)
add    $0x2,%rax
mov    %rax,-0xf8(%rbp)
mov    -0x100(%rbp),%rax
imul   -0xf8(%rbp),%rax
ff
mov    %rax,-0xd0(%rbp)
movslq -0x64(%rbp),%rax
shr    $0x3,%rax
mov    %rax,-0x48(%rbp)
cvtsi2sdl -0x74(%rbp),%xmm0
cvtsi2sdl -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movslq -0x60(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x130(%rbp)
cmpq   $0x0,-0x130(%rbp)
jne    1547 <main+0x377>
mov    0x2aa7(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
lea    0xccc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
movslq -0x60(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x138(%rbp)
cmpq   $0x0,-0x138(%rbp)
jne    1598 <main+0x3c8>
mov    0x2a56(%rip),%rax
mov    (%rax),%edi
mov    -0x60(%rbp),%edx
lea    0xcc6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xcec(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    15cb <main+0x3fb>
mov    -0x138(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    159f <main+0x3cf>
cmpl   $0x1,-0x144(%rbp)
jne    1614 <main+0x444>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    160f <main+0x43f>
mov    -0x4c(%rbp),%edx
mov    -0x130(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    15df <main+0x40f>
jmp    17d7 <main+0x607>
mov    -0x118(%rbp),%rdi
mov    -0x144(%rbp),%esi
call   10d0 <rndm_list@plt>
mov    -0x60(%rbp),%eax
cltd
idivl  -0x144(%rbp)
mov    %eax,-0x13c(%rbp)
mov    -0x13c(%rbp),%eax
imul   -0x144(%rbp),%eax
cmp    -0x60(%rbp),%eax
je     167c <main+0x4ac>
mov    0x2975(%rip),%rax
mov    (%rax),%edi
mov    -0x144(%rbp),%edx
lea    0xc37(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xc67(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
movl   $0x0,-0x140(%rbp)
mov    -0xd0(%rbp),%rax
movslq -0x144(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x13c(%rbp),%eax
jge    17c2 <main+0x5f2>
mov    -0x4c(%rbp),%eax
imul   -0x144(%rbp),%eax
mov    %eax,-0x11c(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1787 <main+0x5b7>
mov    -0x140(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x140(%rbp)
mov    -0x13c(%rbp),%eax
mov    -0x118(%rbp),%rcx
movslq -0x50(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
cltq
mov    %rax,-0xf0(%rbp)
mov    -0x118(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    -0x11c(%rbp),%edx
mov    -0x130(%rbp),%rax
movslq -0x140(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x130(%rbp),%rax
movslq -0x140(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x60(%rbp),%eax
jl     1774 <main+0x5a4>
cvtsi2sdl -0x140(%rbp),%xmm0
ff
mov    -0x130(%rbp),%rax
movslq -0x140(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xb7f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1779 <main+0x5a9>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    16cd <main+0x4fd>
mov    -0x140(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x140(%rbp)
mov    -0x4c(%rbp),%edx
add    $0x1,%edx
imul   -0x144(%rbp),%edx
mov    -0x130(%rbp),%rax
movslq -0x140(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    16a7 <main+0x4d7>
mov    -0x130(%rbp),%rax
movslq -0x140(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x130(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    185f <main+0x68f>
mov    -0x130(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x60(%rbp),%eax
jle    1832 <main+0x662>
mov    -0x4c(%rbp),%edx
mov    -0x130(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    $0x1,%edi
lea    0xada(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
mov    -0x138(%rbp),%rax
mov    -0x130(%rbp),%rcx
movslq -0x4c(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    17eb <main+0x61b>
movl   $0x0,-0x124(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x60(%rbp),%eax
jge    18ed <main+0x71d>
mov    -0x138(%rbp),%rax
movslq -0x4c(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
je     18da <main+0x70a>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
cmpl   $0x40,-0x124(%rbp)
jge    18d5 <main+0x705>
mov    0x2714(%rip),%rax
mov    (%rax),%edi
mov    -0x4c(%rbp),%edx
mov    -0x138(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xa46(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    18da <main+0x70a>
jmp    18df <main+0x70f>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1870 <main+0x6a0>
mov    0x26d4(%rip),%rax
mov    (%rax),%edi
mov    -0x124(%rbp),%edx
lea    0xa26(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
cmpl   $0x0,-0x148(%rbp)
jne    1957 <main+0x787>
mov    -0xd0(%rbp),%rsi
mov    0x26cb(%rip),%rax
mov    (%rax),%edx
mov    0x2692(%rip),%rax
or     (%rax),%edx
mov    0x2679(%rip),%rax
mov    (%rax),%ecx
mov    0x2678(%rip),%rax
or     (%rax),%ecx
mov    -0x68(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x148(%rbp)
jne    19ad <main+0x7dd>
mov    -0xd0(%rbp),%rsi
mov    0x267e(%rip),%rax
mov    (%rax),%edx
mov    0x2645(%rip),%rax
or     (%rax),%edx
mov    0x262c(%rip),%rax
mov    (%rax),%ecx
mov    0x262b(%rip),%rax
or     (%rax),%ecx
mov    0x264a(%rip),%rax
or     (%rax),%ecx
mov    -0x68(%rbp),%r8d
mov    -0x6c(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x25f0(%rip),%rcx
cmp    (%rcx),%rax
jne    19eb <main+0x81b>
mov    0x2600(%rip),%rax
mov    (%rax),%edi
lea    0x962(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0x95c(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
mov    0x25d6(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0x94d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xd0(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x108(%rbp)
mov    %rax,-0xe0(%rbp)
mov    0x25a2(%rip),%rax
mov    (%rax),%edi
mov    -0xd0(%rbp),%rdx
mov    -0xe0(%rbp),%rcx
mov    -0x48(%rbp),%r8
lea    0x917(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xd0(%rbp),%rdx
xor    %esi,%esi
call   1060 <memset@plt>
mov    %rax,-0x20(%rbp)
mov    0x255b(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0x914(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movq   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jae    1afe <main+0x92e>
mov    -0x28(%rbp),%rdx
mov    -0x130(%rbp),%rax
mov    -0xd8(%rbp),%rcx
movslq 0x4(%rax,%rcx,4),%rax
imul   -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    -0x130(%rbp),%rcx
mov    -0xd8(%rbp),%rsi
movslq (%rcx,%rsi,4),%rcx
imul   -0x48(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    1a8c <main+0x8bc>
mov    0x24c3(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rax
sub    %rax,%rdx
lea    0x888(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%rdx
mov    -0x28(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    -0x130(%rbp),%rsi
mov    -0x60(%rbp),%edi
sub    $0x1,%edi
movslq %edi,%rdi
movslq (%rsi,%rdi,4),%rsi
imul   %rsi,%rcx
mov    %rdx,(%rax,%rcx,8)
movl   $0x0,-0x124(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x245a(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%rdx
mov    -0x30(%rbp),%rax
mov    (%rax),%rcx
lea    0x853(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x124(%rbp),%eax
mov    -0x60(%rbp),%ecx
add    $0x4,%ecx
cmp    %ecx,%eax
jge    1c22 <main+0xa52>
mov    -0x30(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x108(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
mov    -0x124(%rbp),%eax
mov    -0x60(%rbp),%ecx
sub    $0x4,%ecx
cmp    %ecx,%eax
jle    1c1d <main+0xa4d>
mov    0x23d0(%rip),%rax
mov    (%rax),%edi
mov    -0x124(%rbp),%edx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x30(%rbp),%rax
mov    (%rax),%r9
lea    0x7e0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    1b89 <main+0x9b9>
mov    -0xc4(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    1c51 <main+0xa81>
mov    $0x1,%edi
lea    0x7e6(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    1c64 <main+0xa94>
cvtsi2sdl -0x5c(%rbp),%xmm0
lea    0x7ea(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cvtsi2sdl -0x74(%rbp),%xmm0
mov    -0x70(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x64(%rbp),%ecx
mov    -0xd0(%rbp),%r8
lea    0x7ea(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10b0 <_rdtsc@plt>
mov    %rax,-0xa8(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    1cf7 <main+0xb27>
mov    $0x0,%al
call   10b0 <_rdtsc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x70(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1030 <reader@plt>
mov    %rax,-0x40(%rbp)
mov    $0x0,%al
call   10b0 <_rdtsc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
sub    -0x90(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1c9c <main+0xacc>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
mov    -0xa8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xb8(%rbp)
movq   -0xb8(%rbp),%xmm0
ff
movaps 0x2d4(%rip),%xmm1
movaps %xmm1,-0x180(%rbp)
punpckldq %xmm1,%xmm0
movapd 0x2d1(%rip),%xmm1
movaps %xmm1,-0x170(%rbp)
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
lea    0x781(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movaps -0x180(%rbp),%xmm2
movaps -0x170(%rbp),%xmm1
movq   -0xb8(%rbp),%xmm0
ff
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x88(%rbp),%xmm0
ff
lea    0x753(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
cmp    $0x5,%edi
jg     121b <main+0x4b>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
lea    0xf60(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %eax,%eax
call   10c0 <usage@plt>
lea    0xfb6(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    $0x20,%eax
mov    %rax,0x40(%rsp)
mov    $0x1000,%ecx
movl   $0x1,0x8(%rsp)
lea    0xfae(%rip),%r12
lea    0xe78(%rip),%r14
mov    %rax,0x10(%rsp)
xor    %edx,%edx
jmp    1266 <main+0x96>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rcx
mov    (%rsp),%edx
mov    %edx,(%rsp)
mov    %rcx,%r15
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   10e0 <getopt@plt>
lea    -0x4c(%rax),%edx
cmp    $0x27,%edx
ja     12ff <main+0x12f>
mov    $0x200000,%ecx
movslq (%r14,%rdx,4),%rsi
add    %r14,%rsi
mov    $0x1,%edx
jmp    *%rsi
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %rax,0x40(%rsp)
jmp    1260 <main+0x90>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,%r13d
jmp    1260 <main+0x90>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %rax,0x10(%rsp)
jmp    1260 <main+0x90>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,0x6c(%rsp)
jmp    1260 <main+0x90>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,0xc(%rsp)
jmp    1260 <main+0x90>
cmp    $0xffffffff,%eax
je     131e <main+0x14e>
mov    $0x1,%edi
lea    0xee5(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <err@plt>
jmp    1260 <main+0x90>
mov    0x2ca3(%rip),%r12
mov    (%r12),%edi
lea    0xed7(%rip),%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
xor    %edi,%edi
mov    %r13d,%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     1362 <main+0x192>
mov    (%r12),%edi
lea    0xedd(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    1375 <main+0x1a5>
lea    0xeb3(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0x40(%rsp),%rbx
mov    0x8(%rsp),%r14d
lea    0x0(,%rbx,4),%edi
call   10a0 <malloc@plt>
mov    %rax,0x48(%rsp)
test   %rax,%rax
jne    13bc <main+0x1ec>
mov    (%r12),%edi
lea    0xeaf(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0xc(%rsp),%r13d
imul   %r15d,%r13d
or     $0x40,%r13d
movslq 0x10(%rsp),%rax
movslq %r13d,%rcx
mov    %rcx,0x50(%rsp)
imul   %rcx,%rax
mov    %rax,%rcx
or     %r15,%rcx
shr    $0x20,%rcx
mov    %r13d,0xc(%rsp)
je     13f5 <main+0x225>
xor    %edx,%edx
div    %r15
mov    %rax,%rbp
jmp    13fc <main+0x22c>
xor    %edx,%edx
div    %r15d
mov    %eax,%ebp
mov    0x10(%rsp),%rax
lea    0x0(,%rax,4),%ebx
mov    %ebx,%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1441 <main+0x271>
mov    (%r12),%edi
lea    0xe6f(%rip),%rsi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xe90(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    %ebx,%edi
call   10a0 <malloc@plt>
mov    %rax,0x58(%rsp)
test   %rax,%rax
jne    147c <main+0x2ac>
mov    (%r12),%edi
lea    0xe7f(%rip),%rsi
mov    0x10(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xea5(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0x10(%rsp),%rax
mov    %eax,%edx
test   %eax,%eax
mov    %rdx,0x28(%rsp)
jle    14a5 <main+0x2d5>
lea    0x0(,%rdx,4),%rdx
mov    0x58(%rsp),%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    0x28(%rsp),%rdx
add    $0x2,%rbp
mov    0x40(%rsp),%rbx
cmp    $0x1,%ebx
mov    %r14d,0x8(%rsp)
mov    %r13,0x38(%rsp)
jne    14e0 <main+0x310>
cmpl   $0x2,0x10(%rsp)
jl     177e <main+0x5ae>
mov    0x10(%rsp),%rax
add    $0xffffffff,%eax
cmp    $0x8,%eax
jae    160a <main+0x43a>
xor    %ecx,%ecx
jmp    1770 <main+0x5a0>
mov    %rbp,0x30(%rsp)
mov    0x48(%rsp),%rdi
mov    %ebx,%esi
call   10d0 <rndm_list@plt>
mov    0x10(%rsp),%rcx
mov    %ecx,%eax
cltd
idiv   %ebx
mov    %eax,%r14d
imul   %ebx,%eax
cmp    %ecx,%eax
mov    %rbx,%rbp
je     152f <main+0x35f>
mov    (%r12),%edi
lea    0xe1e(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xe51(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
xor    %ebx,%ebx
test   %r14d,%r14d
mov    0x28(%rsp),%rdx
jle    15f7 <main+0x427>
lea    -0x1(%rbp),%r12d
shl    $0x2,%r12
add    $0x4,%r13
mov    %r13,0x70(%rsp)
xor    %esi,%esi
mov    %r14d,0x64(%rsp)
jmp    158c <main+0x3bc>
nopl   0x0(%rax)
mov    0x68(%rsp),%esi
add    $0x1,%esi
mov    %esi,%eax
mov    0x40(%rsp),%rbp
imul   %ebp,%eax
movslq %ebx,%rcx
add    $0x1,%ebx
mov    0x38(%rsp),%r13
mov    %eax,0x4(%r13,%rcx,4)
cmp    0x64(%rsp),%esi
mov    0x28(%rsp),%rdx
je     15ed <main+0x41d>
cmp    $0x2,%ebp
mov    %esi,0x68(%rsp)
jl     1560 <main+0x390>
mov    %esi,%r14d
imul   %ebp,%r14d
movslq %ebx,%rax
mov    0x70(%rsp),%rcx
lea    (%rcx,%rax,4),%rbp
xor    %r13d,%r13d
jmp    15bc <main+0x3ec>
nopl   (%rax)
add    $0x4,%r13
add    $0x1,%ebx
cmp    %r13,%r12
je     1560 <main+0x390>
mov    0x48(%rsp),%rax
mov    (%rax,%r13,1),%esi
add    %r14d,%esi
mov    %esi,0x0(%rbp,%r13,1)
cmp    0x10(%rsp),%esi
jl     15b0 <main+0x3e0>
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xda0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    15b0 <main+0x3e0>
movslq %ebx,%rbx
mov    0x29d1(%rip),%r12
movl   $0x0,0x0(%r13,%rbx,4)
mov    0x30(%rsp),%rbp
jmp    177e <main+0x5ae>
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    1638 <main+0x468>
movdqa 0x9cf(%rip),%xmm0
xor    %edi,%edi
jmp    1715 <main+0x545>
and    $0xfffffffffffffffc,%rsi
movdqa 0x9bc(%rip),%xmm0
xor    %edi,%edi
movdqa 0x9c1(%rip),%xmm8
movdqa 0x9c8(%rip),%xmm9
movdqa 0x9cf(%rip),%xmm10
movdqa 0x9d7(%rip),%xmm4
movdqa 0x9df(%rip),%xmm5
movdqa 0x9e7(%rip),%xmm6
movdqa 0x9ef(%rip),%xmm7
movdqa 0x9f7(%rip),%xmm1
nopl   0x0(%rax)
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqu %xmm0,0x0(%r13,%rdi,4)
movdqu %xmm2,0x10(%r13,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqu %xmm2,0x20(%r13,%rdi,4)
movdqu %xmm3,0x30(%r13,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqu %xmm2,0x40(%r13,%rdi,4)
movdqu %xmm3,0x50(%r13,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqu %xmm2,0x60(%r13,%rdi,4)
movdqu %xmm3,0x70(%r13,%rdi,4)
add    $0x20,%rdi
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffc,%rsi
jne    1690 <main+0x4c0>
test   %rdx,%rdx
je     1760 <main+0x590>
lea    0x10(,%rdi,4),%rsi
add    %r13,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movdqa 0x8dd(%rip),%xmm1
movdqa 0x8e5(%rip),%xmm2
nopl   0x0(%rax,%rax,1)
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    1740 <main+0x570>
cmp    %rax,%rcx
mov    0x28(%rsp),%rdx
je     177e <main+0x5ae>
nopw   0x0(%rax,%rax,1)
mov    %ecx,0x0(%r13,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1770 <main+0x5a0>
imul   %r15,%rbp
mov    %rbp,0x30(%rsp)
xor    %r14d,%r14d
movl   $0x0,0x0(%r13)
mov    $0x0,%ebp
cmpl   $0x0,0x10(%rsp)
mov    0x50(%rsp),%r15
jle    1860 <main+0x690>
lea    -0x1(%rdx),%rbx
lea    0xbeb(%rip),%r15
xor    %ecx,%ecx
xor    %ebp,%ebp
cmp    %edx,%ecx
jle    17db <main+0x60b>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1090 <err@plt>
mov    0x28(%rsp),%rdx
mov    0x0(%r13,%rbp,4),%ecx
movslq %ecx,%rax
mov    0x58(%rsp),%rcx
addl   $0x1,(%rcx,%rax,4)
cmp    %rbp,%rbx
je     17fb <main+0x62b>
mov    0x4(%r13,%rbp,4),%ecx
add    $0x1,%rbp
cmp    %edx,%ecx
jg     17c0 <main+0x5f0>
jmp    17db <main+0x60b>
cmpl   $0x0,0x10(%rsp)
jle    1859 <main+0x689>
lea    0xba3(%rip),%r13
xor    %ebx,%ebx
xor    %eax,%eax
mov    0x50(%rsp),%r15
jmp    182d <main+0x65d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%ebp
add    $0x1,%rbx
mov    %ebp,%eax
cmp    %rbx,%rdx
je     1860 <main+0x690>
mov    0x58(%rsp),%rcx
mov    (%rcx,%rbx,4),%ecx
cmp    $0x1,%ecx
je     1820 <main+0x650>
lea    0x1(%rax),%ebp
cmp    $0x3e,%eax
jg     1822 <main+0x652>
mov    (%r12),%edi
mov    %r13,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x28(%rsp),%rdx
jmp    1822 <main+0x652>
xor    %ebp,%ebp
mov    0x50(%rsp),%r15
shr    $0x3,%r15
mov    (%r12),%edi
lea    0xb52(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2771(%rip),%rax
mov    0x273a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
cmpl   $0x1,(%rsp)
mov    0x271b(%rip),%rax
mov    (%rax),%eax
cmove  %eax,%r14d
mov    0x273e(%rip),%rcx
cmove  (%rcx),%eax
mov    0x270c(%rip),%rcx
or     (%rcx),%r14d
or     %eax,%r14d
xor    %edi,%edi
mov    0x30(%rsp),%rbx
mov    %rbx,%rsi
mov    %r14d,%ecx
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%r13
mov    0x26d1(%rip),%rax
cmp    %r13,(%rax)
jne    1901 <main+0x731>
mov    (%r12),%edi
lea    0xae4(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xae3(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    (%r12),%edi
lea    0xad8(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rcx
shr    $0x3,%rcx
mov    (%r12),%edi
lea    0xac8(%rip),%rsi
mov    %rbx,%rdx
mov    %r15,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1060 <memset@plt>
mov    (%r12),%edi
lea    0xad9(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x10(%rsp),%rax
add    $0xffffffff,%eax
movslq %eax,%r14
test   %r14d,%r14d
je     1a17 <main+0x847>
cmp    $0x2,%r14
mov    $0x1,%edx
mov    $0x1,%r8d
cmovae %r14,%r8
mov    0x38(%rsp),%rax
mov    (%rax),%ecx
cmp    $0x1,%r14d
je     19ed <main+0x81d>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
neg    %rsi
mov    $0x1,%edx
mov    0x38(%rsp),%rbx
nop
movslq (%rbx,%rdx,4),%rdi
imul   %r15,%rdi
lea    0x0(,%rdi,8),%rbp
add    %r13,%rbp
movslq %ecx,%rax
imul   %r15,%rax
mov    %rbp,0x0(%r13,%rax,8)
movslq 0x4(%rbx,%rdx,4),%rcx
mov    %rcx,%rax
imul   %r15,%rax
lea    0x0(,%rax,8),%rax
add    %r13,%rax
mov    %rax,0x0(%r13,%rdi,8)
lea    (%rsi,%rdx,1),%rax
add    $0x2,%rax
add    $0x2,%rdx
cmp    $0x1,%rax
jne    19a0 <main+0x7d0>
test   $0x1,%r8b
je     1a17 <main+0x847>
mov    0x38(%rsp),%rax
movslq (%rax,%rdx,4),%rax
imul   %r15,%rax
lea    0x0(,%rax,8),%rax
add    %r13,%rax
movslq %ecx,%rcx
imul   %r15,%rcx
mov    %rax,0x0(%r13,%rcx,8)
imul   $0x64,0x8(%rsp),%eax
mov    %eax,0x48(%rsp)
mov    (%r12),%edi
mov    0x0(%r13,%r14,8),%rdx
sub    %r13,%rdx
lea    0xa13(%rip),%rsi
xor    %ebp,%ebp
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x38(%rsp),%rax
movslq (%rax,%r14,4),%rax
imul   %rax,%r15
mov    %r13,0x0(%r13,%r15,8)
mov    %r12,%r14
mov    (%r12),%edi
mov    0x0(%r13),%rcx
lea    0xa0d(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
cmpl   $0xfffffffd,0x10(%rsp)
jl     1acd <main+0x8fd>
mov    0x10(%rsp),%rax
lea    0x3(%rax),%r12d
test   %r12d,%r12d
cmovle %ebp,%r12d
lea    -0x4(%rax),%r15d
add    $0x1,%r12d
mov    %r13,%rbp
xor    %eax,%eax
jmp    1a97 <main+0x8c7>
mov    %ebx,%eax
cmp    %ebx,%r12d
je     1acd <main+0x8fd>
mov    0x0(%rbp),%rbp
lea    0x1(%rax),%ebx
cmp    %r15d,%eax
jl     1a90 <main+0x8c0>
mov    %rbp,%rcx
sub    %r13,%rcx
sar    $0x3,%rcx
shr    $0x3,%rcx
mov    (%r14),%edi
mov    0x0(%rbp),%r9
lea    0x9cf(%rip),%rsi
mov    %ebx,%edx
mov    %rbp,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    1a90 <main+0x8c0>
mov    0x48(%rsp),%ebp
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,(%rsp)
xor    %edi,%edi
mov    0x6c(%rsp),%ebx
mov    %ebx,%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     1b03 <main+0x933>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
lea    0x9e5(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1b16 <main+0x946>
lea    0x9b9(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0xc(%rsp),%ecx
mov    0x30(%rsp),%r8
lea    0x9dc(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x9c4000,%esi
mov    0x10(%rsp),%rdx
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r14
cmpl   $0x0,0x8(%rsp)
jle    1b80 <main+0x9b0>
cmp    $0x2,%ebp
mov    $0x1,%ebx
cmovge %ebp,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    $0x9c4000,%edi
mov    %r13,%rsi
call   1030 <reader@plt>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
add    $0xffffffff,%ebx
jne    1b60 <main+0x990>
movsd  (%rsp),%xmm0
mulsd  0x523(%rip),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
sub    %r14,%rax
movq   %rax,%xmm1
punpckldq 0x4e7(%rip),%xmm1
subpd  0x4ef(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
lea    0x9ab(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movapd 0x10(%rsp),%xmm0
divsd  (%rsp),%xmm0
lea    0x9a3(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [109 x i8] c"the random walker requires at least 6 arguments (only the 7th in the list below is optional), there were %d\0A\00"
@.str.1 = [34 x i8] c"insufficient invocation arguments\00"
@.str.2 = [14 x i8] c"i:r:l:s:S:m:L\00"
@optarg = global i32 0
@.str.3 = [18 x i8] c"unknown option %c\00"
@.str.4 = [21 x i8] c"size_t in %zd bytes\0A\00"
@.str.5 = [23 x i8] c"failed to set affinity\00"
@.str.6 = [28 x i8] c" process pinned to core %d\0A\00"
@.str.7 = [41 x i8] c" failed to malloc pattern for size = %d\0A\00"
@.str.8 = [25 x i8] c"malloc of pattern failed\00"
@.str.9 = [52 x i8] c" failed to malloc index array for line_count of %d\0A\00"
@.str.10 = [23 x i8] c"failed to malloc index\00"
@.str.11 = [57 x i8] c" failed to malloc index_test array for line_count of %d\0A\00"
@.str.12 = [28 x i8] c"failed to malloc index_test\00"
@.str.13 = [67 x i8] c" line count must be a multiple of the fifth argument num_seg = %d\0A\00"
@.str.14 = [16 x i8] c" bad line_count\00"
@.str.15 = [25 x i8] c" count = %d, index = %d\0A\00"
@.str.16 = [15 x i8] c"index[%d] = %d\00"
@.str.17 = [21 x i8] c"index_test[%d] = %d\0A\00"
@.str.18 = [10 x i8] c"bad = %d\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANON = global i32 0
@MAP_HUGETLB = global i32 0
@MAP_FAILED = global i8* null
@.str.19 = [13 x i8] c"mmap failed\0A\00"
@.str.20 = [12 x i8] c"mmap failed\00"
@.str.21 = [12 x i8] c" buf1 = %p\0A\00"
@.str.22 = [54 x i8] c" buf_size = %zu, zero_loop = %zu, array_stride = %zd\0A\00"
@.str.23 = [32 x i8] c" finished zeroing buf ret = %p\0A\00"
@.str.24 = [39 x i8] c" target of last element in loop = %zx\0A\00"
@.str.25 = [33 x i8] c" array address = %p value = %lx\0A\00"
@.str.26 = [53 x i8] c"index = %d,element = %ld, address = %p, value = %lx\0A\00"
@.str.27 = [28 x i8] c"cannot set cpu run affinity\00"
@.str.28 = [35 x i8] c" process pinned to core %d to run\0A\00"
@.str.29 = [115 x i8] c" calling walker %d times which loops %d times on buffer of %d lines with a stride of %d, for a total size of %zu\0A\00"
@.str.30 = [17 x i8] c" run time = %zd\0A\00"
@.str.31 = [36 x i8] c" average cycles per iteration = %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%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 double
%27 = alloca i64
%28 = alloca i64
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca i64
%33 = alloca i64
%34 = alloca i32
%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 i32
%44 = alloca i32
%45 = alloca i32*
%46 = alloca i32
%47 = alloca i32
%48 = alloca i32
%49 = alloca i32*
%50 = alloca i32*
%51 = alloca i32
%52 = alloca i32
%53 = alloca i32
%54 = alloca i32
%55 = alloca i32
%56 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %11
store i32 -1, i32* %20
store i32 0, i32* %21
store i32 10240000, i32* %22
store i32 100, i32* %23
store i32 1, i32* %24
store i32 0, i32* %25
store i64 0, i64* %33
store i32 0, i32* %34
store i32 32, i32* %53
store i32 0, i32* %54
store i64 4096, i64* %41
%57 = load i32, i32* %4
%58 = icmp slt i32 %57, 6
br i1 %58, label %59, label %65
59: ; preds = %2
%60 = load i32, i32* @stderr
%61 = load i32, i32* %4
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i32 %61)
%63 = call i32 (...) @usage()
%64 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %65
65: ; preds = %59, %2
br label %66
66: ; preds = %95, %65
%67 = load i32, i32* %4
%68 = load i8**, i8*** %5
%69 = call i32 @getopt(i32 %67, i8** %68, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 %69, i32* %47
%70 = icmp ne i32 %69, -1
br i1 %70, label %71, label %96
71: ; preds = %66
%72 = load i32, i32* %47
switch i32 %72, label %92 [
i32 105, label %73
i32 114, label %76
i32 108, label %79
i32 115, label %82
i32 83, label %85
i32 109, label %88
i32 76, label %91
]
73: ; preds = %71
%74 = load i32, i32* @optarg
%75 = call i32 @atoi(i32 %74)
store i32 %75, i32* %16
br label %95
76: ; preds = %71
%77 = load i32, i32* @optarg
%78 = call i32 @atoi(i32 %77)
store i32 %78, i32* %17
br label %95
79: ; preds = %71
%80 = load i32, i32* @optarg
%81 = call i32 @atoi(i32 %80)
store i32 %81, i32* %18
br label %95
82: ; preds = %71
%83 = load i32, i32* @optarg
%84 = call i32 @atoi(i32 %83)
store i32 %84, i32* %19
br label %95
85: ; preds = %71
%86 = load i32, i32* @optarg
%87 = call i32 @atoi(i32 %86)
store i32 %87, i32* %53
br label %95
88: ; preds = %71
%89 = load i32, i32* @optarg
%90 = call i32 @atoi(i32 %89)
store i32 %90, i32* %24
br label %95
91: ; preds = %71
store i32 1, i32* %54
store i64 2097152, i64* %41
br label %95
92: ; preds = %71
%93 = load i32, i32* %47
%94 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %93)
br label %95
95: ; preds = %92, %91, %88, %85, %82, %79, %76, %73
br label %66
96: ; preds = %66
%97 = load i32, i32* %23
%98 = load i32, i32* %24
%99 = mul nsw i32 %97, %98
store i32 %99, i32* %23
store i64 8, i64* %42
%100 = load i32, i32* @stderr
%101 = load i64, i64* %42
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %100, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 %101)
%103 = load i32, i32* %34
%104 = load i32, i32* %16
%105 = call i32 @pin_cpu(i32 %103, i32 %104)
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %109
107: ; preds = %96
%108 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %113
109: ; preds = %96
%110 = load i32, i32* @stderr
%111 = load i32, i32* %16
%112 = call i32 (i32, i8*, ...) @fprintf(i32 %110, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %109, %107
%114 = load i32, i32* %53
%115 = sext i32 %114 to i64
%116 = mul i64 %115, 4
%117 = trunc i64 %116 to i32
%118 = call i64 @malloc(i32 %117)
%119 = inttoptr i64 %118 to i32*
store i32* %119, i32** %45
%120 = load i32*, i32** %45
%121 = icmp eq i32* %120, null
br i1 %121, label %122, label %127
122: ; preds = %113
%123 = load i32, i32* @stderr
%124 = load i32, i32* %53
%125 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i32 %124)
%126 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %127
127: ; preds = %122, %113
%128 = load i64, i64* %41
%129 = load i32, i32* %19
%130 = sext i32 %129 to i64
%131 = mul i64 %128, %130
%132 = add i64 %131, 64
%133 = trunc i64 %132 to i32
store i32 %133, i32* %19
%134 = load i32, i32* %18
%135 = sext i32 %134 to i64
%136 = load i32, i32* %19
%137 = sext i32 %136 to i64
%138 = mul i64 %135, %137
store i64 %138, i64* %35
%139 = load i64, i64* %35
%140 = load i64, i64* %41
%141 = udiv i64 %139, %140
%142 = add i64 %141, 2
store i64 %142, i64* %40
%143 = load i64, i64* %41
%144 = load i64, i64* %40
%145 = mul i64 %143, %144
store i64 %145, i64* %35
%146 = load i32, i32* %19
%147 = sext i32 %146 to i64
%148 = udiv i64 %147, 8
store i64 %148, i64* %12
%149 = load i32, i32* %23
%150 = sitofp i32 %149 to double
%151 = load i32, i32* %22
%152 = sitofp i32 %151 to double
%153 = fmul double %150, %152
store double %153, double* %26
%154 = load i32, i32* %18
%155 = sext i32 %154 to i64
%156 = mul i64 %155, 4
%157 = trunc i64 %156 to i32
%158 = call i64 @malloc(i32 %157)
%159 = inttoptr i64 %158 to i32*
store i32* %159, i32** %49
%160 = load i32*, i32** %49
%161 = icmp eq i32* %160, null
br i1 %161, label %162, label %167
162: ; preds = %127
%163 = load i32, i32* @stderr
%164 = load i32, i32* %18
%165 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i32 %164)
%166 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
br label %167
167: ; preds = %162, %127
%168 = load i32, i32* %18
%169 = sext i32 %168 to i64
%170 = mul i64 %169, 4
%171 = trunc i64 %170 to i32
%172 = call i64 @malloc(i32 %171)
%173 = inttoptr i64 %172 to i32*
store i32* %173, i32** %50
%174 = load i32*, i32** %50
%175 = icmp eq i32* %174, null
br i1 %175, label %176, label %181
176: ; preds = %167
%177 = load i32, i32* @stderr
%178 = load i32, i32* %18
%179 = call i32 (i32, i8*, ...) @fprintf(i32 %177, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), i32 %178)
%180 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
br label %181
181: ; preds = %176, %167
store i32 0, i32* %13
br label %182
182: ; preds = %191, %181
%183 = load i32, i32* %13
%184 = load i32, i32* %18
%185 = icmp slt i32 %183, %184
br i1 %185, label %186, label %194
186: ; preds = %182
%187 = load i32*, i32** %50
%188 = load i32, i32* %13
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i32, i32* %187, i64 %189
store i32 0, i32* %190
br label %191
191: ; preds = %186
%192 = load i32, i32* %13
%193 = add nsw i32 %192, 1
store i32 %193, i32* %13
br label %182
194: ; preds = %182
%195 = load i32, i32* %53
%196 = icmp eq i32 %195, 1
br i1 %196, label %197, label %213
197: ; preds = %194
store i32 0, i32* %13
br label %198
198: ; preds = %209, %197
%199 = load i32, i32* %13
%200 = load i32, i32* %18
%201 = sub nsw i32 %200, 1
%202 = icmp slt i32 %199, %201
br i1 %202, label %203, label %212
203: ; preds = %198
%204 = load i32, i32* %13
%205 = load i32*, i32** %49
%206 = load i32, i32* %13
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i32, i32* %205, i64 %207
store i32 %204, i32* %208
br label %209
209: ; preds = %203
%210 = load i32, i32* %13
%211 = add nsw i32 %210, 1
store i32 %211, i32* %13
br label %198
212: ; preds = %198
br label %309
213: ; preds = %194
%214 = load i32*, i32** %45
%215 = load i32, i32* %53
%216 = call i32 @rndm_list(i32* %214, i32 %215)
%217 = load i32, i32* %18
%218 = load i32, i32* %53
%219 = sdiv i32 %217, %218
store i32 %219, i32* %51
%220 = load i32, i32* %51
%221 = load i32, i32* %53
%222 = mul nsw i32 %220, %221
%223 = load i32, i32* %18
%224 = icmp ne i32 %222, %223
br i1 %224, label %225, label %230
225: ; preds = %213
%226 = load i32, i32* @stderr
%227 = load i32, i32* %53
%228 = call i32 (i32, i8*, ...) @fprintf(i32 %226, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.13, i64 0, i64 0), i32 %227)
%229 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
br label %230
230: ; preds = %225, %213
store i32 0, i32* %52
%231 = load i64, i64* %35
%232 = load i32, i32* %53
%233 = sext i32 %232 to i64
%234 = udiv i64 %231, %233
store i64 %234, i64* %38
store i32 0, i32* %13
br label %235
235: ; preds = %301, %230
%236 = load i32, i32* %13
%237 = load i32, i32* %51
%238 = icmp slt i32 %236, %237
br i1 %238, label %239, label %304
239: ; preds = %235
%240 = load i32, i32* %13
%241 = load i32, i32* %53
%242 = mul nsw i32 %240, %241
store i32 %242, i32* %46
store i32 0, i32* %14
br label %243
243: ; preds = %287, %239
%244 = load i32, i32* %14
%245 = load i32, i32* %53
%246 = sub nsw i32 %245, 1
%247 = icmp slt i32 %244, %246
br i1 %247, label %248, label %290
248: ; preds = %243
%249 = load i32, i32* %52
%250 = add nsw i32 %249, 1
store i32 %250, i32* %52
%251 = load i32, i32* %51
%252 = load i32*, i32** %45
%253 = load i32, i32* %14
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds i32, i32* %252, i64 %254
%256 = load i32, i32* %255
%257 = mul nsw i32 %251, %256
%258 = sext i32 %257 to i64
store i64 %258, i64* %39
%259 = load i32*, i32** %45
%260 = load i32, i32* %14
%261 = sext i32 %260 to i64
%262 = getelementptr inbounds i32, i32* %259, i64 %261
%263 = load i32, i32* %262
%264 = load i32, i32* %46
%265 = add nsw i32 %263, %264
%266 = load i32*, i32** %49
%267 = load i32, i32* %52
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds i32, i32* %266, i64 %268
store i32 %265, i32* %269
%270 = load i32*, i32** %49
%271 = load i32, i32* %52
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds i32, i32* %270, i64 %272
%274 = load i32, i32* %273
%275 = load i32, i32* %18
%276 = icmp sge i32 %274, %275
br i1 %276, label %277, label %286
277: ; preds = %248
%278 = load i32, i32* %52
%279 = sitofp i32 %278 to double
%280 = load i32*, i32** %49
%281 = load i32, i32* %52
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds i32, i32* %280, i64 %282
%284 = load i32, i32* %283
%285 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0), double %279, i32 %284)
br label %286
286: ; preds = %277, %248
br label %287
287: ; preds = %286
%288 = load i32, i32* %14
%289 = add nsw i32 %288, 1
store i32 %289, i32* %14
br label %243
290: ; preds = %243
%291 = load i32, i32* %52
%292 = add nsw i32 %291, 1
store i32 %292, i32* %52
%293 = load i32, i32* %13
%294 = add nsw i32 %293, 1
%295 = load i32, i32* %53
%296 = mul nsw i32 %294, %295
%297 = load i32*, i32** %49
%298 = load i32, i32* %52
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds i32, i32* %297, i64 %299
store i32 %296, i32* %300
br label %301
301: ; preds = %290
%302 = load i32, i32* %13
%303 = add nsw i32 %302, 1
store i32 %303, i32* %13
br label %235
304: ; preds = %235
%305 = load i32*, i32** %49
%306 = load i32, i32* %52
%307 = sext i32 %306 to i64
%308 = getelementptr inbounds i32, i32* %305, i64 %307
store i32 0, i32* %308
br label %309
309: ; preds = %304, %212
%310 = load i32*, i32** %49
%311 = getelementptr inbounds i32, i32* %310, i64 0
store i32 0, i32* %311
store i32 0, i32* %13
br label %312
312: ; preds = %343, %309
%313 = load i32, i32* %13
%314 = load i32, i32* %18
%315 = icmp slt i32 %313, %314
br i1 %315, label %316, label %346
316: ; preds = %312
%317 = load i32*, i32** %49
%318 = load i32, i32* %13
%319 = sext i32 %318 to i64
%320 = getelementptr inbounds i32, i32* %317, i64 %319
%321 = load i32, i32* %320
%322 = load i32, i32* %18
%323 = icmp sgt i32 %321, %322
br i1 %323, label %324, label %332
324: ; preds = %316
%325 = load i32, i32* %13
%326 = load i32*, i32** %49
%327 = load i32, i32* %13
%328 = sext i32 %327 to i64
%329 = getelementptr inbounds i32, i32* %326, i64 %328
%330 = load i32, i32* %329
%331 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i32 %325, i32 %330)
br label %332
332: ; preds = %324, %316
%333 = load i32*, i32** %50
%334 = load i32*, i32** %49
%335 = load i32, i32* %13
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds i32, i32* %334, i64 %336
%338 = load i32, i32* %337
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds i32, i32* %333, i64 %339
%341 = load i32, i32* %340
%342 = add nsw i32 %341, 1
store i32 %342, i32* %340
br label %343
343: ; preds = %332
%344 = load i32, i32* %13
%345 = add nsw i32 %344, 1
store i32 %345, i32* %13
br label %312
346: ; preds = %312
store i32 0, i32* %48
store i32 0, i32* %13
br label %347
347: ; preds = %374, %346
%348 = load i32, i32* %13
%349 = load i32, i32* %18
%350 = icmp slt i32 %348, %349
br i1 %350, label %351, label %377
351: ; preds = %347
%352 = load i32*, i32** %50
%353 = load i32, i32* %13
%354 = sext i32 %353 to i64
%355 = getelementptr inbounds i32, i32* %352, i64 %354
%356 = load i32, i32* %355
%357 = icmp ne i32 %356, 1
br i1 %357, label %358, label %373
358: ; preds = %351
%359 = load i32, i32* %48
%360 = add nsw i32 %359, 1
store i32 %360, i32* %48
%361 = load i32, i32* %48
%362 = icmp slt i32 %361, 64
br i1 %362, label %363, label %372
363: ; preds = %358
%364 = load i32, i32* @stderr
%365 = load i32, i32* %13
%366 = load i32*, i32** %50
%367 = load i32, i32* %13
%368 = sext i32 %367 to i64
%369 = getelementptr inbounds i32, i32* %366, i64 %368
%370 = load i32, i32* %369
%371 = call i32 (i32, i8*, ...) @fprintf(i32 %364, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0), i32 %365, i32 %370)
br label %372
372: ; preds = %363, %358
br label %373
373: ; preds = %372, %351
br label %374
374: ; preds = %373
%375 = load i32, i32* %13
%376 = add nsw i32 %375, 1
store i32 %376, i32* %13
br label %347
377: ; preds = %347
%378 = load i32, i32* @stderr
%379 = load i32, i32* %48
%380 = call i32 (i32, i8*, ...) @fprintf(i32 %378, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0), i32 %379)
%381 = load i32, i32* %54
%382 = icmp eq i32 %381, 0
br i1 %382, label %383, label %395
383: ; preds = %377
%384 = load i64, i64* %35
%385 = load i32, i32* @PROT_READ
%386 = load i32, i32* @PROT_WRITE
%387 = or i32 %385, %386
%388 = load i32, i32* @MAP_PRIVATE
%389 = load i32, i32* @MAP_ANON
%390 = or i32 %388, %389
%391 = load i32, i32* %20
%392 = load i32, i32* %21
%393 = call i64 @mmap(i32* null, i64 %384, i32 %387, i32 %390, i32 %391, i32 %392)
%394 = inttoptr i64 %393 to i8*
store i8* %394, i8** %6
br label %395
395: ; preds = %383, %377
%396 = load i32, i32* %54
%397 = icmp eq i32 %396, 1
br i1 %397, label %398, label %412
398: ; preds = %395
%399 = load i64, i64* %35
%400 = load i32, i32* @PROT_READ
%401 = load i32, i32* @PROT_WRITE
%402 = or i32 %400, %401
%403 = load i32, i32* @MAP_PRIVATE
%404 = load i32, i32* @MAP_ANON
%405 = or i32 %403, %404
%406 = load i32, i32* @MAP_HUGETLB
%407 = or i32 %405, %406
%408 = load i32, i32* %20
%409 = load i32, i32* %21
%410 = call i64 @mmap(i32* null, i64 %399, i32 %402, i32 %407, i32 %408, i32 %409)
%411 = inttoptr i64 %410 to i8*
store i8* %411, i8** %6
br label %412
412: ; preds = %398, %395
%413 = load i8*, i8** %6
%414 = load i8*, i8** @MAP_FAILED
%415 = icmp eq i8* %413, %414
br i1 %415, label %416, label %420
416: ; preds = %412
%417 = load i32, i32* @stderr
%418 = call i32 (i32, i8*, ...) @fprintf(i32 %417, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0))
%419 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0))
br label %420
420: ; preds = %416, %412
%421 = load i32, i32* @stderr
%422 = load i8*, i8** %6
%423 = call i32 (i32, i8*, ...) @fprintf(i32 %421, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i8* %422)
%424 = load i64, i64* %35
%425 = load i64, i64* %42
%426 = udiv i64 %424, %425
store i64 %426, i64* %37
%427 = load i32, i32* @stderr
%428 = load i64, i64* %35
%429 = load i64, i64* %37
%430 = load i64, i64* %12
%431 = call i32 (i32, i8*, ...) @fprintf(i32 %427, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.22, i64 0, i64 0), i64 %428, i64 %429, i64 %430)
%432 = load i8*, i8** %6
%433 = bitcast i8* %432 to i64*
store i64* %433, i64** %8
%434 = load i8*, i8** %6
%435 = load i64, i64* %35
%436 = call i8* @memset(i8* %434, i32 0, i64 %435)
store i8* %436, i8** %7
%437 = load i32, i32* @stderr
%438 = load i8*, i8** %7
%439 = call i32 (i32, i8*, ...) @fprintf(i32 %437, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.23, i64 0, i64 0), i8* %438)
store i64 0, i64* %36
br label %440
440: ; preds = %467, %420
%441 = load i64, i64* %36
%442 = load i32, i32* %18
%443 = sub nsw i32 %442, 1
%444 = sext i32 %443 to i64
%445 = icmp ult i64 %441, %444
br i1 %445, label %446, label %470
446: ; preds = %440
%447 = load i64*, i64** %8
%448 = load i32*, i32** %49
%449 = load i64, i64* %36
%450 = add i64 %449, 1
%451 = getelementptr inbounds i32, i32* %448, i64 %450
%452 = load i32, i32* %451
%453 = sext i32 %452 to i64
%454 = load i64, i64* %12
%455 = mul i64 %453, %454
%456 = getelementptr inbounds i64, i64* %447, i64 %455
%457 = ptrtoint i64* %456 to i64
%458 = load i64*, i64** %8
%459 = load i32*, i32** %49
%460 = load i64, i64* %36
%461 = getelementptr inbounds i32, i32* %459, i64 %460
%462 = load i32, i32* %461
%463 = sext i32 %462 to i64
%464 = load i64, i64* %12
%465 = mul i64 %463, %464
%466 = getelementptr inbounds i64, i64* %458, i64 %465
store i64 %457, i64* %466
br label %467
467: ; preds = %446
%468 = load i64, i64* %36
%469 = add i64 %468, 1
store i64 %469, i64* %36
br label %440
470: ; preds = %440
%471 = load i32, i32* @stderr
%472 = load i64*, i64** %8
%473 = load i32, i32* %18
%474 = sub nsw i32 %473, 1
%475 = sext i32 %474 to i64
%476 = getelementptr inbounds i64, i64* %472, i64 %475
%477 = load i64, i64* %476
%478 = load i8*, i8** %6
%479 = ptrtoint i8* %478 to i64
%480 = sub i64 %477, %479
%481 = call i32 (i32, i8*, ...) @fprintf(i32 %471, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.24, i64 0, i64 0), i64 %480)
%482 = load i64*, i64** %8
%483 = getelementptr inbounds i64, i64* %482, i64 0
%484 = ptrtoint i64* %483 to i64
%485 = load i64*, i64** %8
%486 = load i64, i64* %12
%487 = load i32*, i32** %49
%488 = load i32, i32* %18
%489 = sub nsw i32 %488, 1
%490 = sext i32 %489 to i64
%491 = getelementptr inbounds i32, i32* %487, i64 %490
%492 = load i32, i32* %491
%493 = sext i32 %492 to i64
%494 = mul i64 %486, %493
%495 = getelementptr inbounds i64, i64* %485, i64 %494
store i64 %484, i64* %495
store i32 0, i32* %48
%496 = load i64*, i64** %8
store i64* %496, i64** %9
%497 = load i32, i32* @stderr
%498 = load i64*, i64** %9
%499 = load i64*, i64** %9
%500 = load i64, i64* %499
%501 = call i32 (i32, i8*, ...) @fprintf(i32 %497, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.25, i64 0, i64 0), i64* %498, i64 %500)
br label %502
502: ; preds = %534, %470
%503 = load i32, i32* %48
%504 = load i32, i32* %18
%505 = add nsw i32 %504, 4
%506 = icmp slt i32 %503, %505
br i1 %506, label %507, label %535
507: ; preds = %502
%508 = load i64*, i64** %9
%509 = load i64, i64* %508
%510 = inttoptr i64 %509 to i64*
store i64* %510, i64** %9
%511 = load i64*, i64** %9
%512 = load i64*, i64** %8
%513 = ptrtoint i64* %511 to i64
%514 = ptrtoint i64* %512 to i64
%515 = sub i64 %513, %514
%516 = sdiv exact i64 %515, 8
store i64 %516, i64* %10
%517 = load i64, i64* %10
%518 = load i64, i64* %42
%519 = udiv i64 %517, %518
store i64 %519, i64* %10
%520 = load i32, i32* %48
%521 = add nsw i32 %520, 1
store i32 %521, i32* %48
%522 = load i32, i32* %48
%523 = load i32, i32* %18
%524 = sub nsw i32 %523, 4
%525 = icmp sgt i32 %522, %524
br i1 %525, label %526, label %534
526: ; preds = %507
%527 = load i32, i32* @stderr
%528 = load i32, i32* %48
%529 = load i64, i64* %10
%530 = load i64*, i64** %9
%531 = load i64*, i64** %9
%532 = load i64, i64* %531
%533 = call i32 (i32, i8*, ...) @fprintf(i32 %527, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.26, i64 0, i64 0), i32 %528, i64 %529, i64* %530, i64 %532)
br label %534
534: ; preds = %526, %507
br label %502
535: ; preds = %502
%536 = load i32, i32* %34
%537 = load i32, i32* %17
%538 = call i32 @pin_cpu(i32 %536, i32 %537)
%539 = icmp eq i32 %538, -1
br i1 %539, label %540, label %542
540: ; preds = %535
%541 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.27, i64 0, i64 0))
br label %546
542: ; preds = %535
%543 = load i32, i32* %17
%544 = sitofp i32 %543 to double
%545 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.28, i64 0, i64 0), double %544)
br label %546
546: ; preds = %542, %540
%547 = load i32, i32* %23
%548 = sitofp i32 %547 to double
%549 = load i32, i32* %22
%550 = load i32, i32* %18
%551 = load i32, i32* %19
%552 = load i64, i64* %35
%553 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.29, i64 0, i64 0), double %548, i32 %549, i32 %550, i32 %551, i64 %552)
%554 = call i64 (...) @_rdtsc()
store i64 %554, i64* %30
store i32 0, i32* %13
br label %555
555: ; preds = %568, %546
%556 = load i32, i32* %13
%557 = load i32, i32* %23
%558 = icmp slt i32 %556, %557
br i1 %558, label %559, label %571
559: ; preds = %555
%560 = call i64 (...) @_rdtsc()
store i64 %560, i64* %27
%561 = load i32, i32* %22
%562 = load i64*, i64** %8
%563 = call i64 @reader(i32 %561, i64* %562)
store i64 %563, i64* %11
%564 = call i64 (...) @_rdtsc()
store i64 %564, i64* %28
%565 = load i64, i64* %28
%566 = load i64, i64* %27
%567 = sub i64 %565, %566
store i64 %567, i64* %29
br label %568
568: ; preds = %559
%569 = load i32, i32* %13
%570 = add nsw i32 %569, 1
store i32 %570, i32* %13
br label %555
571: ; preds = %555
%572 = call i64 (...) @_rdtsc()
store i64 %572, i64* %31
%573 = load i64, i64* %31
%574 = load i64, i64* %30
%575 = sub i64 %573, %574
store i64 %575, i64* %32
%576 = load i64, i64* %32
%577 = uitofp i64 %576 to double
%578 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.30, i64 0, i64 0), double %577)
%579 = load i64, i64* %32
%580 = uitofp i64 %579 to double
%581 = load double, double* %26
%582 = fdiv double %580, %581
%583 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.31, i64 0, i64 0), double %582)
%584 = load i32, i32* %25
ret i32 %584
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [109 x i8] c"the random walker requires at least 6 arguments (only the 7th in the list below is optional), there were %d\0A\00"
@.str.1 = [34 x i8] c"insufficient invocation arguments\00"
@.str.2 = [14 x i8] c"i:r:l:s:S:m:L\00"
@optarg = global i32 0
@.str.3 = [18 x i8] c"unknown option %c\00"
@.str.4 = [21 x i8] c"size_t in %zd bytes\0A\00"
@.str.5 = [23 x i8] c"failed to set affinity\00"
@.str.6 = [28 x i8] c" process pinned to core %d\0A\00"
@.str.7 = [41 x i8] c" failed to malloc pattern for size = %d\0A\00"
@.str.8 = [25 x i8] c"malloc of pattern failed\00"
@.str.9 = [52 x i8] c" failed to malloc index array for line_count of %d\0A\00"
@.str.10 = [23 x i8] c"failed to malloc index\00"
@.str.11 = [57 x i8] c" failed to malloc index_test array for line_count of %d\0A\00"
@.str.12 = [28 x i8] c"failed to malloc index_test\00"
@.str.13 = [67 x i8] c" line count must be a multiple of the fifth argument num_seg = %d\0A\00"
@.str.14 = [16 x i8] c" bad line_count\00"
@.str.15 = [25 x i8] c" count = %d, index = %d\0A\00"
@.str.16 = [15 x i8] c"index[%d] = %d\00"
@.str.17 = [21 x i8] c"index_test[%d] = %d\0A\00"
@.str.18 = [10 x i8] c"bad = %d\0A\00"
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@MAP_PRIVATE = global i32 0
@MAP_ANON = global i32 0
@MAP_HUGETLB = global i32 0
@MAP_FAILED = global i8* null
@.str.19 = [13 x i8] c"mmap failed\0A\00"
@.str.20 = [12 x i8] c"mmap failed\00"
@.str.21 = [12 x i8] c" buf1 = %p\0A\00"
@.str.22 = [54 x i8] c" buf_size = %zu, zero_loop = %zu, array_stride = %zd\0A\00"
@.str.23 = [32 x i8] c" finished zeroing buf ret = %p\0A\00"
@.str.24 = [39 x i8] c" target of last element in loop = %zx\0A\00"
@.str.25 = [33 x i8] c" array address = %p value = %lx\0A\00"
@.str.26 = [53 x i8] c"index = %d,element = %ld, address = %p, value = %lx\0A\00"
@.str.27 = [28 x i8] c"cannot set cpu run affinity\00"
@.str.28 = [35 x i8] c" process pinned to core %d to run\0A\00"
@.str.29 = [115 x i8] c" calling walker %d times which loops %d times on buffer of %d lines with a stride of %d, for a total size of %zu\0A\00"
@.str.30 = [17 x i8] c" run time = %zd\0A\00"
@.str.31 = [36 x i8] c" average cycles per iteration = %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 6
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = tail call i32 (...) @usage()
%8 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %4, %2
br label %10
10: ; preds = %20, %9
%11 = phi i32 [ 1, %9 ], [ %21, %20 ]
%12 = phi i64 [ 4096, %9 ], [ %22, %20 ]
%13 = phi i32 [ undef, %9 ], [ %23, %20 ]
%14 = phi i32 [ undef, %9 ], [ %24, %20 ]
%15 = phi i32 [ undef, %9 ], [ %25, %20 ]
%16 = phi i32 [ undef, %9 ], [ %26, %20 ]
%17 = phi i32 [ 32, %9 ], [ %27, %20 ]
%18 = phi i32 [ 0, %9 ], [ %28, %20 ]
%19 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
switch i32 %19, label %47 [
i32 -1, label %49
i32 105, label %29
i32 114, label %32
i32 108, label %35
i32 115, label %38
i32 83, label %41
i32 109, label %44
i32 76, label %20
]
20: ; preds = %10, %47, %44, %41, %38, %35, %32, %29
%21 = phi i32 [ %11, %47 ], [ %46, %44 ], [ %11, %41 ], [ %11, %38 ], [ %11, %35 ], [ %11, %32 ], [ %11, %29 ], [ %11, %10 ]
%22 = phi i64 [ %12, %47 ], [ %12, %44 ], [ %12, %41 ], [ %12, %38 ], [ %12, %35 ], [ %12, %32 ], [ %12, %29 ], [ 2097152, %10 ]
%23 = phi i32 [ %13, %47 ], [ %13, %44 ], [ %13, %41 ], [ %40, %38 ], [ %13, %35 ], [ %13, %32 ], [ %13, %29 ], [ %13, %10 ]
%24 = phi i32 [ %14, %47 ], [ %14, %44 ], [ %14, %41 ], [ %14, %38 ], [ %37, %35 ], [ %14, %32 ], [ %14, %29 ], [ %14, %10 ]
%25 = phi i32 [ %15, %47 ], [ %15, %44 ], [ %15, %41 ], [ %15, %38 ], [ %15, %35 ], [ %34, %32 ], [ %15, %29 ], [ %15, %10 ]
%26 = phi i32 [ %16, %47 ], [ %16, %44 ], [ %16, %41 ], [ %16, %38 ], [ %16, %35 ], [ %16, %32 ], [ %31, %29 ], [ %16, %10 ]
%27 = phi i32 [ %17, %47 ], [ %17, %44 ], [ %43, %41 ], [ %17, %38 ], [ %17, %35 ], [ %17, %32 ], [ %17, %29 ], [ %17, %10 ]
%28 = phi i32 [ %18, %47 ], [ %18, %44 ], [ %18, %41 ], [ %18, %38 ], [ %18, %35 ], [ %18, %32 ], [ %18, %29 ], [ 1, %10 ]
br label %10
29: ; preds = %10
%30 = load i32, i32* @optarg
%31 = tail call i32 @atoi(i32 %30)
br label %20
32: ; preds = %10
%33 = load i32, i32* @optarg
%34 = tail call i32 @atoi(i32 %33)
br label %20
35: ; preds = %10
%36 = load i32, i32* @optarg
%37 = tail call i32 @atoi(i32 %36)
br label %20
38: ; preds = %10
%39 = load i32, i32* @optarg
%40 = tail call i32 @atoi(i32 %39)
br label %20
41: ; preds = %10
%42 = load i32, i32* @optarg
%43 = tail call i32 @atoi(i32 %42)
br label %20
44: ; preds = %10
%45 = load i32, i32* @optarg
%46 = tail call i32 @atoi(i32 %45)
br label %20
47: ; preds = %10
%48 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %20
49: ; preds = %10
%50 = mul i32 %11, 100
%51 = load i32, i32* @stderr
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 8)
%53 = tail call i32 @pin_cpu(i32 0, i32 %16)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = 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 %60
57: ; preds = %49
%58 = load i32, i32* @stderr
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %16)
br label %60
60: ; preds = %57, %55
%61 = shl i32 %17, 2
%62 = tail call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i32*
%64 = icmp eq i64 %62, 0
br i1 %64, label %65, label %69
65: ; preds = %60
%66 = load i32, i32* @stderr
%67 = tail call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i32 %17)
%68 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %69
69: ; preds = %65, %60
%70 = trunc i64 %12 to i32
%71 = mul i32 %13, %70
%72 = or i32 %71, 64
%73 = sext i32 %14 to i64
%74 = sext i32 %72 to i64
%75 = mul nsw i64 %74, %73
%76 = udiv i64 %75, %12
%77 = add i64 %76, 2
%78 = mul i64 %77, %12
%79 = lshr exact i64 %74, 3
%80 = sitofp i32 %50 to double
%81 = shl i32 %14, 2
%82 = tail call i64 @malloc(i32 %81)
%83 = inttoptr i64 %82 to i32*
%84 = icmp eq i64 %82, 0
br i1 %84, label %85, label %89
85: ; preds = %69
%86 = load i32, i32* @stderr
%87 = tail call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i32 %14)
%88 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
br label %89
89: ; preds = %85, %69
%90 = tail call i64 @malloc(i32 %81)
%91 = inttoptr i64 %90 to i32*
%92 = inttoptr i64 %90 to i8*
%93 = icmp eq i64 %90, 0
br i1 %93, label %94, label %98
94: ; preds = %89
%95 = load i32, i32* @stderr
%96 = tail call i32 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), i32 %14)
%97 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0))
br label %98
98: ; preds = %94, %89
%99 = icmp sgt i32 %14, 0
br i1 %99, label %100, label %103
100: ; preds = %98
%101 = zext i32 %14 to i64
%102 = shl nuw nsw i64 %101, 2
br label %103
103: ; preds = %100, %98
%104 = icmp eq i32 %17, 1
br i1 %104, label %105, label %181
105: ; preds = %103
%106 = icmp sgt i32 %14, 1
br i1 %106, label %107, label %233
107: ; preds = %105
%108 = add nsw i32 %14, -1
%109 = zext i32 %108 to i64
%110 = icmp ult i32 %108, 8
br i1 %110, label %173, label %111
111: ; preds = %107
%112 = and i64 %109, 4294967288
%113 = add nsw i64 %112, -8
%114 = lshr exact i64 %113, 3
%115 = add nuw nsw i64 %114, 1
%116 = and i64 %115, 3
%117 = icmp ult i64 %113, 24
br i1 %117, label %154, label %118
118: ; preds = %111
%119 = and i64 %115, 4611686018427387900
br label %120
120: ; preds = %120, %118
%121 = phi i64 [ 0, %118 ], [ %150, %120 ]
%122 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %118 ], [ %151, %120 ]
%123 = phi i64 [ 0, %118 ], [ %152, %120 ]
%124 = add <4 x i32> %122, <i32 4, i32 4, i32 4, i32 4>
%125 = getelementptr inbounds i32, i32* %83, i64 %121
%126 = bitcast i32* %125 to <4 x i32>*
store <4 x i32> %122, <4 x i32>* %126
%127 = getelementptr inbounds i32, i32* %125, i64 4
%128 = bitcast i32* %127 to <4 x i32>*
store <4 x i32> %124, <4 x i32>* %128
%129 = or i64 %121, 8
%130 = add <4 x i32> %122, <i32 8, i32 8, i32 8, i32 8>
%131 = add <4 x i32> %122, <i32 12, i32 12, i32 12, i32 12>
%132 = getelementptr inbounds i32, i32* %83, i64 %129
%133 = bitcast i32* %132 to <4 x i32>*
store <4 x i32> %130, <4 x i32>* %133
%134 = getelementptr inbounds i32, i32* %132, i64 4
%135 = bitcast i32* %134 to <4 x i32>*
store <4 x i32> %131, <4 x i32>* %135
%136 = or i64 %121, 16
%137 = add <4 x i32> %122, <i32 16, i32 16, i32 16, i32 16>
%138 = add <4 x i32> %122, <i32 20, i32 20, i32 20, i32 20>
%139 = getelementptr inbounds i32, i32* %83, i64 %136
%140 = bitcast i32* %139 to <4 x i32>*
store <4 x i32> %137, <4 x i32>* %140
%141 = getelementptr inbounds i32, i32* %139, i64 4
%142 = bitcast i32* %141 to <4 x i32>*
store <4 x i32> %138, <4 x i32>* %142
%143 = or i64 %121, 24
%144 = add <4 x i32> %122, <i32 24, i32 24, i32 24, i32 24>
%145 = add <4 x i32> %122, <i32 28, i32 28, i32 28, i32 28>
%146 = getelementptr inbounds i32, i32* %83, i64 %143
%147 = bitcast i32* %146 to <4 x i32>*
store <4 x i32> %144, <4 x i32>* %147
%148 = getelementptr inbounds i32, i32* %146, i64 4
%149 = bitcast i32* %148 to <4 x i32>*
store <4 x i32> %145, <4 x i32>* %149
%150 = add nuw i64 %121, 32
%151 = add <4 x i32> %122, <i32 32, i32 32, i32 32, i32 32>
%152 = add i64 %123, 4
%153 = icmp eq i64 %152, %119
br i1 %153, label %154, label %120
154: ; preds = %120, %111
%155 = phi i64 [ 0, %111 ], [ %150, %120 ]
%156 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %111 ], [ %151, %120 ]
%157 = icmp eq i64 %116, 0
br i1 %157, label %171, label %158
158: ; preds = %154, %158
%159 = phi i64 [ %167, %158 ], [ %155, %154 ]
%160 = phi <4 x i32> [ %168, %158 ], [ %156, %154 ]
%161 = phi i64 [ %169, %158 ], [ 0, %154 ]
%162 = add <4 x i32> %160, <i32 4, i32 4, i32 4, i32 4>
%163 = getelementptr inbounds i32, i32* %83, i64 %159
%164 = bitcast i32* %163 to <4 x i32>*
store <4 x i32> %160, <4 x i32>* %164
%165 = getelementptr inbounds i32, i32* %163, i64 4
%166 = bitcast i32* %165 to <4 x i32>*
store <4 x i32> %162, <4 x i32>* %166
%167 = add nuw i64 %159, 8
%168 = add <4 x i32> %160, <i32 8, i32 8, i32 8, i32 8>
%169 = add i64 %161, 1
%170 = icmp eq i64 %169, %116
br i1 %170, label %171, label %158
171: ; preds = %158, %154
%172 = icmp eq i64 %112, %109
br i1 %172, label %233, label %173
173: ; preds = %107, %171
%174 = phi i64 [ 0, %107 ], [ %112, %171 ]
br label %175
175: ; preds = %173, %175
%176 = phi i64 [ %179, %175 ], [ %174, %173 ]
%177 = getelementptr inbounds i32, i32* %83, i64 %176
%178 = trunc i64 %176 to i32
store i32 %178, i32* %177
%179 = add nuw nsw i64 %176, 1
%180 = icmp eq i64 %179, %109
br i1 %180, label %233, label %175
181: ; preds = %103
%182 = tail call i32 @rndm_list(i32* %63, i32 %17)
%183 = sdiv i32 %14, %17
%184 = mul nsw i32 %183, %17
%185 = icmp eq i32 %184, %14
br i1 %185, label %190, label %186
186: ; preds = %181
%187 = load i32, i32* @stderr
%188 = tail call i32 (i32, i8*, ...) @fprintf(i32 %187, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.13, i64 0, i64 0), i32 %17)
%189 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0))
br label %190
190: ; preds = %186, %181
%191 = icmp sgt i32 %183, 0
br i1 %191, label %192, label %230
192: ; preds = %190
%193 = add i32 %17, -1
%194 = icmp sgt i32 %17, 1
%195 = zext i32 %193 to i64
br label %196
196: ; preds = %192, %220
%197 = phi i32 [ 0, %192 ], [ %222, %220 ]
%198 = phi i32 [ 0, %192 ], [ %223, %220 ]
%199 = mul nsw i32 %198, %17
br i1 %194, label %200, label %220
200: ; preds = %196
%201 = sext i32 %197 to i64
br label %202
202: ; preds = %200, %215
%203 = phi i64 [ 0, %200 ], [ %216, %215 ]
%204 = phi i64 [ %201, %200 ], [ %205, %215 ]
%205 = add nsw i64 %204, 1
%206 = getelementptr inbounds i32, i32* %63, i64 %203
%207 = load i32, i32* %206
%208 = add nsw i32 %207, %199
%209 = getelementptr inbounds i32, i32* %83, i64 %205
store i32 %208, i32* %209
%210 = icmp slt i32 %208, %14
br i1 %210, label %215, label %211
211: ; preds = %202
%212 = trunc i64 %205 to i32
%213 = sitofp i32 %212 to double
%214 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0), double %213, i32 %208)
br label %215
215: ; preds = %202, %211
%216 = add nuw nsw i64 %203, 1
%217 = icmp eq i64 %216, %195
br i1 %217, label %218, label %202
218: ; preds = %215
%219 = trunc i64 %205 to i32
br label %220
220: ; preds = %218, %196
%221 = phi i32 [ %197, %196 ], [ %219, %218 ]
%222 = add nsw i32 %221, 1
%223 = add nuw nsw i32 %198, 1
%224 = mul nsw i32 %223, %17
%225 = sext i32 %222 to i64
%226 = getelementptr inbounds i32, i32* %83, i64 %225
store i32 %224, i32* %226
%227 = icmp eq i32 %223, %183
br i1 %227, label %228, label %196
228: ; preds = %220
%229 = sext i32 %222 to i64
br label %230
230: ; preds = %190, %228
%231 = phi i64 [ %229, %228 ], [ 0, %190 ]
%232 = getelementptr inbounds i32, i32* %83, i64 %231
store i32 0, i32* %232
br label %233
233: ; preds = %175, %171, %105, %230
store i32 0, i32* %83
br i1 %99, label %234, label %276
234: ; preds = %233
%235 = zext i32 %14 to i64
br label %239
236: ; preds = %248
br i1 %99, label %237, label %276
237: ; preds = %236
%238 = zext i32 %14 to i64
br label %259
239: ; preds = %256, %234
%240 = phi i32 [ 0, %234 ], [ %258, %256 ]
%241 = phi i64 [ 0, %234 ], [ %254, %256 ]
%242 = icmp sgt i32 %240, %14
br i1 %242, label %243, label %248
243: ; preds = %239
%244 = getelementptr inbounds i32, i32* %83, i64 %241
%245 = trunc i64 %241 to i32
%246 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i32 %245, i32 %240)
%247 = load i32, i32* %244
br label %248
248: ; preds = %243, %239
%249 = phi i32 [ %247, %243 ], [ %240, %239 ]
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds i32, i32* %91, i64 %250
%252 = load i32, i32* %251
%253 = add nsw i32 %252, 1
store i32 %253, i32* %251
%254 = add nuw nsw i64 %241, 1
%255 = icmp eq i64 %254, %235
br i1 %255, label %236, label %256
256: ; preds = %248
%257 = getelementptr inbounds i32, i32* %83, i64 %254
%258 = load i32, i32* %257
br label %239
259: ; preds = %237, %272
%260 = phi i64 [ 0, %237 ], [ %274, %272 ]
%261 = phi i32 [ 0, %237 ], [ %273, %272 ]
%262 = getelementptr inbounds i32, i32* %91, i64 %260
%263 = load i32, i32* %262
%264 = icmp eq i32 %263, 1
br i1 %264, label %272, label %265
265: ; preds = %259
%266 = add nsw i32 %261, 1
%267 = icmp slt i32 %261, 63
br i1 %267, label %268, label %272
268: ; preds = %265
%269 = load i32, i32* @stderr
%270 = trunc i64 %260 to i32
%271 = tail call i32 (i32, i8*, ...) @fprintf(i32 %269, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0), i32 %270, i32 %263)
br label %272
272: ; preds = %259, %268, %265
%273 = phi i32 [ %266, %268 ], [ %266, %265 ], [ %261, %259 ]
%274 = add nuw nsw i64 %260, 1
%275 = icmp eq i64 %274, %238
br i1 %275, label %276, label %259
276: ; preds = %272, %233, %236
%277 = phi i32 [ 0, %236 ], [ 0, %233 ], [ %273, %272 ]
%278 = load i32, i32* @stderr
%279 = tail call i32 (i32, i8*, ...) @fprintf(i32 %278, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.18, i64 0, i64 0), i32 %277)
%280 = icmp eq i32 %18, 1
%281 = load i32, i32* @PROT_READ
%282 = load i32, i32* @PROT_WRITE
%283 = or i32 %282, %281
%284 = load i32, i32* @MAP_ANON
%285 = load i32, i32* @MAP_PRIVATE
%286 = select i1 %280, i32 %285, i32 0
%287 = or i32 %284, %286
%288 = load i32, i32* @MAP_HUGETLB
%289 = select i1 %280, i32 %288, i32 %285
%290 = or i32 %287, %289
%291 = tail call i64 @mmap(i32* null, i64 %78, i32 %283, i32 %290, i32 -1, i32 0)
%292 = inttoptr i64 %291 to i8*
%293 = load i8*, i8** @MAP_FAILED
%294 = icmp eq i8* %293, %292
br i1 %294, label %295, label %299
295: ; preds = %276
%296 = load i32, i32* @stderr
%297 = tail call i32 (i32, i8*, ...) @fprintf(i32 %296, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0))
%298 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.20, i64 0, i64 0))
br label %299
299: ; preds = %295, %276
%300 = load i32, i32* @stderr
%301 = tail call i32 (i32, i8*, ...) @fprintf(i32 %300, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i8* %292)
%302 = lshr exact i64 %78, 3
%303 = load i32, i32* @stderr
%304 = tail call i32 (i32, i8*, ...) @fprintf(i32 %303, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.22, i64 0, i64 0), i64 %78, i64 %302, i64 %79)
%305 = inttoptr i64 %291 to i64*
tail call void @llvm.memset.p0i8.i64(i8* align 1 %292, i8 0, i64 %78, i1 false)
%306 = load i32, i32* @stderr
%307 = tail call i32 (i32, i8*, ...) @fprintf(i32 %306, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.23, i64 0, i64 0), i8* %292)
%308 = add nsw i32 %14, -1
%309 = sext i32 %308 to i64
%310 = icmp eq i32 %308, 0
br i1 %310, label %360, label %311
311: ; preds = %299
%312 = call i64 @llvm.umax.i64(i64 %309, i64 1)
%313 = load i32, i32* %83
%314 = and i64 %312, 1
%315 = icmp eq i32 %308, 1
br i1 %315, label %346, label %316
316: ; preds = %311
%317 = and i64 %312, -2
br label %318
318: ; preds = %318, %316
%319 = phi i32 [ %313, %316 ], [ %334, %318 ]
%320 = phi i64 [ 0, %316 ], [ %332, %318 ]
%321 = phi i64 [ 0, %316 ], [ %342, %318 ]
%322 = or i64 %320, 1
%323 = getelementptr inbounds i32, i32* %83, i64 %322
%324 = load i32, i32* %323
%325 = sext i32 %324 to i64
%326 = mul i64 %79, %325
%327 = getelementptr inbounds i64, i64* %305, i64 %326
%328 = ptrtoint i64* %327 to i64
%329 = sext i32 %319 to i64
%330 = mul i64 %79, %329
%331 = getelementptr inbounds i64, i64* %305, i64 %330
store i64 %328, i64* %331
%332 = add nuw i64 %320, 2
%333 = getelementptr inbounds i32, i32* %83, i64 %332
%334 = load i32, i32* %333
%335 = sext i32 %334 to i64
%336 = mul i64 %79, %335
%337 = getelementptr inbounds i64, i64* %305, i64 %336
%338 = ptrtoint i64* %337 to i64
%339 = sext i32 %324 to i64
%340 = mul i64 %79, %339
%341 = getelementptr inbounds i64, i64* %305, i64 %340
store i64 %338, i64* %341
%342 = add i64 %321, 2
%343 = icmp eq i64 %342, %317
br i1 %343, label %344, label %318
344: ; preds = %318
%345 = add i64 %320, 3
br label %346
346: ; preds = %344, %311
%347 = phi i32 [ %313, %311 ], [ %334, %344 ]
%348 = phi i64 [ 1, %311 ], [ %345, %344 ]
%349 = icmp eq i64 %314, 0
br i1 %349, label %360, label %350
350: ; preds = %346
%351 = getelementptr inbounds i32, i32* %83, i64 %348
%352 = load i32, i32* %351
%353 = sext i32 %352 to i64
%354 = mul i64 %79, %353
%355 = getelementptr inbounds i64, i64* %305, i64 %354
%356 = ptrtoint i64* %355 to i64
%357 = sext i32 %347 to i64
%358 = mul i64 %79, %357
%359 = getelementptr inbounds i64, i64* %305, i64 %358
store i64 %356, i64* %359
br label %360
360: ; preds = %350, %346, %299
%361 = load i32, i32* @stderr
%362 = getelementptr inbounds i64, i64* %305, i64 %309
%363 = load i64, i64* %362
%364 = sub i64 %363, %291
%365 = tail call i32 (i32, i8*, ...) @fprintf(i32 %361, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.24, i64 0, i64 0), i64 %364)
%366 = getelementptr inbounds i32, i32* %83, i64 %309
%367 = load i32, i32* %366
%368 = sext i32 %367 to i64
%369 = mul i64 %79, %368
%370 = getelementptr inbounds i64, i64* %305, i64 %369
store i64 %291, i64* %370
%371 = load i32, i32* @stderr
%372 = load i64, i64* %305
%373 = tail call i32 (i32, i8*, ...) @fprintf(i32 %371, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.25, i64 0, i64 0), i8* %292, i64 %372)
%374 = icmp sgt i32 %14, -4
br i1 %374, label %375, label %395
375: ; preds = %360
%376 = add nsw i32 %14, -4
%377 = add i32 %14, 3
%378 = call i32 @llvm.smax.i32(i32 %377, i32 0)
br label %379
379: ; preds = %375, %393
%380 = phi i64* [ %305, %375 ], [ %383, %393 ]
%381 = phi i32 [ 0, %375 ], [ %384, %393 ]
%382 = load i64, i64* %380
%383 = inttoptr i64 %382 to i64*
%384 = add nuw i32 %381, 1
%385 = icmp slt i32 %381, %376
br i1 %385, label %393, label %386
386: ; preds = %379
%387 = sub i64 %382, %291
%388 = ashr exact i64 %387, 3
%389 = lshr i64 %388, 3
%390 = load i32, i32* @stderr
%391 = load i64, i64* %383
%392 = tail call i32 (i32, i8*, ...) @fprintf(i32 %390, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.26, i64 0, i64 0), i32 %384, i64 %389, i64* %383, i64 %391)
br label %393
393: ; preds = %386, %379
%394 = icmp eq i32 %381, %378
br i1 %394, label %395, label %379
395: ; preds = %393, %360
%396 = tail call i32 @pin_cpu(i32 0, i32 %15)
%397 = icmp eq i32 %396, -1
br i1 %397, label %398, label %400
398: ; preds = %395
%399 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.27, i64 0, i64 0))
br label %403
400: ; preds = %395
%401 = sitofp i32 %15 to double
%402 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.28, i64 0, i64 0), double %401)
br label %403
403: ; preds = %400, %398
%404 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.29, i64 0, i64 0), double %80, i32 10240000, i32 %14, i32 %72, i64 %78)
%405 = tail call i64 (...) @_rdtsc()
%406 = icmp sgt i32 %11, 0
br i1 %406, label %407, label %416
407: ; preds = %403
%408 = call i32 @llvm.smax.i32(i32 %50, i32 1)
br label %409
409: ; preds = %407, %409
%410 = phi i32 [ %414, %409 ], [ 0, %407 ]
%411 = tail call i64 (...) @_rdtsc()
%412 = tail call i64 @reader(i32 10240000, i64* %305)
%413 = tail call i64 (...) @_rdtsc()
%414 = add nuw nsw i32 %410, 1
%415 = icmp eq i32 %414, %408
br i1 %415, label %416, label %409
416: ; preds = %409, %403
%417 = fmul double %80, 1.024000e+07
%418 = tail call i64 (...) @_rdtsc()
%419 = sub i64 %418, %405
%420 = uitofp i64 %419 to double
%421 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.30, i64 0, i64 0), double %420)
%422 = fdiv double %420, %417
%423 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.31, i64 0, i64 0), double %422)
ret i32 0
}