// File: /workspace/github_c_makefile_star2_O3/LPD-EPFL[P]mctop/src/mctop.c
// Function: print_pow_table
void 
print_pow_table(double*** pt, const uint n_sockets, test_format_t test_format, const char* hostname)
{
  if (test_format == MCT_FILE)
    {
      printf("## Power info ############################################################\n");
      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, "#Power_measurements %d\n", MCTOP_POW_TYPE_NUM);
      for (uint s = 0; s <= n_sockets; s++)
	{
	  const char* text = (s < n_sockets) ? "sockt" : "total";
	  uint type = 0;
	  double* d = pt[type++][s];
	  fprintf(ofp, "Power_%s_%d_idle \t"P5DOUBLEP"\n", text, s, G5DOUBLE(d));
	  d = pt[type++][s];
	  fprintf(ofp, "Power_%s_%d_1stcore \t"P5DOUBLEP"\n", text, s, G5DOUBLE(d));
	  d = pt[type++][s];
	  fprintf(ofp, "Power_%s_%d_2ndcore \t"P5DOUBLEP"\n", text, s, G5DOUBLE(d));
	  d = pt[type++][s];
	  fprintf(ofp, "Power_%s_%d_2ndhwc \t"P5DOUBLEP"\n", text, s, G5DOUBLE(d));
	  d = pt[type++][s];
	  fprintf(ofp, "Power_%s_%d_allcor \t"P5DOUBLEP"\n", text, s, G5DOUBLE(d));
	  d = pt[type++][s];
	  fprintf(ofp, "Power_%s_%d_allhwc \t"P5DOUBLEP"\n", text, s, G5DOUBLE(d));
	}
      if (ofp_open)
	{
	  fclose(ofp);
	}
      printf("##########################################################################\n");
    }
}

// Assembly:
cmpl $0x3, %edx
jne 0x582b
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movl %esi, %ebx
movq %rdi, %r14
leaq 0x60aa(%rip), %rdi      # 0xb6e0
callq 0x2080
leaq 0x512a(%rip), %rsi      # 0xa76c
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
leaq 0x511d(%rip), %rdi      # 0xa77a
movq %r12, %rsi
xorl %eax, %eax
callq 0x2100
leaq 0x5197(%rip), %rsi      # 0xa805
movq %r12, %rdi
callq 0x2240
movq %rax, %r12
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x582c
leaq 0x51c7(%rip), %rsi      # 0xa855
movq %r12, %rdi
movl $0x6, %edx
xorl %eax, %eax
callq 0x2170
cmpl %ebx, %ebp
leaq 0x51cd(%rip), %r13      # 0xa873
leaq 0x51c0(%rip), %rax      # 0xa86d
cmovbq %rax, %r13
movq (%r14), %rax
movl %ebp, %r15d
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd 0x18(%rax), %xmm3
movsd 0x20(%rax), %xmm4
movq %r12, %rdi
leaq 0x519c(%rip), %rsi      # 0xa879
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
movq 0x8(%r14), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd 0x18(%rax), %xmm3
movsd 0x20(%rax), %xmm4
movq %r12, %rdi
leaq 0x5198(%rip), %rsi      # 0xa8ab
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd 0x18(%rax), %xmm3
movsd 0x20(%rax), %xmm4
movq %r12, %rdi
leaq 0x5197(%rip), %rsi      # 0xa8e0
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
movq 0x18(%r14), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd 0x18(%rax), %xmm3
movsd 0x20(%rax), %xmm4
movq %r12, %rdi
leaq 0x5196(%rip), %rsi      # 0xa915
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd 0x18(%rax), %xmm3
movsd 0x20(%rax), %xmm4
movq %r12, %rdi
leaq 0x5194(%rip), %rsi      # 0xa949
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
movq 0x28(%r14), %rax
movq (%rax,%r15,8), %rax
movsd (%rax), %xmm0
movsd 0x8(%rax), %xmm1
movsd 0x10(%rax), %xmm2
movsd 0x18(%rax), %xmm3
movsd 0x20(%rax), %xmm4
movq %r12, %rdi
leaq 0x5192(%rip), %rsi      # 0xa97d
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
incl %ebp
cmpl %ebx, %ebp
jbe 0x569d
cmpq $0x0, 0x8(%rsp)
je 0x5811
movq %r12, %rdi
callq 0x20e0
leaq 0x5f13(%rip), %rdi      # 0xb72b
callq 0x2080
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa7bd(%rip), %r15      # 0xfff0
movq (%r15), %rdi
leaq 0x4f58(%rip), %rsi      # 0xa795
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x2170
movq (%r15), %r12
jmp 0x5687
nopl (%rax)