LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_profiler.c
// Function: mctop_prof_stats_calc
void
mctop_prof_stats_calc(mctop_prof_t* prof, mctop_prof_stats_t* stats)
{
  qsort(prof->latencies, prof->size, sizeof(ticks), mctop_prof_comp_ticks);
  stats->num_vals = prof->size;
  
  stats->median = prof->latencies[prof->size >> 1];
  const size_t median2x = 2 * stats->median;
  size_t n_elems = 0;
  ticks sum = 0;
  for (size_t i = 0; i < stats->num_vals; i++)
    {
      if (likely(prof->latencies[i] < median2x))
	{
	  sum += prof->latencies[i];
	  n_elems++;
	}
    }

  const ticks avg = sum / n_elems;;
  stats->avg = avg;

  ticks sum_diff_sqr = 0;
  for (size_t i = 0; i < stats->num_vals; i++)
    {
      if (likely(prof->latencies[i] < median2x))
	{
	  ticks adiff = mctop_prof_abs_diff(prof->latencies[i], avg);
	  sum_diff_sqr += (adiff * adiff);
	}
    }
  stats->std_dev = sqrt(sum_diff_sqr / n_elems);
  stats->std_dev_perc = 100 * (1 - (avg - stats->std_dev) / avg);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x40(%rdi), %r14
movq (%rdi), %rsi
leaq 0x10b(%rip), %rcx       # 0x5ad9
movl $0x8, %edx
movq %r14, %rdi
callq 0x20a0
movq (%r15), %rsi
movq %rsi, (%rbx)
movq %rsi, %rax
andq $-0x2, %rax
movq 0x40(%r15,%rax,4), %rdi
movq %rdi, 0x8(%rbx)
testq %rsi, %rsi
je 0x5aa5
addq %rdi, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
xorl %edx, %edx
movq (%r14,%rdx,8), %r9
cmpq %rdi, %r9
cmovaeq %rcx, %r9
adcq $0x0, %r8
addq %r9, %rax
incq %rdx
cmpq %rdx, %rsi
jne 0x5a06
xorl %r9d, %r9d
xorl %edx, %edx
divq %r8
movq %rax, %rcx
movq %rax, 0x10(%rbx)
xorl %eax, %eax
movq (%r14,%r9,8), %rdx
cmpq %rdi, %rdx
jae 0x5a54
movq %rcx, %r10
subq %rdx, %r10
negq %r10
movq %rcx, %r11
subq %rdx, %r11
cmovbq %r10, %r11
imulq %r11, %r11
addq %r11, %rax
incq %r9
cmpq %r9, %rsi
jne 0x5a31
xorl %edx, %edx
divq %r8
movq %rax, %xmm1
movq 0x45e2(%rip), %xmm2     # 0xa050
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x45e6(%rip), %xmm3     # 0xa060
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movq %rcx, %xmm4
punpckldq %xmm2, %xmm4    # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
subpd %xmm3, %xmm4
movapd %xmm4, %xmm1
unpckhpd %xmm4, %xmm1            # xmm1 = xmm1[1],xmm4[1]
addsd %xmm4, %xmm1
jmp 0x5aa5
sqrtsd %xmm0, %xmm0
movsd %xmm0, 0x18(%rbx)
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
divsd %xmm1, %xmm2
movsd 0x5cf6(%rip), %xmm0     # 0xb7b8
subsd %xmm2, %xmm0
mulsd 0x453a(%rip), %xmm0     # 0xa008
movsd %xmm0, 0x20(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_profiler.c
// Function: mctop_prof_stats_print
void
mctop_prof_stats_print(mctop_prof_stats_t* stats)
{
  printf("## mctop_prof stats #######\n");
  printf("# #Values       = %zu\n", stats->num_vals);
  printf("# Average       = %zu\n", stats->avg);
  printf("# Median        = %zu\n", stats->median);
  printf("# Std dev       = %.2f\n", stats->std_dev);
  printf("# Std dev%%      = %.2f%%\n", stats->std_dev_perc);
  printf("###########################\n");
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x5d43(%rip), %rdi      # 0xb840
callq 0x2080
movq (%rbx), %rsi
leaq 0x5cbc(%rip), %rdi      # 0xb7c8
xorl %eax, %eax
callq 0x2100
movq 0x10(%rbx), %rsi
leaq 0x5cc1(%rip), %rdi      # 0xb7df
xorl %eax, %eax
callq 0x2100
movq 0x8(%rbx), %rsi
leaq 0x5cc6(%rip), %rdi      # 0xb7f6
xorl %eax, %eax
callq 0x2100
movsd 0x18(%rbx), %xmm0
leaq 0x5cca(%rip), %rdi      # 0xb80d
movb $0x1, %al
callq 0x2100
movsd 0x20(%rbx), %xmm0
leaq 0x5ccf(%rip), %rdi      # 0xb825
movb $0x1, %al
callq 0x2100
leaq 0x5eff(%rip), %rdi      # 0xba63
popq %rbx
jmp 0x2080
nop
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/helper.c
// Function: get_num_hw_ctx
int
get_num_hw_ctx()
{
#ifdef __x86_64__
  cpu_set_t mask;
  CPU_ZERO(&mask);
#endif

  int nc = 0;
  while (1)
    {
      if (!mctop_set_cpu(NULL, nc))
  	{
  	  break;
  	}
#ifdef __x86_64__
      CPU_SET(nc, &mask);
#endif
      nc++;
    }

#ifdef __x86_64__
  sched_setaffinity(0, sizeof(cpu_set_t), &mask);
#elif defined(__sparc)
  processor_bind(P_LWPID, P_MYID, PBIND_NONE, NULL);
#endif
  
  return nc;
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
xorl %ebx, %ebx
xorl %edi, %edi
xorl %esi, %esi
callq 0x2998
testl %eax, %eax
je 0x5bdd
xorl %ebx, %ebx
cmpq $0x3ff, %rbx            # imm = 0x3FF
ja 0x5bcd
movl $0x1, %eax
movl %ebx, %ecx
shlq %cl, %rax
movq %rbx, %rcx
shrq $0x6, %rcx
orq %rax, (%rsp,%rcx,8)
incq %rbx
xorl %edi, %edi
movl %ebx, %esi
callq 0x2998
testl %eax, %eax
jne 0x5baf
movq %rsp, %rdx
movl $0x80, %esi
xorl %edi, %edi
callq 0x2130
movl %ebx, %eax
addq $0x80, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/helper.c
// Function: ll_random_traverse
ticks
ll_random_traverse(volatile uint64_t* list, const size_t reps)
{
  volatile ticks __s = getticks();
  for (size_t r = 0; r < reps; r++)
    {
      list = (uint64_t*) *list;
    }
  volatile ticks __e = getticks();
  assert(list != NULL);
  return (__e - __s) / reps;
}

// Assembly:
subq $0x18, %rsp
rdtsc
movl %eax, %eax
shlq $0x20, %rdx
orq %rax, %rdx
movq %rdx, 0x10(%rsp)
testq %rsi, %rsi
je 0x5c40
movq %rsi, %rax
movq (%rdi), %rdi
decq %rax
jne 0x5c38
rdtsc
movl %eax, %eax
shlq $0x20, %rdx
orq %rax, %rdx
movq %rdx, 0x8(%rsp)
testq %rdi, %rdi
je 0x5c69
movq 0x8(%rsp), %rax
subq 0x10(%rsp), %rax
xorl %edx, %edx
divq %rsi
addq $0x18, %rsp
retq
leaq 0x5bf8(%rip), %rdi      # 0xb868
leaq 0x5bfe(%rip), %rsi      # 0xb875
leaq 0x5c04(%rip), %rcx      # 0xb882
movl $0x41, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/helper.c
// Function: ll_random_create
void
ll_random_create(volatile uint64_t* mem, const size_t size)
{
  const size_t size_cl = size / CACHE_LINE_SIZE;
  const size_t per_cl = CACHE_LINE_SIZE / sizeof(uint64_t);
  uint8_t* used = calloc_assert(size_cl, sizeof(uint8_t));
  unsigned long* seeds = seeds_create();
  seeds[0] = 0x0123456789ABCDLL;
  seeds[1] = 0xA023457689BAC0LL;
  seeds[2] = 0xB0245736F9BAC1LL;

  size_t idx = 0;
  size_t used_num = 0;
  while (used_num < size_cl - 1)
    {
      used[idx] = 1;
      used_num++;

      size_t nxt;
      do
	{
	  nxt = (marsaglia_rand(seeds) % size_cl);
	}
      while (used[nxt]);

      size_t nxt_8 = (nxt * per_cl);
      size_t idx_8 = (idx * per_cl);
      mem[idx_8] = (uint64_t) (mem + nxt_8);
      idx = nxt;
    }

  mem[idx * per_cl] = (volatile uint64_t) mem;
  /* mem[idx * per_cl] = 0; */

  free(seeds);
  free(used);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
shrq $0x6, %r14
movl $0x1, %esi
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x5d4c
movq %rax, %rdi
movq %r14, %rsi
decq %rsi
je 0x5d3c
movabsq $0x123456789abcd, %r9   # imm = 0x123456789ABCD
movabsq $0xa023457689bac0, %r8  # imm = 0xA023457689BAC0
movabsq $0xb0245736f9bac1, %rcx # imm = 0xB0245736F9BAC1
xorl %r10d, %r10d
xorl %r11d, %r11d
movb $0x1, (%rdi,%r10)
movq %r9, %rax
shlq $0x10, %rax
xorq %r9, %rax
movq %r8, %r9
movq %rcx, %r8
movq %rax, %rcx
shrq $0x5, %rcx
xorq %rax, %rcx
movq %r9, %rax
xorq %r8, %rax
xorq %rcx, %rax
addq %rcx, %rcx
xorq %rax, %rcx
movq %rcx, %rax
xorl %edx, %edx
divq %r14
cmpb $0x0, (%rdi,%rdx)
jne 0x5ce5
incq %r11
movq %rdx, %rax
shlq $0x6, %rax
leaq (%rbx,%rax), %r15
shlq $0x6, %r10
movq %r15, (%rbx,%r10)
movq %rdx, %r10
cmpq %rsi, %r11
jne 0x5ce0
jmp 0x5d3e
xorl %eax, %eax
movq %rbx, (%rbx,%rax)
popq %rbx
popq %r14
popq %r15
jmp 0x2030
leaq 0x65f5(%rip), %rdi      # 0xc348
leaq 0x4da5(%rip), %rsi      # 0xaaff
leaq 0x4dd3(%rip), %rcx      # 0xab34
movl $0x69, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/helper.c
// Function: dvfs_scale_up
int
dvfs_scale_up(const size_t n_reps, const double ratio, double* dur)
{
  const double is_dvfs_ratio = 0.9;
  const uint max_tries = 16;
  uint tries = max_tries;

  clock_t s = clock();
  ticks times[2];
  times[0] = spin_time(n_reps);
  times[1] = spin_time(n_reps);
  ticks prev = times[1], last = prev;
  if (times[1] < (ratio * times[0]))
    {
      ticks cmp = prev;
      do
	{
	  cmp = prev;
	  last = spin_time(n_reps);
	  prev = last;
	}
      while (tries-- > 0 && last < (ratio * cmp));
    }
  clock_t e = clock();

  if (dur != NULL)
    {
      *dur = 1000.0 * (e - s) / (double) CLOCKS_PER_SEC;
    }
  return (last < (is_dvfs_ratio * times[0]));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movsd %xmm0, 0x8(%rsp)
movq %rdi, %r15
callq 0x20d0
movq %rax, %r14
movq %r15, %rdi
callq 0x5d6b
movq %rax, %r13
movq %r15, %rdi
callq 0x5d6b
movq %rax, %r12
movq %rax, %xmm0
movq 0x424e(%rip), %xmm2     # 0xa050
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x4252(%rip), %xmm3     # 0xa060
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq %r13, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
movapd %xmm2, 0x10(%rsp)
movapd %xmm2, %xmm0
mulsd 0x8(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5eb4
movl $0xffffffef, %ebp       # imm = 0xFFFFFFEF
movq %r15, %rdi
callq 0x5d6b
movq %rax, %r13
incl %ebp
je 0x5eb7
movq %r13, %xmm0
movq 0x41e2(%rip), %xmm2     # 0xa050
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
movapd 0x41e6(%rip), %xmm3     # 0xa060
subpd %xmm3, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq %r12, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm3, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0x8(%rsp), %xmm2
ucomisd %xmm1, %xmm2
movq %r13, %r12
ja 0x5e52
jmp 0x5eb7
movq %r12, %r13
callq 0x20d0
testq %rbx, %rbx
je 0x5ee0
subq %r14, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x598c(%rip), %xmm0     # 0xb860
divsd 0x413c(%rip), %xmm0     # 0xa018
movsd %xmm0, (%rbx)
movq %r13, %xmm0
punpckldq 0x4163(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x416b(%rip), %xmm0     # 0xa060
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
movapd 0x10(%rsp), %xmm2
mulsd 0x411d(%rip), %xmm2     # 0xa028
addsd %xmm0, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm2
seta %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/barrier.c
// Function: barrier2_create
barrier2_t*
barrier2_create()
{
  barrier2_t* b = (barrier2_t*) malloc(sizeof(barrier2_t));
  assert(b);
  for (int i = 0; i < BARRIER2_NUM_BARRIER; i++)
    {
      b->val[i] = 0;
      b->eval[i] = 0;
    }
  return b;
}

// Assembly:
pushq %rax
movl $0x80, %edi
callq 0x21d0
testq %rax, %rax
je 0x5f4e
xorl %ecx, %ecx
xorl %edx, %edx
movl %ecx, (%rax,%rdx,4)
movl %ecx, 0x40(%rax,%rdx,4)
incq %rdx
cmpq $0x10, %rdx
jne 0x5f3c
popq %rcx
retq
leaq 0x596c(%rip), %rdi      # 0xb8c1
leaq 0x5967(%rip), %rsi      # 0xb8c3
leaq 0x596e(%rip), %rcx      # 0xb8d1
movl $0x7, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/cdf.c
// Function: cdf_cluster_get_min_latency
uint64_t
cdf_cluster_get_min_latency(cdf_cluster_t* cc)
{
  uint64_t min_lat = cc->clusters[0].median;
  for (int i = 1; i < cc->n_clusters; i++)
    {
      if (min_lat == 0 || (cc->clusters[i].median < min_lat))
	{
	  min_lat = cc->clusters[i].median;
	}
    }
  return min_lat;
}

// Assembly:
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq 0x20(%rdx), %rsi
cmpq $0x2, %rcx
jb 0x651c
addq $0x48, %rdx
decq %rcx
movq %rsi, %rax
movq (%rdx), %rdi
cmpq %rsi, %rdi
cmovbq %rdi, %rax
testq %rsi, %rsi
cmoveq %rdi, %rax
addq $0x28, %rdx
movq %rax, %rsi
decq %rcx
jne 0x64fe
retq
movq %rsi, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/cdf.c
// Function: cdf_cluster_print
void
cdf_cluster_print(cdf_cluster_t* cc)
{
  printf("## CDF Clusters ##############################################\n");
  for (int i = 0; i < cc->n_clusters; i++)
    {
      printf("#### #%-3d : size %-5zu / range %-5zu - %-5zu / median: %-5zu #\n",
	     cc->clusters[i].idx, 
	     cc->clusters[i].size, 
	     cc->clusters[i].val_min, 
	     cc->clusters[i].val_max, 
	     cc->clusters[i].median);
    }
  printf("##############################################################\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x54b3(%rip), %rdi      # 0xba40
callq 0x2080
cmpq $0x0, (%rbx)
je 0x65da
movl $0x20, %r15d
leaq 0x5409(%rip), %r14      # 0xb9ae
xorl %r12d, %r12d
movq 0x8(%rbx), %rax
movl -0x20(%rax,%r15), %esi
movq -0x18(%rax,%r15), %rdx
movq -0x10(%rax,%r15), %rcx
movq -0x8(%rax,%r15), %r8
movq (%rax,%r15), %r9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2100
incq %r12
addq $0x28, %r15
cmpq %r12, (%rbx)
ja 0x65a8
leaq 0x5156(%rip), %rdi      # 0xb737
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2080
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/cdf.c
// Function: cdf_cluster_value_to_cluster_median
inline uint64_t
cdf_cluster_value_to_cluster_median(cdf_cluster_t* cc, const uint64_t val)
{
  for (int i = 0; i < cc->n_clusters; i++)
    {
      if (val >= cc->clusters[i].val_min && val <= cc->clusters[i].val_max)
	{
	  return cc->clusters[i].median;
	}
    }

  fprintf(stderr, "[ERROR] Value %zu does not belong to cdf_cluster\n", val);
  return 0;
}

// Assembly:
pushq %rbx
movq %rsi, %rdx
movq (%rdi), %rax
testq %rax, %rax
je 0x661a
movq 0x8(%rdi), %rcx
addq $0x20, %rcx
cmpq %rdx, -0x10(%rcx)
ja 0x6611
cmpq %rdx, -0x8(%rcx)
jae 0x6636
addq $0x28, %rcx
decq %rax
jne 0x6605
movq 0x99cf(%rip), %rax      # 0xfff0
movq (%rax), %rdi
leaq 0x53c4(%rip), %rsi      # 0xb9ef
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2170
jmp 0x6639
movq (%rcx), %rbx
movq %rbx, %rax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/darray.c
// Function: darray_create
darray_t*
darray_create()
{
  darray_t* da = malloc_assert(sizeof(darray_t));
  da->n_elems = 0;
  da->size = DARRAY_MIN_SIZE;
  da->array = malloc_assert(DARRAY_MIN_SIZE * sizeof(uintptr_t));
  return da;
}

// Assembly:
pushq %rbx
movl $0x18, %edi
callq 0x21d0
testq %rax, %rax
je 0x667a
movq %rax, %rbx
movq $0x0, (%rax)
movq $0x8, 0x8(%rax)
movl $0x40, %edi
callq 0x21d0
testq %rax, %rax
je 0x667a
movq %rax, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
retq
leaq 0x5cc7(%rip), %rdi      # 0xc348
leaq 0x4477(%rip), %rsi      # 0xaaff
leaq 0x4489(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/darray.c
// Function: darray_remove
int
darray_remove(darray_t* da, uintptr_t elem)
{
  for (int i = 0; i < da->n_elems; i++)
    {
      if (unlikely(elem == da->array[i]))
	{
	  da->n_elems--;
	  for (int j = i; j < da->n_elems; j++)
	    {
	      da->array[j] = da->array[j + 1];
	    }
	  return 1;
	}
    }
  return 0;
}

// Assembly:
movq (%rdi), %rdx
testq %rdx, %rdx
je 0x6883
movq 0x10(%rdi), %rax
cmpq %rsi, (%rax)
je 0x6889
leaq -0x1(%rdx), %rcx
xorl %r9d, %r9d
cmpq %r9, %rcx
je 0x6883
leaq 0x1(%r9), %r8
cmpq %rsi, 0x8(%rax,%r9,8)
movq %r8, %r9
jne 0x6868
cmpq %r8, %rdx
seta %cl
jmp 0x688e
xorl %ecx, %ecx
movzbl %cl, %eax
retq
movb $0x1, %cl
xorl %r8d, %r8d
decq %rdx
movq %rdx, (%rdi)
movl %r8d, %esi
cmpq %rsi, %rdx
jbe 0x6885
movq 0x8(%rax,%r8,8), %rdx
movq %rdx, (%rax,%r8,8)
leaq 0x1(%r8), %rdx
movq %rdx, %r8
cmpq %rdx, (%rdi)
ja 0x689c
jmp 0x6885
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/darray.c
// Function: darray_remove_all
uint
darray_remove_all(darray_t* da, darray_t* from)
{
  size_t n_removed = 0;
  DARRAY_FOR_EACH(from, i)
    {
      uintptr_t elem = DARRAY_GET_N(from, i);
      n_removed += darray_remove(da, elem);
    }

  return n_removed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, (%rsi)
je 0x68e7
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x10(%rbx), %rax
movq (%rax,%r15,8), %rsi
movq %r14, %rdi
callq 0x6850
addl %eax, %ebp
incq %r15
cmpq %r15, (%rbx)
ja 0x68cb
jmp 0x68e9
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/darray.c
// Function: darray_exists_pos
inline int
darray_exists_pos(darray_t* da, uintptr_t elem, uint* pos)
{
  for (int i = 0; i < da->n_elems; i++)
    {
      if (unlikely(elem == da->array[i]))
	{
	  *pos = i;
	  return 1;
	}
    }
  return 0;
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x6944
movq 0x10(%rdi), %r8
cmpq %rsi, (%r8)
je 0x6947
leaq -0x1(%rcx), %r9
xorl %eax, %eax
xorl %r10d, %r10d
cmpq %r10, %r9
je 0x6946
leaq 0x1(%r10), %rdi
cmpq %rsi, 0x8(%r8,%r10,8)
movq %rdi, %r10
jne 0x6927
xorl %eax, %eax
cmpq %rdi, %rcx
seta %al
jmp 0x694e
xorl %eax, %eax
retq
movl $0x1, %eax
xorl %edi, %edi
movl %edi, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_infer_clustering
cdf_cluster_t*
mctop_infer_clustering(uint64_t** lat_table_norm, const size_t N)
{
  darray_t* clusters = darray_create();
  for (int x = 0; x < N; x++)
    {
      for (int y = 0; y < N; y++)
	{
	  darray_add_uniq(clusters, lat_table_norm[x][y]);
	}
    }

  int n_clusters = darray_get_num_elems(clusters);
  darray_sort(clusters);
  //printf("## Detected %2d clusters: ", n_clusters);
  /* darray_print(clusters); */

  cdf_cluster_t* cc = cdf_cluster_create_empty(n_clusters);
  cc->n_clusters = n_clusters;
  for (int c = 0; c < n_clusters; c++)
    {
      cc->clusters[c].idx = c;
      cc->clusters[c].median = darray_get_elem_n(clusters, c);
    }

  darray_free(clusters);
  return cc;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
callq 0x6640
movq %rax, %rbx
testq %r14, %r14
je 0x6f86
xorl %r12d, %r12d
xorl %r13d, %r13d
movq (%r15,%r12,8), %rax
movq (%rax,%r13,8), %rsi
movq %rbx, %rdi
callq 0x27e4
incq %r13
cmpq %r13, %r14
jne 0x6f66
incq %r12
cmpq %r14, %r12
jne 0x6f63
movq %rbx, %rdi
callq 0x6951
movq %rax, %r14
movq %rbx, %rdi
callq 0x6983
movl %r14d, %edi
callq 0x6520
movq %rax, %r15
movslq %r14d, %rax
movq %rax, (%r15)
testl %eax, %eax
jle 0x6fe3
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq 0x8(%r15), %rcx
xorl %r13d, %r13d
xorl %r12d, %r12d
movl %r12d, (%rcx,%r13)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6955
movq 0x8(%r15), %rcx
movq %rax, 0x20(%rcx,%r13)
incq %r12
addq $0x28, %r13
cmpq %r12, %r14
jne 0x6fbf
movq %rbx, %rdi
callq 0x66f7
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_create
mctop_t*
mctop_create(uint n_sockets, cdf_cluster_t* cc, uint n_hwcs, const int is_smt)
{
  mctop_t* topo = calloc_assert(1, sizeof(mctop_t));
  topo->is_smt = is_smt;
  topo->has_mem = NO_MEMORY;

  topo->n_sockets = n_sockets;
  topo->sockets = calloc_assert(topo->n_sockets, sizeof(socket_t));

  topo->n_levels = cc->n_clusters;
  topo->latencies = malloc_assert(topo->n_levels * sizeof(uint));
  for (int i = 0; i < topo->n_levels; i++)
    {
      topo->latencies[i] = cc->clusters[i].median;
    }

  topo->n_hwcs = n_hwcs;
  topo->hwcs = calloc_assert(topo->n_hwcs, sizeof(hw_context_t));
  for (int i = 0; i < topo->n_hwcs; i++)
    {
      topo->hwcs[i].id = i;
      topo->hwcs[i].phy_id = i;
      topo->hwcs[i].level = 0;      
      topo->hwcs[i].type = is_smt ? HW_CONTEXT : CORE;
    }
  
  return topo;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %r12d
movl $0x1, %edi
movl $0x88, %esi
callq 0x2150
testq %rax, %rax
je 0x70df
movq %rax, %rbx
movl %ebp, 0x28(%rax)
movl %r12d, 0x18(%rax)
movl %r12d, %edi
movl $0xa8, %esi
callq 0x2150
testq %rax, %rax
je 0x70df
movq %rax, 0x20(%rbx)
movq (%r15), %r12
movl %r12d, (%rbx)
movl %r12d, %edi
shlq $0x2, %rdi
callq 0x21d0
testq %rax, %rax
je 0x70fe
movq %rax, 0x8(%rbx)
testl %r12d, %r12d
je 0x7089
movq 0x8(%r15), %rcx
movl %r12d, %edx
addq $0x20, %rcx
xorl %esi, %esi
movl (%rcx), %edi
movl %edi, (%rax,%rsi,4)
incq %rsi
addq $0x28, %rcx
cmpq %rsi, %rdx
jne 0x7078
movl %r14d, 0x10(%rbx)
movl %r14d, %r15d
movl $0x30, %esi
movq %r15, %rdi
callq 0x2150
testq %rax, %rax
je 0x70df
movq %rax, 0x40(%rbx)
testl %r14d, %r14d
je 0x70d3
xorl %ecx, %ecx
testl %ebp, %ebp
sete %cl
addq $0xc, %rax
xorl %edx, %edx
movl %edx, -0xc(%rax)
movl %edx, (%rax)
movl $0x0, -0x8(%rax)
movl %ecx, -0x4(%rax)
incq %rdx
addq $0x30, %rax
cmpq %rdx, %r15
jne 0x70b8
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5262(%rip), %rdi      # 0xc348
leaq 0x3a12(%rip), %rsi      # 0xaaff
leaq 0x3a40(%rip), %rcx      # 0xab34
movl $0x69, %edx
callq 0x2110
leaq 0x5243(%rip), %rdi      # 0xc348
leaq 0x39f3(%rip), %rsi      # 0xaaff
leaq 0x3a05(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_hwc_group_create
hwc_group_t*
mctop_hwc_group_create(mctop_t* topo, uint n_hwcs, darray_t* hwc_ids, uint seq_id, uint lvl, uint lat, const int has_smt)
{
  hwc_group_t* group = calloc_assert(1, sizeof(hwc_group_t));
  group->id = mctop_create_id(seq_id, lvl);
  group->level = lvl;
  group->type = (has_smt && lvl == 1) ? CORE : HWC_GROUP;
  group->latency = lat;
  group->n_hwcs = n_hwcs;
  group->hwcs = (hw_context_t**) malloc_assert(group->n_hwcs * sizeof(hw_context_t*));
  group->topo = topo;

  darray_iter_t iter;
  darray_iter_init(&iter, hwc_ids);
  size_t elem, i = 0;
  while (darray_iter_next(&iter, &elem))
    {
      hw_context_t* hwc = mctop_get_hwc_n(topo, elem);
      group->hwcs[i++] = hwc;
      if (hwc->parent == NULL)
	{
	  hwc->parent = group;
	}
      else
	{
	  hwc_group_t* cur = hwc->parent;
	  while (cur->parent != NULL)
	    {
	      cur = cur->parent;
	    }
	  if (cur != group)
	    {
	      cur->parent = group;
	    }
	}
    }

  return group;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movl %r8d, %r13d
movl %ecx, %r15d
movq %rdx, 0x10(%rsp)
movl %esi, %r12d
movq %rdi, %rbx
movl $0x1, %edi
movl $0xa8, %esi
callq 0x2150
testq %rax, %rax
je 0x724b
movq %rax, %r14
movl 0x60(%rsp), %eax
imull $0x2710, %r13d, %ecx    # imm = 0x2710
addl %r15d, %ecx
movl %ecx, (%r14)
movl %r13d, 0x4(%r14)
testl %eax, %eax
setne %al
cmpl $0x1, %r13d
sete %cl
andb %al, %cl
movzbl %cl, %eax
movl $0x2, %ecx
subl %eax, %ecx
movl %ecx, 0x8(%r14)
movl %ebp, 0xc(%r14)
movl %r12d, 0x28(%r14)
movl %r12d, %edi
shlq $0x3, %rdi
callq 0x21d0
testq %rax, %rax
je 0x726a
movq %rax, 0x30(%r14)
movq %rbx, 0x48(%r14)
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x69cd
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x69d9
testl %eax, %eax
je 0x7239
xorl %r13d, %r13d
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movl 0x8(%rsp), %ecx
movq 0x40(%rbx), %rax
leaq (%rcx,%rcx,2), %rdx
shlq $0x4, %rdx
leaq (%rax,%rdx), %rcx
movq 0x30(%r14), %rsi
movq %rcx, (%rsi,%r13,8)
movq 0x18(%rax,%rdx), %rcx
testq %rcx, %rcx
je 0x721d
movq %rcx, %rax
movq 0x18(%rcx), %rcx
testq %rcx, %rcx
jne 0x7206
cmpq %r14, %rax
je 0x7227
addq $0x18, %rax
jmp 0x7224
addq %rdx, %rax
addq $0x18, %rax
movq %r14, (%rax)
incq %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x69d9
testl %eax, %eax
jne 0x71e0
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x50f6(%rip), %rdi      # 0xc348
leaq 0x38a6(%rip), %rsi      # 0xaaff
leaq 0x38d4(%rip), %rcx      # 0xab34
movl $0x69, %edx
callq 0x2110
leaq 0x50d7(%rip), %rdi      # 0xc348
leaq 0x3887(%rip), %rsi      # 0xaaff
leaq 0x3899(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_socket_create
socket_t*
mctop_socket_create(mctop_t* topo, 
		    uint n_hwcs, 
		    darray_t* hwc_ids, 
		    uint seq_id,
		    uint lvl, 
		    uint latency, 
		    uint64_t** mem_lat_table, 
		    const int is_smt)
{
  socket_t* socket = topo->sockets + seq_id;
  socket->id = mctop_create_id(seq_id, lvl);
  socket->level = lvl;
  socket->type = SOCKET;
  socket->latency = latency;
  socket->n_hwcs = n_hwcs;
  socket->hwcs = (hw_context_t**) malloc_assert(socket->n_hwcs * sizeof(hw_context_t*));
  socket->n_nodes = topo->n_sockets;
  socket->topo = topo;

  /* uint hwc_seq_id = seq_id * socket->n_hwcs; */

  darray_iter_t iter;
  darray_iter_init(&iter, hwc_ids);

  darray_t* pgroups = darray_create();
  size_t elem, i = 0;
  while (darray_iter_next(&iter, &elem))
    {
      hw_context_t* hwc = mctop_get_hwc_n(topo, elem);
      /* hwc->id = hwc_seq_id++; */
      socket->hwcs[i++] = hwc;
      hwc->socket = socket;

      hwc_group_t* cur = hwc->parent;
      while (cur && cur->parent != NULL && cur->parent != socket)
	{
	  cur = cur->parent;
	}
      if (cur != NULL)
	{
	  cur->parent = socket;
	  darray_add_uniq(pgroups, (uintptr_t) cur);
	}
      else
	{
	  hwc->parent = socket;
	}
    }
  darray_free(pgroups);


  return socket;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rdi, %r14
movq 0x20(%rdi), %rbx
movl %ecx, %eax
imulq $0xa8, %rax, %r12
imull $0x2710, %r8d, %eax     # imm = 0x2710
addl %ecx, %eax
movl %eax, (%rbx,%r12)
movl %r8d, 0x4(%rbx,%r12)
movl $0x3, 0x8(%rbx,%r12)
movl %r9d, 0xc(%rbx,%r12)
movl %esi, 0x28(%rbx,%r12)
movl %esi, %edi
shlq $0x3, %rdi
callq 0x21d0
testq %rax, %rax
je 0x73a1
addq %r12, %rbx
movq %rax, 0x30(%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x70(%rbx)
movq %r14, 0x48(%rbx)
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x69cd
xorl %eax, %eax
callq 0x6640
movq %rax, %r15
movq %rsp, %rsi
movq %r12, %rdi
callq 0x69d9
testl %eax, %eax
je 0x7387
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
movq %rsp, %r13
movl (%rsp), %eax
movq 0x40(%r14), %rcx
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq 0x30(%rbx), %rsi
movq %rax, (%rsi,%rbp,8)
incq %rbp
movq %rbx, 0x10(%rcx,%rdx)
movq 0x18(%rcx,%rdx), %rcx
testq %rcx, %rcx
je 0x7374
movq %rcx, %rsi
movq 0x18(%rcx), %rcx
testq %rcx, %rcx
je 0x7366
cmpq %rbx, %rcx
jne 0x7350
movq %rbx, 0x18(%rsi)
movq %r15, %rdi
callq 0x27e4
jmp 0x7378
movq %rbx, 0x18(%rax)
movq %r12, %rdi
movq %r13, %rsi
callq 0x69d9
testl %eax, %eax
jne 0x7328
movq %r15, %rdi
callq 0x66f7
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4fa0(%rip), %rdi      # 0xc348
leaq 0x3750(%rip), %rsi      # 0xaaff
leaq 0x3762(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_siblings_create
void
mctop_siblings_create(mctop_t* topo, uint socket_x_id, uint socket_y_id, uint* seq_id, uint lvl, uint latency)
{
  socket_t* socket_x = mctop_get_socket(topo, socket_x_id);
  socket_t* socket_y = mctop_get_socket(topo, socket_y_id);

  socket_x->siblings = realloc_assert(socket_x->siblings, (socket_x->n_siblings + 1) * sizeof(sibling_t*));
  socket_y->siblings = realloc_assert(socket_y->siblings, (socket_y->n_siblings + 1) * sizeof(sibling_t*));

  sibling_t* sibling = mctop_sibling_create((*seq_id)++, lvl, latency, socket_x, socket_y);
  socket_x->siblings[socket_x->n_siblings++] = sibling;
  socket_y->siblings[socket_y->n_siblings++] = sibling;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movl %r8d, %r15d
movq %rcx, %r12
movl %edx, %ebx
movq %rdi, %r13
callq 0x8b7c
movq %rax, %r14
movq %r13, %rdi
movl %ebx, %esi
callq 0x8b7c
movq %rax, %rbx
movq 0x58(%r14), %rdi
movl 0x50(%r14), %esi
incl %esi
shlq $0x3, %rsi
callq 0x2210
testq %rax, %rax
je 0x7473
movq %rax, 0x58(%r14)
movq 0x58(%rbx), %rdi
movl 0x50(%rbx), %esi
incl %esi
shlq $0x3, %rsi
callq 0x2210
testq %rax, %rax
je 0x7473
movq %rax, 0x58(%rbx)
movl (%r12), %edi
leal 0x1(%rdi), %eax
movl %eax, (%r12)
movl %r15d, %esi
movl %ebp, %edx
movq %r14, %rcx
movq %rbx, %r8
callq 0x8432
movq 0x58(%r14), %rcx
movl 0x50(%r14), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x50(%r14)
movq %rax, (%rcx,%rdx,8)
movq 0x58(%rbx), %rcx
movl 0x50(%rbx), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x50(%rbx)
movq %rax, (%rcx,%rdx,8)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4ece(%rip), %rdi      # 0xc348
leaq 0x367e(%rip), %rsi      # 0xaaff
leaq 0x4647(%rip), %rcx      # 0xbacf
movl $0x61, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_fix_n_hwcs_per_core_smt
void
mctop_fix_n_hwcs_per_core_smt(mctop_t* topo)
{
  if (topo->is_smt)
    {
      hwc_group_t* gs = mctop_get_first_gs_at_lvl(topo, 1);
      assert(gs->type == CORE);
      topo->n_hwcs_per_core = gs->n_children;
    }
  else
    {
      topo->n_hwcs_per_core = 1;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x28(%rdi)
je 0x793b
movq %rbx, %rdi
movl $0x1, %esi
callq 0x8ba6
cmpl $0x1, 0x8(%rax)
jne 0x7945
movl 0x3c(%rax), %eax
jmp 0x7940
movl $0x1, %eax
movl %eax, 0x2c(%rbx)
popq %rbx
retq
leaq 0x44a1(%rip), %rdi      # 0xbded
leaq 0x44ab(%rip), %rsi      # 0xbdfe
leaq 0x44b9(%rip), %rcx      # 0xbe13
movl $0x353, %edx            # imm = 0x353
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_mem_latencies_add
void
mctop_mem_latencies_add(mctop_t* topo, uint64_t** mem_lat_table)
{
  /* mem. latencies */
  if (mem_lat_table != NULL)
    {
      topo->has_mem = topo->has_mem | LATENCY;
      topo->node_to_socket = calloc_assert(topo->n_sockets, sizeof(uint));

      for (int s = 0; s < topo->n_sockets; s++)
	{
	  socket_t* socket = &topo->sockets[s];
	  uint hwc_use_id = 0;
	  uint min_avg = -1;
	  for (int i = 0; i < socket->n_hwcs; i++)
	    {
	      uint hwc_id = socket->hwcs[i]->id;
	      uint avg = 0;
	      for (int s = 0; s < topo->n_sockets; s++)
		{
		  avg += mem_lat_table[hwc_id][s];
		}
	      avg /= topo->n_sockets;
	      if (avg > 0 && avg < min_avg)
		{
		  min_avg = avg;
		  hwc_use_id = hwc_id;
		}
	    }

	  uint64_t* lats = mem_lat_table[hwc_use_id];
	  socket->mem_latencies = malloc_assert(topo->n_sockets * sizeof(uint));
	  uint min_lat = -1, local_node = 0;
	  for (int n = 0; n < topo->n_sockets; n++)
	    {
	      if (lats[n] < min_lat)
		{
		  local_node = n;
		  min_lat = lats[n];
		}
	      socket->mem_latencies[n] = lats[n];
	    }
	  socket->local_node = local_node;
	  topo->node_to_socket[socket->local_node] = s;
	}
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x7a8d
movq %rsi, %rbx
movq %rdi, %r12
orb $0x1, 0x30(%rdi)
movl 0x18(%rdi), %r14d
movl $0x4, %esi
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x7abb
movq %rax, %r13
movq %rax, 0x38(%r12)
testq %r14, %r14
je 0x7a8d
movq 0x20(%r12), %rcx
movq %rcx, 0x10(%rsp)
leaq (,%r14,4), %rcx
movq %rcx, 0x8(%rsp)
xorl %ebp, %ebp
imulq $0xa8, %rbp, %rax
movq 0x10(%rsp), %rcx
leaq (%rcx,%rax), %r12
movl 0x28(%rcx,%rax), %esi
testq %rsi, %rsi
je 0x7a37
movq 0x30(%r12), %rdi
xorl %r8d, %r8d
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
movq (%rdi,%r8,8), %rax
movl (%rax), %r11d
movq (%rbx,%r11,8), %rax
xorl %edx, %edx
xorl %ecx, %ecx
addl (%rax,%rdx,8), %ecx
incq %rdx
cmpq %rdx, %r14
jne 0x7a02
movl %ecx, %eax
xorl %edx, %edx
divl %r14d
cmpl %ecx, %r14d
setbe %cl
cmpl %r9d, %eax
setb %dl
testb %dl, %cl
cmovnel %r11d, %r10d
cmovnel %eax, %r9d
incq %r8
cmpq %rsi, %r8
jne 0x79f3
movl %r10d, %eax
jmp 0x7a39
xorl %eax, %eax
movq (%rbx,%rax,8), %r15
movq 0x8(%rsp), %rdi
callq 0x21d0
testq %rax, %rax
je 0x7a9c
movq %rax, 0x78(%r12)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %edx, %edx
xorl %esi, %esi
movq (%r15,%rdx,8), %rdi
movl %ecx, %r8d
cmpq %r8, %rdi
cmovbl %edi, %ecx
cmovbl %edx, %esi
movl %edi, (%rax,%rdx,4)
incq %rdx
cmpq %rdx, %r14
jne 0x7a5a
movl %esi, 0x6c(%r12)
movl %esi, %eax
movl %ebp, (%r13,%rax,4)
incq %rbp
cmpq %r14, %rbp
jne 0x79c9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x48a5(%rip), %rdi      # 0xc348
leaq 0x3055(%rip), %rsi      # 0xaaff
leaq 0x3067(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
leaq 0x4886(%rip), %rdi      # 0xc348
leaq 0x3036(%rip), %rsi      # 0xaaff
leaq 0x3064(%rip), %rcx      # 0xab34
movl $0x69, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_sibling_create
sibling_t*
mctop_sibling_create(uint seq_id, uint lvl, uint latency, socket_t* left, socket_t* right)
{
  sibling_t* sibling = calloc_assert(1, sizeof(sibling_t));
  sibling->id = mctop_create_id(seq_id, lvl);
  sibling->level = lvl;
  sibling->latency = latency;
  sibling->left = left;
  sibling->right = right;
  return sibling;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
movl %esi, %r15d
movl %edi, %r12d
movl $0x1, %edi
movl $0x28, %esi
callq 0x2150
testq %rax, %rax
je 0x8480
imull $0x2710, %r15d, %ecx    # imm = 0x2710
addl %r12d, %ecx
movl %ecx, (%rax)
movl %r15d, 0x4(%rax)
movl %ebp, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rbx, 0x18(%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3ec1(%rip), %rdi      # 0xc348
leaq 0x2671(%rip), %rsi      # 0xaaff
leaq 0x269f(%rip), %rcx      # 0xab34
movl $0x69, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_cache_info_create
mctop_cache_info_t*
mctop_cache_info_create(const uint n_levels)
{
  mctop_cache_info_t* mci = malloc_assert(sizeof(mctop_cache_info_t));
  mci->n_levels = n_levels;
  mci->latencies = calloc_assert(n_levels, sizeof(uint64_t));
  mci->sizes_OS = calloc_assert(n_levels, sizeof(uint64_t));
  mci->sizes_estimated = calloc_assert(n_levels, sizeof(uint64_t));
  return mci;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebp
movl $0x20, %edi
callq 0x21d0
testq %rax, %rax
je 0x8525
movq %rax, %rbx
movl %ebp, (%rax)
movl %ebp, %r14d
movl $0x8, %esi
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x8506
movq %rax, 0x8(%rbx)
movl $0x8, %esi
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x8506
movq %rax, 0x10(%rbx)
movl $0x8, %esi
movq %r14, %rdi
callq 0x2150
testq %rax, %rax
je 0x8506
movq %rax, 0x18(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x3e3b(%rip), %rdi      # 0xc348
leaq 0x25eb(%rip), %rsi      # 0xaaff
leaq 0x2619(%rip), %rcx      # 0xab34
movl $0x69, %edx
callq 0x2110
leaq 0x3e1c(%rip), %rdi      # 0xc348
leaq 0x25cc(%rip), %rsi      # 0xaaff
leaq 0x25de(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_power_measurements_create
double***
mctop_power_measurements_create(const uint n_sockets)
{
  double*** pow_measurements = malloc_assert(MCTOP_POW_TYPE_NUM * sizeof(double**));
  for (uint i = 0; i < MCTOP_POW_TYPE_NUM; i++)
    {
      pow_measurements[i] = malloc_assert((n_sockets + 1) * sizeof(double*));
      for (uint s = 0; s <= n_sockets; s++)
	{
	  pow_measurements[i][s] = malloc_assert(MCTOP_POW_COMP_TYPE_NUM * sizeof(double));
	}
    }
  return pow_measurements;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x30, %edi
callq 0x21d0
testq %rax, %rax
je 0x89a2
movq %rax, %r14
leal 0x1(%rbx), %r15d
shlq $0x3, %r15
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x21d0
testq %rax, %rax
je 0x89a2
movq %rax, %r12
movq %rax, (%r14,%r13,8)
xorl %ebp, %ebp
movl $0x28, %edi
callq 0x21d0
testq %rax, %rax
je 0x89a2
movl %ebp, %ecx
movq %rax, (%r12,%rcx,8)
incl %ebp
cmpl %ebx, %ebp
jbe 0x896c
incq %r13
cmpq $0x6, %r13
jne 0x8956
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x399f(%rip), %rdi      # 0xc348
leaq 0x214f(%rip), %rsi      # 0xaaff
leaq 0x2161(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_power_measurements_free
void
mctop_power_measurements_free(double*** m, const uint n_sockets)
{
  for (uint i = 0; i < MCTOP_POW_TYPE_NUM; i++)
    {
      for (uint s = 0; s <= n_sockets; s++)
	{
	  free(m[i][s]);
	}
      free(m[i]);
    }
  free(m);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rbx,%r14,8), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
callq 0x2030
incl %r15d
cmpl %ebp, %r15d
jbe 0x89d3
movq (%rbx,%r14,8), %rdi
callq 0x2030
incq %r14
cmpq $0x6, %r14
jne 0x89d0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_pow_info_add
void
mctop_pow_info_add(mctop_t* topo, double*** pm)
{
  for (int i = 0; i <= topo->n_sockets; i++)
    {
      mctop_pow_info_t* pi = malloc_assert(sizeof(mctop_pow_info_t));
      uint div = 1;
      if (i < topo->n_sockets)
	{
	  topo->sockets[i].pow_info = pi;
	}
      else
	{
	  topo->pow_info = pi;
	  div = topo->n_sockets;
	}
      uint type = 0;
      __copy_doubles(pi->idle, pm[type++][i], MCTOP_POW_COMP_TYPE_NUM, 1);
      __copy_doubles(pi->first_core, pm[type++][i], MCTOP_POW_COMP_TYPE_NUM, div);
      __copy_doubles(pi->second_core, pm[type++][i], MCTOP_POW_COMP_TYPE_NUM, div);
      __copy_doubles(pi->second_hwc_core, pm[type++][i], MCTOP_POW_COMP_TYPE_NUM, div);
      __copy_doubles(pi->all_cores, pm[type++][i], MCTOP_POW_COMP_TYPE_NUM, 1);
      __copy_doubles(pi->all_hwcs, pm[type++][i], MCTOP_POW_COMP_TYPE_NUM, 1);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x18(%rdi), %r15d
cvtsi2sd %r15, %xmm0
movsd %xmm0, (%rsp)
leaq 0x80(%rdi), %r12
leal 0x1(%r15), %r13d
xorl %ebp, %ebp
movl $0x120, %edi            # imm = 0x120
callq 0x21d0
testq %rax, %rax
je 0x8b5d
movq %r12, %rcx
movsd (%rsp), %xmm0
cmpq %r15, %rbp
jae 0x8a78
movq 0x20(%r14), %rcx
imulq $0xa8, %rbp, %rdx
addq %rdx, %rcx
addq $0xa0, %rcx
movsd 0x2d40(%rip), %xmm0     # 0xb7b8
movq %rax, (%rcx)
movq (%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
movsd %xmm1, (%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0x8a84
movq 0x8(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0x8aa1
movq 0x10(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x60(%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0x8ac3
movq 0x18(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x90(%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0x8ae5
movq 0x20(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, 0xc0(%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0x8b0a
movq 0x28(%rbx), %rcx
movq (%rcx,%rbp,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
movsd %xmm0, 0xf0(%rax,%rdx,8)
incq %rdx
cmpq $0x5, %rdx
jne 0x8b2b
incq %rbp
cmpq %r13, %rbp
jne 0x8a3b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x37e4(%rip), %rdi      # 0xc348
leaq 0x1f94(%rip), %rsi      # 0xaaff
leaq 0x1fa6(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_get_first_gs_at_lvl
inline hwc_gs_t*
mctop_get_first_gs_at_lvl(mctop_t* topo, const uint lvl)
{
  hwc_gs_t* cur = mctop_get_first_socket(topo);
  while (cur != NULL && cur->level != lvl)
    {
      cur = cur->children[0];
    }
  return cur;
}

// Assembly:
movq 0x20(%rdi), %rax
testq %rax, %rax
je 0x8bbd
cmpl %esi, 0x4(%rax)
je 0x8bbf
movq 0x40(%rax), %rax
movq (%rax), %rax
jmp 0x8baa
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_get_sibling_with_sockets
sibling_t*
mctop_get_sibling_with_sockets(mctop_t* topo, socket_t* s0, socket_t* s1)
{
  for (int i = 0; i < topo->n_siblings; i++)
    {
      sibling_t* sibling = topo->siblings[i];
      if (mctop_sibling_contains_sockets(sibling, s0, s1))
	{
	  return sibling;
	}
    }

  return NULL;
}

// Assembly:
movl 0x48(%rdi), %ecx
testq %rcx, %rcx
je 0x8c3b
movq 0x50(%rdi), %rdi
xorl %r8d, %r8d
movq (%rdi,%r8,8), %rax
movq 0x10(%rax), %r9
cmpq %rsi, %r9
jne 0x8c28
cmpq %rdx, 0x18(%rax)
je 0x8c3d
cmpq %rdx, %r9
jne 0x8c33
cmpq %rsi, 0x18(%rax)
je 0x8c3d
incq %r8
cmpq %r8, %rcx
jne 0x8c15
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_get_cache_size_kb
size_t
mctop_get_cache_size_kb(mctop_t* topo, mctop_cache_level_t level)
{
  mctop_cache_info_t* mci = topo->cache;
  if (mci)
    {
      return mci->sizes_OS[level] ? mci->sizes_OS[level] : mci->sizes_estimated[level];
    }
  return 0;
}

// Assembly:
movq 0x58(%rdi), %rcx
testq %rcx, %rcx
je 0x8c7a
movq 0x10(%rcx), %rax
movl %esi, %edx
movq (%rax,%rdx,8), %rax
testq %rax, %rax
je 0x8c7d
retq
xorl %eax, %eax
retq
movq 0x18(%rcx), %rax
movq (%rax,%rdx,8), %rax
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_socket_get_nth_gs_core
hwc_gs_t*
mctop_socket_get_nth_gs_core(socket_t* socket, const uint nth)
{
  hwc_gs_t* gs = socket->children[0];
  while (gs && gs->type != CORE)
    {
      gs = gs->children[0];
    }
  for (int i = 0; i < nth; i++)
    {
      gs = gs->next;
    }
  return gs;
}

// Assembly:
movq %rdi, %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x8cf2
cmpl $0x1, 0x8(%rax)
jne 0x8ce0
testl %esi, %esi
je 0x8cfe
movq 0x20(%rax), %rax
decl %esi
jne 0x8cf6
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_hwcid_fix_numa_node
int
mctop_hwcid_fix_numa_node(mctop_t* topo, const uint hwcid)
{
#ifdef __x86_64__
  /* printf("# HWID %-3u, SOCKET %-3u, numa_set_preferred(%u)\n", */
  /* 	     hwcid, hwc->socket->id, hwc->socket->local_node); */
  hw_context_t* hwc = &topo->hwcs[hwcid];
  const uint correct_node = hwc->socket->local_node;
  if (unlikely(hwc->local_node_wrong || correct_node != numa_preferred()))
    {
      numa_set_preferred(correct_node);
      return 1;
    }
#endif
  return 0;
}

// Assembly:
pushq %rbx
movq 0x40(%rdi), %rax
movl %esi, %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq 0x10(%rax,%rcx), %rdx
movl 0x6c(%rdx), %ebx
cmpl $0x0, 0x28(%rax,%rcx)
jne 0x8d8c
callq 0x22e0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %ebx
jne 0x8d8c
popq %rbx
retq
movl %ebx, %edi
callq 0x22a0
movl $0x1, %eax
jmp 0x8d8a
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_hwcid_get_nth_hwc_in_socket
uint
mctop_hwcid_get_nth_hwc_in_socket(mctop_t* topo, const uint hwcid)
{
  socket_t* socket = mctop_hwcid_get_socket(topo, hwcid);
  hw_context_t* hwc_first = mctop_socket_get_first_hwc(socket);
  uint i = 0;
  while (hwc_first && hwc_first->id != hwcid)
    {
      i++;
      hwc_first = hwc_first->next;
    }

  return i;
}

// Assembly:
movq 0x40(%rdi), %rax
movl %esi, %ecx
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq 0x10(%rax,%rcx), %rax
movq 0x30(%rax), %rax
movq (%rax), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x8e10
cmpl %esi, (%rcx)
je 0x8e10
incl %eax
movq 0x20(%rcx), %rcx
jmp 0x8dff
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_hwcid_get_nth_hwc_in_core
uint
mctop_hwcid_get_nth_hwc_in_core(mctop_t* topo, const uint hwcid)
{
  hw_context_t* hwc = &topo->hwcs[hwcid];
  if (hwc->type == CORE)
    {
      return 0;
    }
  hwc_gs_t* core = hwc->parent;
  for (int i = 0; i < core->n_hwcs; i++)
    {
      if (core->hwcs[i]->id == hwc->id)
	{
	  return i;
	}
    }
  assert(0);
}

// Assembly:
pushq %rax
movq 0x40(%rdi), %rdx
movl %esi, %eax
leaq (%rax,%rax,2), %rcx
shlq $0x4, %rcx
xorl %eax, %eax
cmpl $0x1, 0x8(%rdx,%rcx)
jne 0x8e2b
popq %rcx
retq
addq %rcx, %rdx
movq 0x18(%rdx), %rax
movl 0x28(%rax), %ecx
testq %rcx, %rcx
je 0x8e52
movq 0x30(%rax), %rsi
movl (%rdx), %edx
xorl %eax, %eax
movq (%rsi,%rax,8), %rdi
cmpl %edx, (%rdi)
je 0x8e29
incq %rax
cmpq %rax, %rcx
jne 0x8e42
leaq 0x1ca4(%rip), %rdi      # 0xaafd
leaq 0x30e3(%rip), %rsi      # 0xbf43
leaq 0x30f0(%rip), %rcx      # 0xbf57
movl $0x158, %edx            # imm = 0x158
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_hwcid_get_nth_core_in_socket
uint
mctop_hwcid_get_nth_core_in_socket(mctop_t* topo, const uint hwcid)
{
  hwc_gs_t* core = mctop_hwcid_get_core(topo, hwcid);
  hwc_gs_t* core_first = mctop_socket_get_first_gs_core(core->socket);
  uint i = 0;
  while (core_first && core->id != core_first->id)
    {
      i++;
      core_first = core_first->next;
    }

  return i;
}

// Assembly:
movq 0x40(%rdi), %rcx
movl %esi, %eax
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
cmpl $0x1, 0x8(%rcx,%rdx)
je 0x8e8e
movq 0x18(%rax), %rax
movq 0x10(%rax), %rcx
movq 0x40(%rcx), %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x8eb8
cmpl $0x1, 0x8(%rcx)
jne 0x8e92
movl (%rax), %edx
xorl %eax, %eax
cmpl (%rcx), %edx
je 0x8eb7
incl %eax
movq 0x20(%rcx), %rcx
testq %rcx, %rcx
jne 0x8ea8
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_control.c
// Function: mctop_run_on_socket_ref
int
mctop_run_on_socket_ref(socket_t* socket, const uint fix_mem)
{
  int ret = 0;
  if (socket == NULL)
    {
      return -EINVAL;
    }

#ifdef __x86_64__
  struct bitmask* bmask = numa_bitmask_alloc(socket->topo->n_hwcs);
  for (int i = 0; i < socket->n_hwcs; i++) 
    {
      bmask = numa_bitmask_setbit(bmask, socket->hwcs[i]->id);
    }

  ret = numa_sched_setaffinity(0, bmask);
  if (fix_mem && !ret && socket->topo->has_mem)
    {
      numa_set_preferred(socket->local_node);
    }
  numa_bitmask_free(bmask);
#else
  ret = mctop_run_on_node(socket->topo, socket->local_node);
#endif
  return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8f67
movl %esi, %ebp
movq %rdi, %rbx
movq 0x48(%rdi), %rax
movl 0x10(%rax), %edi
callq 0x2200
movq %rax, %r14
cmpl $0x0, 0x28(%rbx)
je 0x8f35
xorl %r15d, %r15d
movq 0x30(%rbx), %rax
movq (%rax,%r15,8), %rax
movl (%rax), %esi
movq %r14, %rdi
callq 0x21a0
movq %rax, %r14
incq %r15
movl 0x28(%rbx), %eax
cmpq %rax, %r15
jb 0x8f15
xorl %edi, %edi
movq %r14, %rsi
callq 0x2180
movl %eax, %r15d
testl %ebp, %ebp
je 0x8f5d
testl %r15d, %r15d
jne 0x8f5d
movq 0x48(%rbx), %rax
cmpl $0x0, 0x30(%rax)
je 0x8f5d
movl 0x6c(%rbx), %edi
callq 0x22a0
movq %r14, %rdi
callq 0x2320
jmp 0x8f6d
movl $0xffffffea, %r15d      # imm = 0xFFFFFFEA
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop_aux.c
// Function: table_malloc
void**
table_malloc(const size_t rows, const size_t cols, const size_t elem_size)
{
  void** m = malloc_assert(rows * sizeof(uint64_t*));
  for (int s = 0; s < rows; s++)
    {
      m[s] = malloc_assert(cols * elem_size);
    }

  return m;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
leaq (,%rdi,8), %rdi
callq 0x21d0
testq %rax, %rax
je 0x9042
movq %rax, %r15
testq %r14, %r14
je 0x9033
imulq %r12, %rbx
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x21d0
testq %rax, %rax
je 0x9042
movq %rax, (%r15,%r12,8)
incq %r12
cmpq %r12, %r14
jne 0x901a
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x32ff(%rip), %rdi      # 0xc348
leaq 0x1aaf(%rip), %rsi      # 0xaaff
leaq 0x1ac1(%rip), %rcx      # 0xab18
movl $0x59, %edx
callq 0x2110