// File: /workspace/github_c_makefile_star2_O2/ComplexNetworks-DCC-FCUP[P]fase/FaseMain.cpp
// Function: output(Fase*)
void output(Fase* fase)
{
  printf("Finished Calculating\n");
  FILE *f = outFile;
  fprintf(f, "\tOutput:\n");
  fprintf(f, "Network: %s\n", ifilename);
  fprintf(f, "Directed: %s\n", dir ? "Yes" : "No");
  fprintf(f, "Nodes: %d\n", G->numNodes());
  fprintf(f, "Edges: %d\n", G->numEdges() / (dir ? 1 : 2));
  fprintf(f, "Subgraph Size: %d\n", K);
  if (largeScale)
    fprintf(f, "Graph Representation: Large Scale\n");
  else
    fprintf(f, "Graph Representation: Adjacency Matrix\n");

  t_end = time(0);
  struct tm *tm_start = localtime(&t_start);
  fprintf(f, "Start of Computation: %02dh%02dm%02ds %02d/%02d/%02d\n\
", tm_start->tm_hour, tm_start->tm_min, tm_start->tm_sec, tm_start->tm_mday, tm_start->tm_mon + 1, 1900 + tm_start->tm_year);
  struct tm *tm_end   = localtime(&t_end);
  fprintf(f, "End of Computation: %02dh%02dm%02ds %02d/%02d/%02d\n", tm_end->tm_hour, tm_end->tm_min, tm_end->tm_sec, tm_end->tm_mday, tm_end->tm_mon + 1, 1900 + tm_end->tm_year);
  
  fprintf(f, "\n\n\tResults:\n");
  fprintf(f, "Subgraph Occurrences: %lld\n", (long long int)(fase->getMotifCount() / prob));
  fprintf(f, "Subgraph Types: %d\n", fase->getTypes());
  fprintf(f, "Computation Time (ms): %0.4lf\n", Timer::elapsed());
  
  if (fabs(prob - 1.0) <= 10e-7)
    fprintf(f, "\nExact Enumeration, no Sampling done\n");
  else
  {
    fprintf(f, "\n\tSampling Information:\n");
    fprintf(f, "Percentage of Sampled Subgraphs: %0.2lf\%\n", 100 * prob);
    fprintf(f, "Percentage by depth:\n");
    int i;
    for (i = 0; i < K; i++)
      fprintf(f, "P[%d]: %0.3lf\%\n", i, 100 * sampProb[i]);
  }
    
  if (detailed)
  {
    fprintf(f, "\n\tDetailed Output:\n");
    for (auto element : fase->subgraphCount())
      if (samp && fabs(prob) > 10e-7)
        fprintf(f, "%s: %d occurrences\n", element.second.c_str(), (int)(element.first / prob));
      else
        fprintf(f, "%s: %d occurrences\n", element.second.c_str(), element.first);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
leaq 0x1f3a(%rip), %rdi      # 0xd5ab
callq 0x22a0
movq 0x818b(%rip), %rbx      # 0x13808
leaq 0x17c9(%rip), %rdi      # 0xce4d
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2350
leaq 0x17be(%rip), %rsi      # 0xce57
leaq 0x7fd0(%rip), %rdx      # 0x13670
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2270
leaq 0x17c1(%rip), %rax      # 0xce72
leaq 0x17be(%rip), %rdx      # 0xce76
cmpb $0x0, 0x7fa9(%rip)      # 0x13668
cmovneq %rax, %rdx
leaq 0x179a(%rip), %rsi      # 0xce64
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2270
movq 0x7ecd(%rip), %rdi      # 0x135a8
movq (%rdi), %rax
callq *0x38(%rax)
leaq 0x1791(%rip), %rsi      # 0xce79
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2270
movq 0x7ead(%rip), %rdi      # 0x135a8
movq (%rdi), %rax
callq *0x40(%rax)
movzbl 0x7f60(%rip), %ecx      # 0x13668
pushq $0x2
popq %rsi
subl %ecx, %esi
cltd
idivl %esi
leaq 0x176d(%rip), %rsi      # 0xce84
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2270
movl 0x7e87(%rip), %edx      # 0x135b0
leaq 0x175f(%rip), %rsi      # 0xce8f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2270
cmpb $0x1, 0x7f2b(%rip)      # 0x1366c
jne 0xb74e
leaq 0x1758(%rip), %rdi      # 0xcea2
pushq $0x22
jmp 0xb757
leaq 0x1770(%rip), %rdi      # 0xcec5
pushq $0x27
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2350
xorl %edi, %edi
callq 0x2160
movq %rax, 0x80a7(%rip)      # 0x13818
leaq 0x80a0(%rip), %r15      # 0x13818
leaq 0x8091(%rip), %rdi      # 0x13810
callq 0x2120
movl 0x8(%rax), %edx
movl (%rax), %r8d
movl 0x4(%rax), %ecx
movl 0xc(%rax), %r9d
movl 0x10(%rax), %r10d
incl %r10d
movl $0x76c, %r12d           # imm = 0x76C
movl 0x14(%rax), %r11d
addl %r12d, %r11d
leaq 0x1741(%rip), %rsi      # 0xceed
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x2270
popq %rcx
popq %rdx
movq %r15, %rdi
callq 0x2120
movl 0x8(%rax), %edx
movl (%rax), %r8d
movl 0x4(%rax), %ecx
movl 0xc(%rax), %r9d
movl 0x10(%rax), %r10d
incl %r10d
addl 0x14(%rax), %r12d
leaq 0x1740(%rip), %rsi      # 0xcf23
movq %rbx, %rdi
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x2270
popq %rcx
popq %rdx
leaq 0x175d(%rip), %rdi      # 0xcf57
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2350
cvtsi2sdl 0x14(%r14), %xmm0
divsd 0x7e4a(%rip), %xmm0     # 0x13660
cvttsd2si %xmm0, %rdx
leaq 0x1742(%rip), %rsi      # 0xcf64
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2270
movq %r14, %rdi
callq 0x2c7c
leaq 0x1745(%rip), %rsi      # 0xcf80
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2270
callq 0x4668
leaq 0x1741(%rip), %rsi      # 0xcf94
movq %rbx, %rdi
movb $0x1, %al
callq 0x2270
movsd 0x7dfb(%rip), %xmm0     # 0x13660
addsd 0x151b(%rip), %xmm0     # 0xcd88
andpd 0x152b(%rip), %xmm0     # 0xcda0
movsd 0x1503(%rip), %xmm1     # 0xcd80
ucomisd %xmm0, %xmm1
jae 0xb91a
leaq 0x174b(%rip), %rdi      # 0xcfd9
pushq $0x18
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2350
movsd 0x7db8(%rip), %xmm0     # 0x13660
mulsd 0x14e0(%rip), %xmm0     # 0xcd90
leaq 0x173b(%rip), %rsi      # 0xcff2
movq %rbx, %rdi
movb $0x1, %al
callq 0x2270
leaq 0x1754(%rip), %rdi      # 0xd01c
pushq $0x15
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2350
leaq 0x7ce3(%rip), %r13      # 0x135c0
xorl %r15d, %r15d
leaq 0x174b(%rip), %r12      # 0xd032
movslq 0x7cc2(%rip), %rax      # 0x135b0
cmpq %rax, %r15
jge 0xb92f
movsd (%r13), %xmm0
mulsd 0x148f(%rip), %xmm0     # 0xcd90
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
movb $0x1, %al
callq 0x2270
incq %r15
addq $0x8, %r13
jmp 0xb8e7
leaq 0x1692(%rip), %rdi      # 0xcfb3
pushq $0x25
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2350
cmpb $0x1, 0x7d33(%rip)      # 0x13669
jne 0xb9f3
leaq 0x16ff(%rip), %rdi      # 0xd042
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2350
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2c8a
movq (%r15), %r14
movq 0x8(%r15), %rbp
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
leaq 0x16dd(%rip), %r13      # 0xd056
cmpq %rbp, %r14
je 0xb9e9
movq %r12, %rdi
movq %r14, %rsi
callq 0xbb1c
cmpb $0x1, 0x7cdb(%rip)      # 0x1366b
jne 0xb9c5
movsd 0x7cc6(%rip), %xmm0     # 0x13660
movapd %xmm0, %xmm1
andpd 0x13fa(%rip), %xmm1     # 0xcda0
ucomisd 0x13d2(%rip), %xmm1     # 0xcd80
jbe 0xb9c5
cvtsi2sdl 0x8(%rsp), %xmm1
movq 0x10(%rsp), %rdx
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
jmp 0xb9ce
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %ecx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x2270
movq %r15, %rdi
callq 0x20c0
addq $0x28, %r14
jmp 0xb979
leaq 0x30(%rsp), %rdi
callq 0x2e3a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2e3a
movq %rbx, %rdi
callq 0x22f0