#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, 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;
  int *index, 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");
  }
  if (num_seg == 1) {
    for (i = 0; i < line_count; 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 = 0;
      for (j = 0; j < num_seg; j++) {
        count++;
        if (j == (num_seg - 1))
          step = 1;
        ind = lc_by_num_seg * pattern[j];
        index[count] = (int)ind + i + step;
        if (index[count] >= line_count)
          printf(" count = %d, index = %d\n", count, index[count]);
      }
    }
  }
  index[0] = 0;
  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)(line_count - 1)] = (size_t)&array[0];
  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    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0xffffffff,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x9c4000,-0x60(%rbp)
movl   $0x64,-0x64(%rbp)
movl   $0x1,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movq   $0x0,-0xb0(%rbp)
movl   $0x0,-0xb4(%rbp)
movl   $0x20,-0x124(%rbp)
movl   $0x0,-0x128(%rbp)
movq   $0x1000,-0xf0(%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,-0x110(%rbp)
cmp    $0xffffffff,%eax
je     13a5 <main+0x1d5>
mov    -0x110(%rbp),%eax
add    $0xffffffb4,%eax
mov    %eax,%ecx
mov    %rcx,-0x140(%rbp)
sub    $0x27,%eax
ja     1387 <main+0x1b7>
mov    -0x140(%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,-0x48(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cf5(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x4c(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cdf(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x50(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x54(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2cb3(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x124(%rbp)
jmp    13a0 <main+0x1d0>
mov    0x2c9a(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,-0x68(%rbp)
jmp    13a0 <main+0x1d0>
movl   $0x1,-0x128(%rbp)
movq   $0x200000,-0xf0(%rbp)
jmp    13a0 <main+0x1d0>
mov    -0x110(%rbp),%edx
mov    $0x1,%edi
lea    0xdc4(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    1292 <main+0xc2>
mov    -0x64(%rbp),%eax
imul   -0x68(%rbp),%eax
mov    %eax,-0x64(%rbp)
movq   $0x8,-0xf8(%rbp)
mov    0x2c07(%rip),%rax
mov    (%rax),%edi
mov    -0xf8(%rbp),%rdx
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xb4(%rbp),%edi
mov    -0x48(%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    -0x48(%rbp),%edx
lea    0xd81(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movslq -0x124(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x108(%rbp)
cmpq   $0x0,-0x108(%rbp)
jne    1478 <main+0x2a8>
mov    0x2b79(%rip),%rax
mov    (%rax),%edi
mov    -0x124(%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    -0xf0(%rbp),%rax
movslq -0x54(%rbp),%rcx
imul   %rcx,%rax
add    $0x40,%rax
mov    %eax,-0x54(%rbp)
movslq -0x50(%rbp),%rax
movslq -0x54(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0xc0(%rbp)
mov    -0xc0(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0xf0(%rbp)
add    $0x2,%rax
mov    %rax,-0xe8(%rbp)
mov    -0xf0(%rbp),%rax
imul   -0xe8(%rbp),%rax
ff
mov    %rax,-0xc0(%rbp)
movslq -0x54(%rbp),%rax
shr    $0x3,%rax
mov    %rax,-0x38(%rbp)
cvtsi2sdl -0x64(%rbp),%xmm0
cvtsi2sdl -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movslq -0x50(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x118(%rbp)
cmpq   $0x0,-0x118(%rbp)
jne    1544 <main+0x374>
mov    0x2aaa(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%edx
lea    0xccf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xcf0(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
cmpl   $0x1,-0x124(%rbp)
jne    1588 <main+0x3b8>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1583 <main+0x3b3>
mov    -0x3c(%rbp),%edx
mov    -0x118(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1558 <main+0x388>
jmp    1724 <main+0x554>
mov    -0x108(%rbp),%rdi
mov    -0x124(%rbp),%esi
call   10d0 <rndm_list@plt>
mov    -0x50(%rbp),%eax
cltd
idivl  -0x124(%rbp)
mov    %eax,-0x11c(%rbp)
mov    -0x11c(%rbp),%eax
imul   -0x124(%rbp),%eax
cmp    -0x50(%rbp),%eax
je     15f0 <main+0x420>
mov    0x2a01(%rip),%rax
mov    (%rax),%edi
mov    -0x124(%rbp),%edx
lea    0xc6e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xc9e(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
movl   $0x0,-0x120(%rbp)
mov    -0xc0(%rbp),%rax
movslq -0x124(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0xd8(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x11c(%rbp),%eax
jge    171f <main+0x54f>
movl   $0x0,-0x10c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x124(%rbp),%eax
jge    170c <main+0x53c>
mov    -0x120(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x120(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x124(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1677 <main+0x4a7>
movl   $0x1,-0x10c(%rbp)
mov    -0x11c(%rbp),%eax
mov    -0x108(%rbp),%rcx
movslq -0x40(%rbp),%rdx
imul   (%rcx,%rdx,4),%eax
cltq
mov    %rax,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
mov    %eax,%edx
add    -0x3c(%rbp),%edx
add    -0x10c(%rbp),%edx
mov    -0x118(%rbp),%rax
movslq -0x120(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x118(%rbp),%rax
movslq -0x120(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x50(%rbp),%eax
jl     16f9 <main+0x529>
cvtsi2sdl -0x120(%rbp),%xmm0
ff
mov    -0x118(%rbp),%rax
movslq -0x120(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xba5(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    16fe <main+0x52e>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    163b <main+0x46b>
jmp    1711 <main+0x541>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    161b <main+0x44b>
jmp    1724 <main+0x554>
mov    -0x118(%rbp),%rax
movl   $0x0,(%rax)
cmpl   $0x0,-0x128(%rbp)
jne    177e <main+0x5ae>
mov    -0xc0(%rbp),%rsi
mov    0x28a4(%rip),%rax
mov    (%rax),%edx
mov    0x286b(%rip),%rax
or     (%rax),%edx
mov    0x2852(%rip),%rax
mov    (%rax),%ecx
mov    0x2851(%rip),%rax
or     (%rax),%ecx
mov    -0x58(%rbp),%r8d
mov    -0x5c(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x128(%rbp)
jne    17d4 <main+0x604>
mov    -0xc0(%rbp),%rsi
mov    0x2857(%rip),%rax
mov    (%rax),%edx
mov    0x281e(%rip),%rax
or     (%rax),%edx
mov    0x2805(%rip),%rax
mov    (%rax),%ecx
mov    0x2804(%rip),%rax
or     (%rax),%ecx
mov    0x2823(%rip),%rax
or     (%rax),%ecx
mov    -0x58(%rbp),%r8d
mov    -0x5c(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%edi
call   1040 <mmap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x27c9(%rip),%rcx
cmp    (%rcx),%rax
jne    1812 <main+0x642>
mov    0x27d9(%rip),%rax
mov    (%rax),%edi
lea    0xab8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
lea    0xab2(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
mov    0x27af(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xaa3(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0xc0(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0xf8(%rbp)
mov    %rax,-0xd0(%rbp)
mov    0x277b(%rip),%rax
mov    (%rax),%edi
mov    -0xc0(%rbp),%rdx
mov    -0xd0(%rbp),%rcx
mov    -0x38(%rbp),%r8
lea    0xa6d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc0(%rbp),%rdx
xor    %esi,%esi
call   1060 <memset@plt>
mov    %rax,-0x20(%rbp)
mov    0x2734(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xa6a(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movq   $0x0,-0xc8(%rbp)
mov    -0xc8(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jae    1925 <main+0x755>
mov    -0x28(%rbp),%rdx
mov    -0x118(%rbp),%rax
mov    -0xc8(%rbp),%rcx
movslq 0x4(%rax,%rcx,4),%rax
imul   -0x38(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    -0x118(%rbp),%rcx
mov    -0xc8(%rbp),%rsi
movslq (%rcx,%rsi,4),%rcx
imul   -0x38(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xc8(%rbp)
jmp    18b3 <main+0x6e3>
mov    0x269c(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x18(%rbp),%rax
sub    %rax,%rdx
lea    0x9de(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%rdx
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    -0x50(%rbp),%esi
sub    $0x1,%esi
movslq %esi,%rsi
imul   %rsi,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xb4(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
jne    19a0 <main+0x7d0>
mov    $0x1,%edi
lea    0x9be(%rip),%rsi
mov    $0x0,%al
call   1090 <err@plt>
jmp    19b3 <main+0x7e3>
cvtsi2sdl -0x4c(%rbp),%xmm0
lea    0x9c2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cvtsi2sdl -0x64(%rbp),%xmm0
mov    -0x60(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0xc0(%rbp),%r8
lea    0x9c2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10b0 <_rdtsc@plt>
mov    %rax,-0x98(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1a40 <main+0x870>
mov    $0x0,%al
call   10b0 <_rdtsc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1030 <reader@plt>
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   10b0 <_rdtsc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
sub    -0x80(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    19eb <main+0x81b>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
mov    -0x98(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0xa8(%rbp)
movq   -0xa8(%rbp),%xmm0
ff
movaps 0x58b(%rip),%xmm1
movaps %xmm1,-0x160(%rbp)
punpckldq %xmm1,%xmm0
movapd 0x588(%rip),%xmm1
movaps %xmm1,-0x150(%rbp)
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
lea    0x95f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movaps -0x160(%rbp),%xmm2
movaps -0x150(%rbp),%xmm1
movq   -0xa8(%rbp),%xmm0
ff
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x78(%rbp),%xmm0
lea    0x934(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x160,%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,0x38(%rsp)
mov    $0x1000,%ecx
movl   $0x1,0x10(%rsp)
lea    0xfae(%rip),%r14
lea    0xe78(%rip),%r15
mov    %rax,0x20(%rsp)
xor    %edx,%edx
jmp    1267 <main+0x97>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,0x10(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rcx
mov    0x8(%rsp),%edx
mov    %edx,0x8(%rsp)
mov    %rcx,%r12
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10e0 <getopt@plt>
lea    -0x4c(%rax),%edx
cmp    $0x27,%edx
ja     1301 <main+0x131>
mov    $0x200000,%ecx
movslq (%r15,%rdx,4),%rsi
add    %r15,%rsi
mov    $0x1,%edx
jmp    *%rsi
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %rax,0x38(%rsp)
jmp    1260 <main+0x90>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,%r13d
jmp    1260 <main+0x90>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %rax,0x20(%rsp)
jmp    1260 <main+0x90>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,0x64(%rsp)
jmp    1260 <main+0x90>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
call   10f0 <atoi@plt>
mov    %eax,0x14(%rsp)
jmp    1260 <main+0x90>
cmp    $0xffffffff,%eax
je     1320 <main+0x150>
mov    $0x1,%edi
lea    0xee3(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <err@plt>
jmp    1260 <main+0x90>
mov    0x2ca1(%rip),%r14
mov    (%r14),%edi
lea    0xed6(%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    (%r14),%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    0x38(%rsp),%r15
lea    0x0(,%r15,4),%edi
call   10a0 <malloc@plt>
mov    %rax,0x40(%rsp)
test   %rax,%rax
jne    13b8 <main+0x1e8>
mov    (%r14),%edi
lea    0xeb4(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xecc(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0x14(%rsp),%r13d
imul   %r12d,%r13d
or     $0x40,%r13d
movslq 0x20(%rsp),%rax
movslq %r13d,%rcx
mov    %rcx,0x58(%rsp)
imul   %rcx,%rax
mov    %rax,%rcx
or     %r12,%rcx
shr    $0x20,%rcx
mov    %r13d,0x14(%rsp)
je     13f1 <main+0x221>
xor    %edx,%edx
div    %r12
mov    %rax,%rbp
jmp    13f8 <main+0x228>
xor    %edx,%edx
div    %r12d
mov    %eax,%ebp
mov    0x10(%rsp),%r13d
add    $0x2,%rbp
mov    0x20(%rsp),%rax
lea    0x0(,%rax,4),%edi
call   10a0 <malloc@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    1445 <main+0x275>
mov    (%r14),%edi
lea    0xe6b(%rip),%rsi
mov    0x20(%rsp),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xe8c(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
imul   %r12,%rbp
mov    %rbp,0x50(%rsp)
cmp    $0x1,%r15d
jne    147b <main+0x2ab>
cmpl   $0x0,0x20(%rsp)
mov    0x58(%rsp),%r12
jle    171c <main+0x54c>
mov    0x20(%rsp),%rcx
mov    %ecx,%eax
cmp    $0x8,%ecx
jae    15b0 <main+0x3e0>
xor    %ecx,%ecx
jmp    1705 <main+0x535>
mov    0x40(%rsp),%rdi
mov    %r15d,%esi
call   10d0 <rndm_list@plt>
mov    0x20(%rsp),%rcx
mov    %ecx,%eax
cltd
idiv   %r15d
mov    %eax,%r9d
imul   %r15d,%eax
cmp    %ecx,%eax
mov    0x58(%rsp),%r12
mov    %r9d,0x4c(%rsp)
je     14d4 <main+0x304>
mov    (%r14),%edi
lea    0xe2a(%rip),%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xe5c(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0x4c(%rsp),%r9d
test   %r9d,%r9d
jle    171c <main+0x54c>
mov    0x38(%rsp),%rax
lea    -0x1(%rax),%ebx
mov    %eax,%edi
shl    $0x2,%rbx
shl    $0x2,%rdi
mov    0x18(%rsp),%rax
add    $0x4,%rax
mov    %rax,0x68(%rsp)
xor    %r14d,%r14d
mov    $0x1,%r8d
xor    %ecx,%ecx
mov    %r13d,0x10(%rsp)
mov    %rdi,0x70(%rsp)
jmp    1536 <main+0x366>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
cmp    %r9d,%ecx
mov    0x10(%rsp),%r13d
mov    0x58(%rsp),%r12
je     171c <main+0x54c>
cmpl   $0x0,0x38(%rsp)
jle    1520 <main+0x350>
movslq %r14d,%rax
mov    0x68(%rsp),%rsi
lea    (%rsi,%rax,4),%r15
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    155d <main+0x38d>
add    $0x4,%r12
add    $0x1,%r14d
cmp    %r12,%rdi
je     1520 <main+0x350>
cmp    %r12,%rbx
cmove  %r8d,%ebp
mov    0x40(%rsp),%rax
mov    (%rax,%r12,1),%esi
imul   %r9d,%esi
add    %ebp,%esi
add    %ecx,%esi
mov    %esi,(%r15,%r12,1)
cmp    0x20(%rsp),%esi
jl     1550 <main+0x380>
lea    0x1(%r14),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
lea    0xd9e(%rip),%rdi
mov    $0x1,%al
mov    %rcx,%r13
call   1050 <printf@plt>
mov    %r13,%rcx
mov    $0x1,%r8d
mov    0x70(%rsp),%rdi
mov    0x4c(%rsp),%r9d
jmp    1550 <main+0x380>
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
mov    0x18(%rsp),%rbp
jae    15e3 <main+0x413>
movdqa 0xa24(%rip),%xmm0
xor    %edi,%edi
jmp    16b9 <main+0x4e9>
and    $0xfffffffffffffffc,%rsi
movdqa 0xa11(%rip),%xmm0
xor    %edi,%edi
movdqa 0xa16(%rip),%xmm8
movdqa 0xa1d(%rip),%xmm9
movdqa 0xa24(%rip),%xmm10
movdqa 0xa2c(%rip),%xmm4
movdqa 0xa34(%rip),%xmm5
movdqa 0xa3c(%rip),%xmm6
movdqa 0xa44(%rip),%xmm7
movdqa 0xa4c(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm0,%xmm2
paddd  %xmm8,%xmm2
movdqu %xmm0,0x0(%rbp,%rdi,4)
movdqu %xmm2,0x10(%rbp,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm10,%xmm3
movdqu %xmm2,0x20(%rbp,%rdi,4)
movdqu %xmm3,0x30(%rbp,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm4,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm5,%xmm3
movdqu %xmm2,0x40(%rbp,%rdi,4)
movdqu %xmm3,0x50(%rbp,%rdi,4)
movdqa %xmm0,%xmm2
paddd  %xmm6,%xmm2
movdqa %xmm0,%xmm3
paddd  %xmm7,%xmm3
movdqu %xmm2,0x60(%rbp,%rdi,4)
movdqu %xmm3,0x70(%rbp,%rdi,4)
add    $0x20,%rdi
paddd  %xmm1,%xmm0
add    $0xfffffffffffffffc,%rsi
jne    1640 <main+0x470>
test   %rdx,%rdx
je     1700 <main+0x530>
lea    0x10(,%rdi,4),%rsi
add    %rbp,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movdqa 0x939(%rip),%xmm1
movdqa 0x941(%rip),%xmm2
nop
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    16e0 <main+0x510>
cmp    %rax,%rcx
je     171c <main+0x54c>
mov    0x18(%rsp),%rdx
nopw   0x0(%rax,%rax,1)
mov    %ecx,(%rdx,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1710 <main+0x540>
shr    $0x3,%r12
mov    0x18(%rsp),%rax
movl   $0x0,(%rax)
mov    0x28be(%rip),%rax
mov    0x2887(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
xor    %ecx,%ecx
cmpl   $0x1,0x8(%rsp)
mov    0x2865(%rip),%rax
mov    (%rax),%eax
cmove  %eax,%ecx
mov    0x2889(%rip),%rsi
cmove  (%rsi),%eax
mov    0x2857(%rip),%rsi
or     (%rsi),%ecx
or     %eax,%ecx
xor    %edi,%edi
mov    0x50(%rsp),%rbx
mov    %rbx,%rsi
mov    $0xffffffff,%r8d
xor    %r9d,%r9d
call   1040 <mmap@plt>
mov    %rax,%rbp
mov    0x2821(%rip),%rax
cmp    %rbp,(%rax)
mov    0x2837(%rip),%r15
jne    17b7 <main+0x5e7>
mov    (%r15),%edi
lea    0xbab(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xbaa(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
imul   $0x64,%r13d,%eax
mov    %eax,0x40(%rsp)
mov    (%r15),%edi
lea    0xb98(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rcx
shr    $0x3,%rcx
mov    (%r15),%edi
lea    0xb89(%rip),%rsi
mov    %rbx,%rdx
mov    %r12,%r8
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1060 <memset@plt>
mov    (%r15),%edi
lea    0xb9b(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x20(%rsp),%rax
add    $0xffffffff,%eax
movslq %eax,%r14
test   %r14d,%r14d
je     18d5 <main+0x705>
cmp    $0x2,%r14
mov    $0x1,%edx
mov    $0x1,%r8d
cmovae %r14,%r8
mov    0x18(%rsp),%rax
mov    (%rax),%eax
cmp    $0x1,%r14d
je     18ac <main+0x6dc>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
neg    %rsi
mov    $0x1,%edx
mov    0x18(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
movslq (%rbx,%rdx,4),%rdi
imul   %r12,%rdi
lea    0x0(,%rdi,8),%rcx
add    %rbp,%rcx
cltq
imul   %r12,%rax
mov    %rcx,0x0(%rbp,%rax,8)
movslq 0x4(%rbx,%rdx,4),%rax
mov    %rax,%rcx
imul   %r12,%rcx
lea    0x0(,%rcx,8),%rcx
add    %rbp,%rcx
mov    %rcx,0x0(%rbp,%rdi,8)
lea    (%rsi,%rdx,1),%rcx
add    $0x2,%rcx
add    $0x2,%rdx
cmp    $0x1,%rcx
jne    1860 <main+0x690>
test   $0x1,%r8b
je     18d5 <main+0x705>
mov    0x18(%rsp),%rcx
movslq (%rcx,%rdx,4),%rcx
imul   %r12,%rcx
lea    0x0(,%rcx,8),%rcx
add    %rbp,%rcx
cltq
imul   %r12,%rax
mov    %rcx,0x0(%rbp,%rax,8)
cvtsi2sdl 0x40(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    (%r15),%edi
mov    0x0(%rbp,%r14,8),%rdx
sub    %rbp,%rdx
lea    0xad0(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
imul   %r14,%r12
mov    %rbp,0x0(%rbp,%r12,8)
xor    %edi,%edi
mov    0x64(%rsp),%ebx
mov    %ebx,%esi
call   1070 <pin_cpu@plt>
cmp    $0xffffffff,%eax
je     192c <main+0x75c>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
lea    0xae3(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    193f <main+0x76f>
lea    0xab7(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <err@plt>
mov    0x14(%rsp),%ecx
mov    0x50(%rsp),%r8
lea    0xada(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x9c4000,%esi
mov    0x20(%rsp),%rdx
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    %rax,%r15
test   %r13d,%r13d
jle    19b0 <main+0x7e0>
mov    0x40(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
mov    $0x9c4000,%edi
mov    %rbp,%rsi
call   1030 <reader@plt>
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
add    $0xffffffff,%ebx
jne    1990 <main+0x7c0>
movsd  0x8(%rsp),%xmm0
mulsd  0x6f2(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   10b0 <_rdtsc@plt>
sub    %r15,%rax
movq   %rax,%xmm1
punpckldq 0x6b5(%rip),%xmm1
subpd  0x6bd(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
lea    0xaa0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movapd 0x20(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
lea    0xa97(%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 = [67 x i8] c" line count must be a multiple of the fifth argument num_seg = %d\0A\00"
@.str.12 = [16 x i8] c" bad line_count\00"
@.str.13 = [25 x i8] c" count = %d, index = %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.14 = [13 x i8] c"mmap failed\0A\00"
@.str.15 = [12 x i8] c"mmap failed\00"
@.str.16 = [12 x i8] c" buf1 = %p\0A\00"
@.str.17 = [54 x i8] c" buf_size = %zu, zero_loop = %zu, array_stride = %zd\0A\00"
@.str.18 = [32 x i8] c" finished zeroing buf ret = %p\0A\00"
@.str.19 = [39 x i8] c" target of last element in loop = %zx\0A\00"
@.str.20 = [28 x i8] c"cannot set cpu run affinity\00"
@.str.21 = [35 x i8] c" process pinned to core %d to run\0A\00"
@.str.22 = [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.23 = [17 x i8] c" run time = %zd\0A\00"
@.str.24 = [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 i32
%12 = alloca i32
%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 double
%25 = alloca i64
%26 = alloca i64
%27 = alloca i64
%28 = alloca i64
%29 = alloca i64
%30 = alloca i64
%31 = alloca i64
%32 = alloca i32
%33 = alloca i64
%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*
%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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %9
store i32 -1, i32* %18
store i32 0, i32* %19
store i32 10240000, i32* %20
store i32 100, i32* %21
store i32 1, i32* %22
store i32 0, i32* %23
store i64 0, i64* %31
store i32 0, i32* %32
store i32 32, i32* %49
store i32 0, i32* %50
store i64 4096, i64* %39
%53 = load i32, i32* %4
%54 = icmp slt i32 %53, 6
br i1 %54, label %55, label %61
55: ; preds = %2
%56 = load i32, i32* @stderr
%57 = load i32, i32* %4
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([109 x i8], [109 x i8]* @.str, i64 0, i64 0), i32 %57)
%59 = call i32 (...) @usage()
%60 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %55, %2
br label %62
62: ; preds = %91, %61
%63 = load i32, i32* %4
%64 = load i8**, i8*** %5
%65 = call i32 @getopt(i32 %63, i8** %64, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 %65, i32* %45
%66 = icmp ne i32 %65, -1
br i1 %66, label %67, label %92
67: ; preds = %62
%68 = load i32, i32* %45
switch i32 %68, label %88 [
i32 105, label %69
i32 114, label %72
i32 108, label %75
i32 115, label %78
i32 83, label %81
i32 109, label %84
i32 76, label %87
]
69: ; preds = %67
%70 = load i32, i32* @optarg
%71 = call i32 @atoi(i32 %70)
store i32 %71, i32* %14
br label %91
72: ; preds = %67
%73 = load i32, i32* @optarg
%74 = call i32 @atoi(i32 %73)
store i32 %74, i32* %15
br label %91
75: ; preds = %67
%76 = load i32, i32* @optarg
%77 = call i32 @atoi(i32 %76)
store i32 %77, i32* %16
br label %91
78: ; preds = %67
%79 = load i32, i32* @optarg
%80 = call i32 @atoi(i32 %79)
store i32 %80, i32* %17
br label %91
81: ; preds = %67
%82 = load i32, i32* @optarg
%83 = call i32 @atoi(i32 %82)
store i32 %83, i32* %49
br label %91
84: ; preds = %67
%85 = load i32, i32* @optarg
%86 = call i32 @atoi(i32 %85)
store i32 %86, i32* %22
br label %91
87: ; preds = %67
store i32 1, i32* %50
store i64 2097152, i64* %39
br label %91
88: ; preds = %67
%89 = load i32, i32* %45
%90 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %89)
br label %91
91: ; preds = %88, %87, %84, %81, %78, %75, %72, %69
br label %62
92: ; preds = %62
%93 = load i32, i32* %21
%94 = load i32, i32* %22
%95 = mul nsw i32 %93, %94
store i32 %95, i32* %21
store i64 8, i64* %40
%96 = load i32, i32* @stderr
%97 = load i64, i64* %40
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %96, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i64 %97)
%99 = load i32, i32* %32
%100 = load i32, i32* %14
%101 = call i32 @pin_cpu(i32 %99, i32 %100)
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %105
103: ; preds = %92
%104 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %109
105: ; preds = %92
%106 = load i32, i32* @stderr
%107 = load i32, i32* %14
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %106, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %107)
br label %109
109: ; preds = %105, %103
%110 = load i32, i32* %49
%111 = sext i32 %110 to i64
%112 = mul i64 %111, 4
%113 = trunc i64 %112 to i32
%114 = call i64 @malloc(i32 %113)
%115 = inttoptr i64 %114 to i32*
store i32* %115, i32** %43
%116 = load i32*, i32** %43
%117 = icmp eq i32* %116, null
br i1 %117, label %118, label %123
118: ; preds = %109
%119 = load i32, i32* @stderr
%120 = load i32, i32* %49
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %119, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i32 %120)
%122 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
br label %123
123: ; preds = %118, %109
%124 = load i64, i64* %39
%125 = load i32, i32* %17
%126 = sext i32 %125 to i64
%127 = mul i64 %124, %126
%128 = add i64 %127, 64
%129 = trunc i64 %128 to i32
store i32 %129, i32* %17
%130 = load i32, i32* %16
%131 = sext i32 %130 to i64
%132 = load i32, i32* %17
%133 = sext i32 %132 to i64
%134 = mul i64 %131, %133
store i64 %134, i64* %33
%135 = load i64, i64* %33
%136 = load i64, i64* %39
%137 = udiv i64 %135, %136
%138 = add i64 %137, 2
store i64 %138, i64* %38
%139 = load i64, i64* %39
%140 = load i64, i64* %38
%141 = mul i64 %139, %140
store i64 %141, i64* %33
%142 = load i32, i32* %17
%143 = sext i32 %142 to i64
%144 = udiv i64 %143, 8
store i64 %144, i64* %10
%145 = load i32, i32* %21
%146 = sitofp i32 %145 to double
%147 = load i32, i32* %20
%148 = sitofp i32 %147 to double
%149 = fmul double %146, %148
store double %149, double* %24
%150 = load i32, i32* %16
%151 = sext i32 %150 to i64
%152 = mul i64 %151, 4
%153 = trunc i64 %152 to i32
%154 = call i64 @malloc(i32 %153)
%155 = inttoptr i64 %154 to i32*
store i32* %155, i32** %46
%156 = load i32*, i32** %46
%157 = icmp eq i32* %156, null
br i1 %157, label %158, label %163
158: ; preds = %123
%159 = load i32, i32* @stderr
%160 = load i32, i32* %16
%161 = call i32 (i32, i8*, ...) @fprintf(i32 %159, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.9, i64 0, i64 0), i32 %160)
%162 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
br label %163
163: ; preds = %158, %123
%164 = load i32, i32* %49
%165 = icmp eq i32 %164, 1
br i1 %165, label %166, label %181
166: ; preds = %163
store i32 0, i32* %11
br label %167
167: ; preds = %177, %166
%168 = load i32, i32* %11
%169 = load i32, i32* %16
%170 = icmp slt i32 %168, %169
br i1 %170, label %171, label %180
171: ; preds = %167
%172 = load i32, i32* %11
%173 = load i32*, i32** %46
%174 = load i32, i32* %11
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i32, i32* %173, i64 %175
store i32 %172, i32* %176
br label %177
177: ; preds = %171
%178 = load i32, i32* %11
%179 = add nsw i32 %178, 1
store i32 %179, i32* %11
br label %167
180: ; preds = %167
br label %264
181: ; preds = %163
%182 = load i32*, i32** %43
%183 = load i32, i32* %49
%184 = call i32 @rndm_list(i32* %182, i32 %183)
%185 = load i32, i32* %16
%186 = load i32, i32* %49
%187 = sdiv i32 %185, %186
store i32 %187, i32* %47
%188 = load i32, i32* %47
%189 = load i32, i32* %49
%190 = mul nsw i32 %188, %189
%191 = load i32, i32* %16
%192 = icmp ne i32 %190, %191
br i1 %192, label %193, label %198
193: ; preds = %181
%194 = load i32, i32* @stderr
%195 = load i32, i32* %49
%196 = call i32 (i32, i8*, ...) @fprintf(i32 %194, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0), i32 %195)
%197 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %198
198: ; preds = %193, %181
store i32 0, i32* %48
%199 = load i64, i64* %33
%200 = load i32, i32* %49
%201 = sext i32 %200 to i64
%202 = udiv i64 %199, %201
store i64 %202, i64* %36
store i32 0, i32* %11
br label %203
203: ; preds = %260, %198
%204 = load i32, i32* %11
%205 = load i32, i32* %47
%206 = icmp slt i32 %204, %205
br i1 %206, label %207, label %263
207: ; preds = %203
store i32 0, i32* %44
store i32 0, i32* %12
br label %208
208: ; preds = %256, %207
%209 = load i32, i32* %12
%210 = load i32, i32* %49
%211 = icmp slt i32 %209, %210
br i1 %211, label %212, label %259
212: ; preds = %208
%213 = load i32, i32* %48
%214 = add nsw i32 %213, 1
store i32 %214, i32* %48
%215 = load i32, i32* %12
%216 = load i32, i32* %49
%217 = sub nsw i32 %216, 1
%218 = icmp eq i32 %215, %217
br i1 %218, label %219, label %220
219: ; preds = %212
store i32 1, i32* %44
br label %220
220: ; preds = %219, %212
%221 = load i32, i32* %47
%222 = load i32*, i32** %43
%223 = load i32, i32* %12
%224 = sext i32 %223 to i64
%225 = getelementptr inbounds i32, i32* %222, i64 %224
%226 = load i32, i32* %225
%227 = mul nsw i32 %221, %226
%228 = sext i32 %227 to i64
store i64 %228, i64* %37
%229 = load i64, i64* %37
%230 = trunc i64 %229 to i32
%231 = load i32, i32* %11
%232 = add nsw i32 %230, %231
%233 = load i32, i32* %44
%234 = add nsw i32 %232, %233
%235 = load i32*, i32** %46
%236 = load i32, i32* %48
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds i32, i32* %235, i64 %237
store i32 %234, i32* %238
%239 = load i32*, i32** %46
%240 = load i32, i32* %48
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds i32, i32* %239, i64 %241
%243 = load i32, i32* %242
%244 = load i32, i32* %16
%245 = icmp sge i32 %243, %244
br i1 %245, label %246, label %255
246: ; preds = %220
%247 = load i32, i32* %48
%248 = sitofp i32 %247 to double
%249 = load i32*, i32** %46
%250 = load i32, i32* %48
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i32, i32* %249, i64 %251
%253 = load i32, i32* %252
%254 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0), double %248, i32 %253)
br label %255
255: ; preds = %246, %220
br label %256
256: ; preds = %255
%257 = load i32, i32* %12
%258 = add nsw i32 %257, 1
store i32 %258, i32* %12
br label %208
259: ; preds = %208
br label %260
260: ; preds = %259
%261 = load i32, i32* %11
%262 = add nsw i32 %261, 1
store i32 %262, i32* %11
br label %203
263: ; preds = %203
br label %264
264: ; preds = %263, %180
%265 = load i32*, i32** %46
%266 = getelementptr inbounds i32, i32* %265, i64 0
store i32 0, i32* %266
%267 = load i32, i32* %50
%268 = icmp eq i32 %267, 0
br i1 %268, label %269, label %281
269: ; preds = %264
%270 = load i64, i64* %33
%271 = load i32, i32* @PROT_READ
%272 = load i32, i32* @PROT_WRITE
%273 = or i32 %271, %272
%274 = load i32, i32* @MAP_PRIVATE
%275 = load i32, i32* @MAP_ANON
%276 = or i32 %274, %275
%277 = load i32, i32* %18
%278 = load i32, i32* %19
%279 = call i64 @mmap(i32* null, i64 %270, i32 %273, i32 %276, i32 %277, i32 %278)
%280 = inttoptr i64 %279 to i8*
store i8* %280, i8** %6
br label %281
281: ; preds = %269, %264
%282 = load i32, i32* %50
%283 = icmp eq i32 %282, 1
br i1 %283, label %284, label %298
284: ; preds = %281
%285 = load i64, i64* %33
%286 = load i32, i32* @PROT_READ
%287 = load i32, i32* @PROT_WRITE
%288 = or i32 %286, %287
%289 = load i32, i32* @MAP_PRIVATE
%290 = load i32, i32* @MAP_ANON
%291 = or i32 %289, %290
%292 = load i32, i32* @MAP_HUGETLB
%293 = or i32 %291, %292
%294 = load i32, i32* %18
%295 = load i32, i32* %19
%296 = call i64 @mmap(i32* null, i64 %285, i32 %288, i32 %293, i32 %294, i32 %295)
%297 = inttoptr i64 %296 to i8*
store i8* %297, i8** %6
br label %298
298: ; preds = %284, %281
%299 = load i8*, i8** %6
%300 = load i8*, i8** @MAP_FAILED
%301 = icmp eq i8* %299, %300
br i1 %301, label %302, label %306
302: ; preds = %298
%303 = load i32, i32* @stderr
%304 = call i32 (i32, i8*, ...) @fprintf(i32 %303, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%305 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %306
306: ; preds = %302, %298
%307 = load i32, i32* @stderr
%308 = load i8*, i8** %6
%309 = call i32 (i32, i8*, ...) @fprintf(i32 %307, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %308)
%310 = load i64, i64* %33
%311 = load i64, i64* %40
%312 = udiv i64 %310, %311
store i64 %312, i64* %35
%313 = load i32, i32* @stderr
%314 = load i64, i64* %33
%315 = load i64, i64* %35
%316 = load i64, i64* %10
%317 = call i32 (i32, i8*, ...) @fprintf(i32 %313, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.17, i64 0, i64 0), i64 %314, i64 %315, i64 %316)
%318 = load i8*, i8** %6
%319 = bitcast i8* %318 to i64*
store i64* %319, i64** %8
%320 = load i8*, i8** %6
%321 = load i64, i64* %33
%322 = call i8* @memset(i8* %320, i32 0, i64 %321)
store i8* %322, i8** %7
%323 = load i32, i32* @stderr
%324 = load i8*, i8** %7
%325 = call i32 (i32, i8*, ...) @fprintf(i32 %323, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.18, i64 0, i64 0), i8* %324)
store i64 0, i64* %34
br label %326
326: ; preds = %353, %306
%327 = load i64, i64* %34
%328 = load i32, i32* %16
%329 = sub nsw i32 %328, 1
%330 = sext i32 %329 to i64
%331 = icmp ult i64 %327, %330
br i1 %331, label %332, label %356
332: ; preds = %326
%333 = load i64*, i64** %8
%334 = load i32*, i32** %46
%335 = load i64, i64* %34
%336 = add i64 %335, 1
%337 = getelementptr inbounds i32, i32* %334, i64 %336
%338 = load i32, i32* %337
%339 = sext i32 %338 to i64
%340 = load i64, i64* %10
%341 = mul i64 %339, %340
%342 = getelementptr inbounds i64, i64* %333, i64 %341
%343 = ptrtoint i64* %342 to i64
%344 = load i64*, i64** %8
%345 = load i32*, i32** %46
%346 = load i64, i64* %34
%347 = getelementptr inbounds i32, i32* %345, i64 %346
%348 = load i32, i32* %347
%349 = sext i32 %348 to i64
%350 = load i64, i64* %10
%351 = mul i64 %349, %350
%352 = getelementptr inbounds i64, i64* %344, i64 %351
store i64 %343, i64* %352
br label %353
353: ; preds = %332
%354 = load i64, i64* %34
%355 = add i64 %354, 1
store i64 %355, i64* %34
br label %326
356: ; preds = %326
%357 = load i32, i32* @stderr
%358 = load i64*, i64** %8
%359 = load i32, i32* %16
%360 = sub nsw i32 %359, 1
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds i64, i64* %358, i64 %361
%363 = load i64, i64* %362
%364 = load i8*, i8** %6
%365 = ptrtoint i8* %364 to i64
%366 = sub i64 %363, %365
%367 = call i32 (i32, i8*, ...) @fprintf(i32 %357, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.19, i64 0, i64 0), i64 %366)
%368 = load i64*, i64** %8
%369 = getelementptr inbounds i64, i64* %368, i64 0
%370 = ptrtoint i64* %369 to i64
%371 = load i64*, i64** %8
%372 = load i64, i64* %10
%373 = load i32, i32* %16
%374 = sub nsw i32 %373, 1
%375 = sext i32 %374 to i64
%376 = mul i64 %372, %375
%377 = getelementptr inbounds i64, i64* %371, i64 %376
store i64 %370, i64* %377
%378 = load i32, i32* %32
%379 = load i32, i32* %15
%380 = call i32 @pin_cpu(i32 %378, i32 %379)
%381 = icmp eq i32 %380, -1
br i1 %381, label %382, label %384
382: ; preds = %356
%383 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %388
384: ; preds = %356
%385 = load i32, i32* %15
%386 = sitofp i32 %385 to double
%387 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.21, i64 0, i64 0), double %386)
br label %388
388: ; preds = %384, %382
%389 = load i32, i32* %21
%390 = sitofp i32 %389 to double
%391 = load i32, i32* %20
%392 = load i32, i32* %16
%393 = load i32, i32* %17
%394 = load i64, i64* %33
%395 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.22, i64 0, i64 0), double %390, i32 %391, i32 %392, i32 %393, i64 %394)
%396 = call i64 (...) @_rdtsc()
store i64 %396, i64* %28
store i32 0, i32* %11
br label %397
397: ; preds = %410, %388
%398 = load i32, i32* %11
%399 = load i32, i32* %21
%400 = icmp slt i32 %398, %399
br i1 %400, label %401, label %413
401: ; preds = %397
%402 = call i64 (...) @_rdtsc()
store i64 %402, i64* %25
%403 = load i32, i32* %20
%404 = load i64*, i64** %8
%405 = call i64 @reader(i32 %403, i64* %404)
store i64 %405, i64* %9
%406 = call i64 (...) @_rdtsc()
store i64 %406, i64* %26
%407 = load i64, i64* %26
%408 = load i64, i64* %25
%409 = sub i64 %407, %408
store i64 %409, i64* %27
br label %410
410: ; preds = %401
%411 = load i32, i32* %11
%412 = add nsw i32 %411, 1
store i32 %412, i32* %11
br label %397
413: ; preds = %397
%414 = call i64 (...) @_rdtsc()
store i64 %414, i64* %29
%415 = load i64, i64* %29
%416 = load i64, i64* %28
%417 = sub i64 %415, %416
store i64 %417, i64* %30
%418 = load i64, i64* %30
%419 = uitofp i64 %418 to double
%420 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), double %419)
%421 = load i64, i64* %30
%422 = uitofp i64 %421 to double
%423 = load double, double* %24
%424 = fdiv double %422, %423
%425 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.24, i64 0, i64 0), double %424)
%426 = load i32, i32* %23
ret i32 %426
}

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 = [67 x i8] c" line count must be a multiple of the fifth argument num_seg = %d\0A\00"
@.str.12 = [16 x i8] c" bad line_count\00"
@.str.13 = [25 x i8] c" count = %d, index = %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.14 = [13 x i8] c"mmap failed\0A\00"
@.str.15 = [12 x i8] c"mmap failed\00"
@.str.16 = [12 x i8] c" buf1 = %p\0A\00"
@.str.17 = [54 x i8] c" buf_size = %zu, zero_loop = %zu, array_stride = %zd\0A\00"
@.str.18 = [32 x i8] c" finished zeroing buf ret = %p\0A\00"
@.str.19 = [39 x i8] c" target of last element in loop = %zx\0A\00"
@.str.20 = [28 x i8] c"cannot set cpu run affinity\00"
@.str.21 = [35 x i8] c" process pinned to core %d to run\0A\00"
@.str.22 = [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.23 = [17 x i8] c" run time = %zd\0A\00"
@.str.24 = [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 = icmp eq i32 %17, 1
br i1 %90, label %91, label %166
91: ; preds = %89
%92 = icmp sgt i32 %14, 0
br i1 %92, label %93, label %214
93: ; preds = %91
%94 = zext i32 %14 to i64
%95 = icmp ult i32 %14, 8
br i1 %95, label %158, label %96
96: ; preds = %93
%97 = and i64 %94, 4294967288
%98 = add nsw i64 %97, -8
%99 = lshr exact i64 %98, 3
%100 = add nuw nsw i64 %99, 1
%101 = and i64 %100, 3
%102 = icmp ult i64 %98, 24
br i1 %102, label %139, label %103
103: ; preds = %96
%104 = and i64 %100, 4611686018427387900
br label %105
105: ; preds = %105, %103
%106 = phi i64 [ 0, %103 ], [ %135, %105 ]
%107 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %103 ], [ %136, %105 ]
%108 = phi i64 [ 0, %103 ], [ %137, %105 ]
%109 = add <4 x i32> %107, <i32 4, i32 4, i32 4, i32 4>
%110 = getelementptr inbounds i32, i32* %83, i64 %106
%111 = bitcast i32* %110 to <4 x i32>*
store <4 x i32> %107, <4 x i32>* %111
%112 = getelementptr inbounds i32, i32* %110, i64 4
%113 = bitcast i32* %112 to <4 x i32>*
store <4 x i32> %109, <4 x i32>* %113
%114 = or i64 %106, 8
%115 = add <4 x i32> %107, <i32 8, i32 8, i32 8, i32 8>
%116 = add <4 x i32> %107, <i32 12, i32 12, i32 12, i32 12>
%117 = getelementptr inbounds i32, i32* %83, i64 %114
%118 = bitcast i32* %117 to <4 x i32>*
store <4 x i32> %115, <4 x i32>* %118
%119 = getelementptr inbounds i32, i32* %117, i64 4
%120 = bitcast i32* %119 to <4 x i32>*
store <4 x i32> %116, <4 x i32>* %120
%121 = or i64 %106, 16
%122 = add <4 x i32> %107, <i32 16, i32 16, i32 16, i32 16>
%123 = add <4 x i32> %107, <i32 20, i32 20, i32 20, i32 20>
%124 = getelementptr inbounds i32, i32* %83, i64 %121
%125 = bitcast i32* %124 to <4 x i32>*
store <4 x i32> %122, <4 x i32>* %125
%126 = getelementptr inbounds i32, i32* %124, i64 4
%127 = bitcast i32* %126 to <4 x i32>*
store <4 x i32> %123, <4 x i32>* %127
%128 = or i64 %106, 24
%129 = add <4 x i32> %107, <i32 24, i32 24, i32 24, i32 24>
%130 = add <4 x i32> %107, <i32 28, i32 28, i32 28, i32 28>
%131 = getelementptr inbounds i32, i32* %83, i64 %128
%132 = bitcast i32* %131 to <4 x i32>*
store <4 x i32> %129, <4 x i32>* %132
%133 = getelementptr inbounds i32, i32* %131, i64 4
%134 = bitcast i32* %133 to <4 x i32>*
store <4 x i32> %130, <4 x i32>* %134
%135 = add nuw i64 %106, 32
%136 = add <4 x i32> %107, <i32 32, i32 32, i32 32, i32 32>
%137 = add i64 %108, 4
%138 = icmp eq i64 %137, %104
br i1 %138, label %139, label %105
139: ; preds = %105, %96
%140 = phi i64 [ 0, %96 ], [ %135, %105 ]
%141 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %96 ], [ %136, %105 ]
%142 = icmp eq i64 %101, 0
br i1 %142, label %156, label %143
143: ; preds = %139, %143
%144 = phi i64 [ %152, %143 ], [ %140, %139 ]
%145 = phi <4 x i32> [ %153, %143 ], [ %141, %139 ]
%146 = phi i64 [ %154, %143 ], [ 0, %139 ]
%147 = add <4 x i32> %145, <i32 4, i32 4, i32 4, i32 4>
%148 = getelementptr inbounds i32, i32* %83, i64 %144
%149 = bitcast i32* %148 to <4 x i32>*
store <4 x i32> %145, <4 x i32>* %149
%150 = getelementptr inbounds i32, i32* %148, i64 4
%151 = bitcast i32* %150 to <4 x i32>*
store <4 x i32> %147, <4 x i32>* %151
%152 = add nuw i64 %144, 8
%153 = add <4 x i32> %145, <i32 8, i32 8, i32 8, i32 8>
%154 = add i64 %146, 1
%155 = icmp eq i64 %154, %101
br i1 %155, label %156, label %143
156: ; preds = %143, %139
%157 = icmp eq i64 %97, %94
br i1 %157, label %214, label %158
158: ; preds = %93, %156
%159 = phi i64 [ 0, %93 ], [ %97, %156 ]
br label %160
160: ; preds = %158, %160
%161 = phi i64 [ %164, %160 ], [ %159, %158 ]
%162 = getelementptr inbounds i32, i32* %83, i64 %161
%163 = trunc i64 %161 to i32
store i32 %163, i32* %162
%164 = add nuw nsw i64 %161, 1
%165 = icmp eq i64 %164, %94
br i1 %165, label %214, label %160
166: ; preds = %89
%167 = tail call i32 @rndm_list(i32* %63, i32 %17)
%168 = sdiv i32 %14, %17
%169 = mul nsw i32 %168, %17
%170 = icmp eq i32 %169, %14
br i1 %170, label %175, label %171
171: ; preds = %166
%172 = load i32, i32* @stderr
%173 = tail call i32 (i32, i8*, ...) @fprintf(i32 %172, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.11, i64 0, i64 0), i32 %17)
%174 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %175
175: ; preds = %171, %166
%176 = icmp sgt i32 %168, 0
br i1 %176, label %177, label %214
177: ; preds = %175
%178 = icmp sgt i32 %17, 0
%179 = add nsw i32 %17, -1
%180 = zext i32 %179 to i64
%181 = zext i32 %17 to i64
br label %182
182: ; preds = %177, %210
%183 = phi i32 [ 0, %177 ], [ %211, %210 ]
%184 = phi i32 [ 0, %177 ], [ %212, %210 ]
br i1 %178, label %185, label %210
185: ; preds = %182
%186 = sext i32 %183 to i64
br label %187
187: ; preds = %185, %205
%188 = phi i64 [ 0, %185 ], [ %206, %205 ]
%189 = phi i64 [ %186, %185 ], [ %191, %205 ]
%190 = phi i32 [ 0, %185 ], [ %193, %205 ]
%191 = add nsw i64 %189, 1
%192 = icmp eq i64 %188, %180
%193 = select i1 %192, i32 1, i32 %190
%194 = getelementptr inbounds i32, i32* %63, i64 %188
%195 = load i32, i32* %194
%196 = mul nsw i32 %195, %168
%197 = add i32 %193, %184
%198 = add i32 %197, %196
%199 = getelementptr inbounds i32, i32* %83, i64 %191
store i32 %198, i32* %199
%200 = icmp slt i32 %198, %14
br i1 %200, label %205, label %201
201: ; preds = %187
%202 = trunc i64 %191 to i32
%203 = sitofp i32 %202 to double
%204 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0), double %203, i32 %198)
br label %205
205: ; preds = %187, %201
%206 = add nuw nsw i64 %188, 1
%207 = icmp eq i64 %206, %181
br i1 %207, label %208, label %187
208: ; preds = %205
%209 = trunc i64 %191 to i32
br label %210
210: ; preds = %208, %182
%211 = phi i32 [ %183, %182 ], [ %209, %208 ]
%212 = add nuw nsw i32 %184, 1
%213 = icmp eq i32 %212, %168
br i1 %213, label %214, label %182
214: ; preds = %210, %160, %156, %175, %91
store i32 0, i32* %83
%215 = icmp eq i32 %18, 1
%216 = load i32, i32* @PROT_READ
%217 = load i32, i32* @PROT_WRITE
%218 = or i32 %217, %216
%219 = load i32, i32* @MAP_ANON
%220 = load i32, i32* @MAP_PRIVATE
%221 = select i1 %215, i32 %220, i32 0
%222 = or i32 %219, %221
%223 = load i32, i32* @MAP_HUGETLB
%224 = select i1 %215, i32 %223, i32 %220
%225 = or i32 %222, %224
%226 = tail call i64 @mmap(i32* null, i64 %78, i32 %218, i32 %225, i32 -1, i32 0)
%227 = inttoptr i64 %226 to i8*
%228 = load i8*, i8** @MAP_FAILED
%229 = icmp eq i8* %228, %227
br i1 %229, label %230, label %234
230: ; preds = %214
%231 = load i32, i32* @stderr
%232 = tail call i32 (i32, i8*, ...) @fprintf(i32 %231, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0))
%233 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %234
234: ; preds = %230, %214
%235 = load i32, i32* @stderr
%236 = tail call i32 (i32, i8*, ...) @fprintf(i32 %235, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.16, i64 0, i64 0), i8* %227)
%237 = lshr exact i64 %78, 3
%238 = load i32, i32* @stderr
%239 = tail call i32 (i32, i8*, ...) @fprintf(i32 %238, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.17, i64 0, i64 0), i64 %78, i64 %237, i64 %79)
%240 = inttoptr i64 %226 to i64*
tail call void @llvm.memset.p0i8.i64(i8* align 1 %227, i8 0, i64 %78, i1 false)
%241 = load i32, i32* @stderr
%242 = tail call i32 (i32, i8*, ...) @fprintf(i32 %241, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.18, i64 0, i64 0), i8* %227)
%243 = add nsw i32 %14, -1
%244 = sext i32 %243 to i64
%245 = icmp eq i32 %243, 0
br i1 %245, label %295, label %246
246: ; preds = %234
%247 = call i64 @llvm.umax.i64(i64 %244, i64 1)
%248 = load i32, i32* %83
%249 = and i64 %247, 1
%250 = icmp eq i32 %243, 1
br i1 %250, label %281, label %251
251: ; preds = %246
%252 = and i64 %247, -2
br label %253
253: ; preds = %253, %251
%254 = phi i32 [ %248, %251 ], [ %269, %253 ]
%255 = phi i64 [ 0, %251 ], [ %267, %253 ]
%256 = phi i64 [ 0, %251 ], [ %277, %253 ]
%257 = or i64 %255, 1
%258 = getelementptr inbounds i32, i32* %83, i64 %257
%259 = load i32, i32* %258
%260 = sext i32 %259 to i64
%261 = mul i64 %79, %260
%262 = getelementptr inbounds i64, i64* %240, i64 %261
%263 = ptrtoint i64* %262 to i64
%264 = sext i32 %254 to i64
%265 = mul i64 %79, %264
%266 = getelementptr inbounds i64, i64* %240, i64 %265
store i64 %263, i64* %266
%267 = add nuw i64 %255, 2
%268 = getelementptr inbounds i32, i32* %83, i64 %267
%269 = load i32, i32* %268
%270 = sext i32 %269 to i64
%271 = mul i64 %79, %270
%272 = getelementptr inbounds i64, i64* %240, i64 %271
%273 = ptrtoint i64* %272 to i64
%274 = sext i32 %259 to i64
%275 = mul i64 %79, %274
%276 = getelementptr inbounds i64, i64* %240, i64 %275
store i64 %273, i64* %276
%277 = add i64 %256, 2
%278 = icmp eq i64 %277, %252
br i1 %278, label %279, label %253
279: ; preds = %253
%280 = add i64 %255, 3
br label %281
281: ; preds = %279, %246
%282 = phi i32 [ %248, %246 ], [ %269, %279 ]
%283 = phi i64 [ 1, %246 ], [ %280, %279 ]
%284 = icmp eq i64 %249, 0
br i1 %284, label %295, label %285
285: ; preds = %281
%286 = getelementptr inbounds i32, i32* %83, i64 %283
%287 = load i32, i32* %286
%288 = sext i32 %287 to i64
%289 = mul i64 %79, %288
%290 = getelementptr inbounds i64, i64* %240, i64 %289
%291 = ptrtoint i64* %290 to i64
%292 = sext i32 %282 to i64
%293 = mul i64 %79, %292
%294 = getelementptr inbounds i64, i64* %240, i64 %293
store i64 %291, i64* %294
br label %295
295: ; preds = %285, %281, %234
%296 = load i32, i32* @stderr
%297 = getelementptr inbounds i64, i64* %240, i64 %244
%298 = load i64, i64* %297
%299 = sub i64 %298, %226
%300 = tail call i32 (i32, i8*, ...) @fprintf(i32 %296, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.19, i64 0, i64 0), i64 %299)
%301 = mul i64 %79, %244
%302 = getelementptr inbounds i64, i64* %240, i64 %301
store i64 %226, i64* %302
%303 = tail call i32 @pin_cpu(i32 0, i32 %15)
%304 = icmp eq i32 %303, -1
br i1 %304, label %305, label %307
305: ; preds = %295
%306 = tail call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %310
307: ; preds = %295
%308 = sitofp i32 %15 to double
%309 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.21, i64 0, i64 0), double %308)
br label %310
310: ; preds = %307, %305
%311 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([115 x i8], [115 x i8]* @.str.22, i64 0, i64 0), double %80, i32 10240000, i32 %14, i32 %72, i64 %78)
%312 = tail call i64 (...) @_rdtsc()
%313 = icmp sgt i32 %11, 0
br i1 %313, label %314, label %323
314: ; preds = %310
%315 = call i32 @llvm.smax.i32(i32 %50, i32 1)
br label %316
316: ; preds = %314, %316
%317 = phi i32 [ %321, %316 ], [ 0, %314 ]
%318 = tail call i64 (...) @_rdtsc()
%319 = tail call i64 @reader(i32 10240000, i64* %240)
%320 = tail call i64 (...) @_rdtsc()
%321 = add nuw nsw i32 %317, 1
%322 = icmp eq i32 %321, %315
br i1 %322, label %323, label %316
323: ; preds = %316, %310
%324 = fmul double %80, 1.024000e+07
%325 = tail call i64 (...) @_rdtsc()
%326 = sub i64 %325, %312
%327 = uitofp i64 %326 to double
%328 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i64 0, i64 0), double %327)
%329 = fdiv double %327, %324
%330 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.24, i64 0, i64 0), double %329)
ret i32 0
}