// File: /workspace/github_c_makefile_star2_O1/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 0x5830
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 0x70a5(%rip), %rdi      # 0xc6e0
callq 0x2080
leaq 0x6125(%rip), %rsi      # 0xb76c
xorl %ebp, %ebp
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22b0
leaq 0x6118(%rip), %rdi      # 0xb77a
movq %r12, %rsi
xorl %eax, %eax
callq 0x2100
leaq 0x6192(%rip), %rsi      # 0xb805
movq %r12, %rdi
callq 0x2240
movq %rax, %r12
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x5831
leaq 0x61c2(%rip), %rsi      # 0xb855
movq %r12, %rdi
movl $0x6, %edx
xorl %eax, %eax
callq 0x2170
cmpl %ebx, %ebp
leaq 0x61c8(%rip), %r13      # 0xb873
leaq 0x61bb(%rip), %rax      # 0xb86d
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 0x6197(%rip), %rsi      # 0xb879
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 0x6193(%rip), %rsi      # 0xb8ab
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 0x6192(%rip), %rsi      # 0xb8e0
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 0x6191(%rip), %rsi      # 0xb915
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 0x618f(%rip), %rsi      # 0xb949
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 0x618d(%rip), %rsi      # 0xb97d
movq %r13, %rdx
movl %ebp, %ecx
movb $0x5, %al
callq 0x2170
incl %ebp
cmpl %ebx, %ebp
jbe 0x56a2
cmpq $0x0, 0x8(%rsp)
je 0x5816
movq %r12, %rdi
callq 0x20e0
leaq 0x6f0e(%rip), %rdi      # 0xc72b
callq 0x2080
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb7b8(%rip), %r15      # 0x10ff0
movq (%r15), %rdi
leaq 0x5f53(%rip), %rsi      # 0xb795
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x2170
movq (%r15), %r12
jmp 0x568c
nop