// File: /workspace/github_c_makefile_star2_O0/LPD-EPFL[P]mctop/src/mctop.c
// Function: print_mem_bw_tables
void
print_mem_bw_tables(double** mem_bw_table, double** mem_bw_table1, size_t n_sockets,
		    const char* rw, test_format_t test_format, const char* hostname)
{
  if (test_format != NONE)
    {
      printf("## Mem. bw table (%-6s)###################################################\n", rw);
    }
  switch (test_format)
    {
    case C_STRUCT:
      printf("size_t mem_bw_table[%zu][%zu] = \n{\n", n_sockets, n_sockets);
      for (int x = 0; x < n_sockets; x++)
	{
	  printf("  { ");
	  for (int y = 0; y < n_sockets; y++)
	    {
	      printf("%-10.6f, ", mem_bw_table[x][y]);
	    }
	  printf("},\n");
	}
      printf("};\n");
      break;
    case LAT_TABLE:
      printf("     ");
      for (int y = 0; y < n_sockets; y++)
	{
	  printf("%-3d ", y);
	}
      printf("\n");

      /* print lat table */
      for (int x = 0; x < n_sockets; x++)
	{
	  printf("[%02d] ", x);
	  for (int y = 0; y < n_sockets; y++)
	    {
	      printf("%-10.6f, ", mem_bw_table[x][y]);
	    }
	  printf("\n");
	}
      break;
    case MCT_FILE:
      {
	char out_file[50];
	sprintf(out_file, "./desc/%s.mct", hostname);
	printf("## MCTOP output in: %s\n", out_file);

	int ofp_open = 1;
	FILE* ofp = fopen(out_file, "a");
	if (ofp == NULL) 
	  {
	    ofp_open = 0;
	    fprintf(stderr, "MCTOP Error: Cannot open output file %s! Using stderr instead.\n", out_file);
	    ofp = stderr;
	  }
	fprintf(ofp, "#Mem_bw-%s %zu\n", rw, n_sockets);
	for (int x = 0; x < n_sockets; x++)
	  {
	    for (int y = 0; y < n_sockets; y++)
	      {
		fprintf(ofp, "%-4d %-4d %f\n", x, y, mem_bw_table[x][y]);
	      }
	  }
	fprintf(ofp, "#Mem_bw1-%s %zu\n", rw, n_sockets);
	for (int x = 0; x < n_sockets; x++)
	  {
	    for (int y = 0; y < n_sockets; y++)
	      {
		fprintf(ofp, "%-4d %-4d %f\n", x, y, mem_bw_table1[x][y]);
	      }
	  }
	if (ofp_open)
	  {
	    fclose(ofp);
	  }
      }
    case NONE:
      break;
    }
  if (test_format != NONE)
    {
      printf("##########################################################################\n");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x5e5b
movq -0x20(%rbp), %rsi
leaq 0xa980(%rip), %rdi      # 0x107d4
movb $0x0, %al
callq 0x20d0
movl -0x24(%rbp), %eax
movq %rax, -0xa8(%rbp)
subq $0x3, %rax
ja 0x61ed
movq -0xa8(%rbp), %rax
leaq 0x93ef(%rip), %rcx      # 0xf26c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0xa98b(%rip), %rdi      # 0x10820
movb $0x0, %al
callq 0x20d0
movl $0x0, -0x34(%rbp)
movslq -0x34(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x5f13
leaq 0xa548(%rip), %rdi      # 0x103fc
movb $0x0, %al
callq 0x20d0
movl $0x0, -0x38(%rbp)
movslq -0x38(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x5efa
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0xa95c(%rip), %rdi      # 0x10844
movb $0x1, %al
callq 0x20d0
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x5ec2
leaq 0xa508(%rip), %rdi      # 0x10409
movb $0x0, %al
callq 0x20d0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x5ea3
leaq 0xa4f3(%rip), %rdi      # 0x1040d
movb $0x0, %al
callq 0x20d0
jmp 0x61ed
leaq 0xb082(%rip), %rdi      # 0x10faf
movb $0x0, %al
callq 0x20d0
movl $0x0, -0x3c(%rbp)
movslq -0x3c(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x5f61
movl -0x3c(%rbp), %esi
leaq 0xa4c2(%rip), %rdi      # 0x10411
movb $0x0, %al
callq 0x20d0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x5f3b
leaq 0x9503(%rip), %rdi      # 0xf46b
movb $0x0, %al
callq 0x20d0
movl $0x0, -0x40(%rbp)
movslq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x5fe9
movl -0x40(%rbp), %esi
leaq 0xa48d(%rip), %rdi      # 0x10417
movb $0x0, %al
callq 0x20d0
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x5fd0
movq -0x8(%rbp), %rax
movslq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x44(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0xa886(%rip), %rdi      # 0x10844
movb $0x1, %al
callq 0x20d0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x5f98
leaq 0x9494(%rip), %rdi      # 0xf46b
movb $0x0, %al
callq 0x20d0
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x5f76
jmp 0x61ed
leaq -0x80(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0xa429(%rip), %rsi      # 0x10426
movb $0x0, %al
callq 0x2280
leaq -0x80(%rbp), %rsi
leaq 0xa425(%rip), %rdi      # 0x10434
movb $0x0, %al
callq 0x20d0
movl $0x1, -0x84(%rbp)
leaq -0x80(%rbp), %rdi
leaq 0xa52c(%rip), %rsi      # 0x10557
callq 0x2210
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x90(%rbp)
jne 0x6078
movl $0x0, -0x84(%rbp)
movq 0xefa6(%rip), %rax      # 0x14ff8
movq (%rax), %rdi
leaq -0x80(%rbp), %rdx
leaq 0xa3ef(%rip), %rsi      # 0x1044f
movb $0x0, %al
callq 0x2140
movq 0xef8a(%rip), %rax      # 0x14ff8
movq (%rax), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0xa7c0(%rip), %rsi      # 0x1084e
movb $0x0, %al
callq 0x2140
movl $0x0, -0x94(%rbp)
movslq -0x94(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x6126
movl $0x0, -0x98(%rbp)
movslq -0x98(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x6110
movq -0x90(%rbp), %rdi
movl -0x94(%rbp), %edx
movl -0x98(%rbp), %ecx
movq -0x8(%rbp), %rax
movslq -0x94(%rbp), %rsi
movq (%rax,%rsi,8), %rax
movslq -0x98(%rbp), %rsi
movsd (%rax,%rsi,8), %xmm0
leaq 0xa766(%rip), %rsi      # 0x1085e
movb $0x1, %al
callq 0x2140
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x60b6
jmp 0x6112
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x609f
movq -0x90(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0xa730(%rip), %rsi      # 0x1086c
movb $0x0, %al
callq 0x2140
movl $0x0, -0x9c(%rbp)
movslq -0x9c(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x61d4
movl $0x0, -0xa0(%rbp)
movslq -0xa0(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x61be
movq -0x90(%rbp), %rdi
movl -0x9c(%rbp), %edx
movl -0xa0(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq -0x9c(%rbp), %rsi
movq (%rax,%rsi,8), %rax
movslq -0xa0(%rbp), %rsi
movsd (%rax,%rsi,8), %xmm0
leaq 0xa6b8(%rip), %rsi      # 0x1085e
movb $0x1, %al
callq 0x2140
movl -0xa0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x6164
jmp 0x61c0
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x614d
cmpl $0x0, -0x84(%rbp)
je 0x61e9
movq -0x90(%rbp), %rdi
callq 0x20b0
jmp 0x61eb
jmp 0x61ed
cmpl $0x0, -0x24(%rbp)
je 0x6201
leaq 0xa2c5(%rip), %rdi      # 0x104bf
movb $0x0, %al
callq 0x20d0
addq $0xb0, %rsp
popq %rbp
retq
nopw (%rax,%rax)