// File: /workspace/github_c_makefile_star2_O0/LPD-EPFL[P]mctop/src/mctop_topology.c
// Function: mctop_mem_bandwidth_add
void 
mctop_mem_bandwidth_add(mctop_t* topo,
			double** mem_bw_table_r, double** mem_bw_table1_r,
			double** mem_bw_table_w, double** mem_bw_table1_w)
{
  topo->has_mem = BANDWIDTH;
  topo->mem_bandwidths_r = malloc_assert(topo->n_sockets * sizeof(double));
  topo->mem_bandwidths1_r = malloc_assert(topo->n_sockets * sizeof(double));
  topo->mem_bandwidths_w = malloc_assert(topo->n_sockets * sizeof(double));
  topo->mem_bandwidths1_w = malloc_assert(topo->n_sockets * sizeof(double));

  for (int s = 0; s < topo->n_sockets; s++)
    {
      socket_t* socket = topo->sockets + s;
      socket->mem_bandwidths_r = malloc_assert(socket->n_nodes * sizeof(double));
      socket->mem_bandwidths1_r = malloc_assert(socket->n_nodes * sizeof(double));
      socket->mem_bandwidths_w = malloc_assert(socket->n_nodes * sizeof(double));
      socket->mem_bandwidths1_w = malloc_assert(socket->n_nodes * sizeof(double));
      for (int n = 0; n < socket->n_nodes; n++)
	{
	  socket->mem_bandwidths_r[n] = mem_bw_table_r[s][n];
	  socket->mem_bandwidths1_r[n] = mem_bw_table1_r[s][n];
	  socket->mem_bandwidths_w[n] = mem_bw_table_w[s][n];
	  socket->mem_bandwidths1_w[n] = mem_bw_table1_w[s][n];
	}
      topo->mem_bandwidths_r[s] = socket->mem_bandwidths_r[socket->local_node];
      topo->mem_bandwidths1_r[s] = socket->mem_bandwidths1_r[socket->local_node];
      topo->mem_bandwidths_w[s] = socket->mem_bandwidths_w[socket->local_node];
      topo->mem_bandwidths1_w[s] = socket->mem_bandwidths1_w[socket->local_node];
    }

  mctop_fix_siblings_by_bandwidth(topo);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl $0x2, 0x30(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x78(%rax)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jae 0xb463
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x38(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x88(%rax)
movq -0x38(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x38(%rbp), %rax
movl 0x70(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x93f0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x98(%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x70(%rcx), %eax
jae 0xb3b5
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movq 0x80(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movq 0x90(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x3c(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movq 0x98(%rax), %rax
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xb2f3
movq -0x38(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x38(%rbp), %rcx
movl 0x6c(%rcx), %ecx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x88(%rax), %rax
movq -0x38(%rbp), %rcx
movl 0x6c(%rcx), %ecx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x90(%rax), %rax
movq -0x38(%rbp), %rcx
movl 0x6c(%rcx), %ecx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
movq 0x98(%rax), %rax
movq -0x38(%rbp), %rcx
movl 0x6c(%rcx), %ecx
movsd (%rax,%rcx,8), %xmm0
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x2c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xb242
movq -0x8(%rbp), %rdi
callq 0xb480
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)