// File: /workspace/github_c_makefile_star2_O1/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 0x219c(%rip), %rdi      # 0xe59b
callq 0x2270
movq 0x73dd(%rip), %rbx      # 0x137e8
leaq 0x1a2b(%rip), %rdi      # 0xde3d
movl $0x9, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
leaq 0x1a1c(%rip), %rsi      # 0xde47
leaq 0x721e(%rip), %rdx      # 0x13650
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2240
leaq 0x1a1f(%rip), %rax      # 0xde62
leaq 0x1a1c(%rip), %rdx      # 0xde66
cmpb $0x0, 0x71f7(%rip)      # 0x13648
cmovneq %rax, %rdx
leaq 0x19f8(%rip), %rsi      # 0xde54
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2240
movq 0x711b(%rip), %rdi      # 0x13588
movq (%rdi), %rax
callq *0x38(%rax)
leaq 0x19ef(%rip), %rsi      # 0xde69
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2240
movq 0x70fb(%rip), %rdi      # 0x13588
movq (%rdi), %rax
callq *0x40(%rax)
movzbl 0x71ae(%rip), %ecx      # 0x13648
movl $0x2, %esi
subl %ecx, %esi
cltd
idivl %esi
leaq 0x19c9(%rip), %rsi      # 0xde74
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2240
movl 0x70d3(%rip), %edx      # 0x13590
leaq 0x19bb(%rip), %rsi      # 0xde7f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2240
cmpb $0x1, 0x7177(%rip)      # 0x1364c
jne 0xc4e5
leaq 0x19b4(%rip), %rdi      # 0xde92
movl $0x22, %esi
jmp 0xc4f1
leaq 0x19c9(%rip), %rdi      # 0xdeb5
movl $0x27, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
xorl %edi, %edi
callq 0x2150
movq %rax, 0x72ec(%rip)      # 0x137f8
leaq 0x72e5(%rip), %r15      # 0x137f8
leaq 0x72d6(%rip), %rdi      # 0x137f0
callq 0x2110
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 0x1996(%rip), %rsi      # 0xdedd
movq %rbx, %rdi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x2240
addq $0x10, %rsp
movq %r15, %rdi
callq 0x2110
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 0x1993(%rip), %rsi      # 0xdf13
movq %rbx, %rdi
xorl %eax, %eax
pushq %r12
pushq %r10
callq 0x2240
addq $0x10, %rsp
leaq 0x19ae(%rip), %rdi      # 0xdf47
movl $0xc, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
cvtsi2sdl 0x14(%r14), %xmm0
divsd 0x7087(%rip), %xmm0     # 0x13640
cvttsd2si %xmm0, %rdx
leaq 0x198f(%rip), %rsi      # 0xdf54
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2240
movq %r14, %rdi
callq 0x2fae
leaq 0x1992(%rip), %rsi      # 0xdf70
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2240
callq 0x4e2c
leaq 0x198e(%rip), %rsi      # 0xdf84
movq %rbx, %rdi
movb $0x1, %al
callq 0x2240
movsd 0x7038(%rip), %xmm0     # 0x13640
addsd 0x1768(%rip), %xmm0     # 0xdd78
andpd 0x1778(%rip), %xmm0     # 0xdd90
movsd 0x1750(%rip), %xmm1     # 0xdd70
ucomisd %xmm0, %xmm1
jae 0xc6ca
leaq 0x1998(%rip), %rdi      # 0xdfc9
movl $0x18, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
movsd 0x6ff5(%rip), %xmm0     # 0x13640
mulsd 0x172d(%rip), %xmm0     # 0xdd80
leaq 0x1988(%rip), %rsi      # 0xdfe2
movq %rbx, %rdi
movb $0x1, %al
callq 0x2240
leaq 0x19a1(%rip), %rdi      # 0xe00c
movl $0x15, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
cmpl $0x0, 0x6f0c(%rip)      # 0x13590
jle 0xc6e3
leaq 0x6f13(%rip), %r13      # 0x135a0
xorl %r15d, %r15d
leaq 0x198b(%rip), %r12      # 0xe022
movsd (%r13), %xmm0
mulsd 0x16db(%rip), %xmm0     # 0xdd80
movq %rbx, %rdi
movq %r12, %rsi
movl %r15d, %edx
movb $0x1, %al
callq 0x2240
incq %r15
movslq 0x6ed1(%rip), %rax      # 0x13590
addq $0x8, %r13
cmpq %rax, %r15
jl 0xc697
jmp 0xc6e3
leaq 0x18d2(%rip), %rdi      # 0xdfa3
movl $0x25, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
cmpb $0x1, 0x6f5f(%rip)      # 0x13649
jne 0xc7df
leaq 0x193b(%rip), %rdi      # 0xe032
movl $0x13, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2320
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2fbc
movq (%r15), %r12
movq 0x8(%r15), %r13
cmpq %r13, %r12
je 0xc7d5
leaq 0x10(%rsp), %r14
leaq 0x20(%rsp), %rbp
leaq 0x190c(%rip), %r15      # 0xe046
movl (%r12), %eax
movl %eax, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
movq 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x32a2
cmpb $0x1, 0x6ee8(%rip)      # 0x1364b
jne 0xc79b
movsd 0x6ed3(%rip), %xmm0     # 0x13640
movapd %xmm0, %xmm1
andpd 0x1617(%rip), %xmm1     # 0xdd90
ucomisd 0x15ef(%rip), %xmm1     # 0xdd70
jbe 0xc79b
xorps %xmm1, %xmm1
cvtsi2sdl 0x8(%rsp), %xmm1
movq 0x10(%rsp), %rdx
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
jmp 0xc7a4
movq 0x10(%rsp), %rdx
movl 0x8(%rsp), %ecx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2240
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0xc7c8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
addq $0x28, %r12
cmpq %r13, %r12
jne 0xc73a
leaq 0x30(%rsp), %rdi
callq 0x31ce
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x31ce
movq %rbx, %rdi
callq 0x22c0