// File: /workspace/github_c_makefile_star2_O3/ComplexNetworks-DCC-FCUP[P]gtrieScanner/CmdLine.cpp
// Function: CmdLine::show_results(ResultType*, int)
void CmdLine::show_results(ResultType *res, int nres) {
  int i, j, k;
  bool html = (output==HTML)?true:false;

  if (html) fprintf(f_output, "<html><head>\n"
		    "<title>%s results</title>\n"
		    "<style type=\"text/css\">"
		    "p,body,td,th,li  {font-size: 13px; font-family: arial, geneva, \"sans serif\";color: black; font-weight: normal;}\n"
		    "body, tr {background-color: #fbfbfb;}\n"
		    "hr {color: black;}\n"
		    "table {background-color: black;}\n"
		    "th {color:white;}\n"
		    "td {text-align: right;}\n"
		    ".odd  {background-color: #d1d1d1;}\n"
		    ".even {background-color: #f2f2f2;}\n"
		    ".hd   {background-color: #444444; color: white;}\n"
		    ".pre  {white-space: pre;}\n"
		    "</style>"
		    "</head>\n<body>",
		    PROGRAM_NAME);

  fprintf(f_output, "%s%s Results%s\n", html?"<h1>":"", PROGRAM_NAME, html?"</h1>":"");
  
  if (html) fprintf(f_output, "<hr>\n");
  else      fprintf(f_output, "%s\n", SEPARATOR);

  fprintf(f_output, "%sGeneral Information%s\n", html?"<h2>":"", html?"</h2>":"\n");

  time_t t_end = time(0);
  struct tm *tm_start = localtime(&t_start);
  fprintf(f_output, "%sStart of Computation:%s %02dh%02dm%02ds %02d/%02d/%02d\n",
	  html?"<li><b>":"",html?"</b>":"",
	  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_output, "%sEnd of Computation:%s %02dh%02dm%02ds %02d/%02d/%02d\n",
	  html?"<li><b>":"",html?"</b>":"",
	  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);

  if (html) fprintf(f_output, "<br>&nbsp;\n");
  else      fprintf(f_output, "\n");

  fprintf(f_output, "%sSubgraph Size:%s %d\n", html?"<li><b>":"", html?"</b>":"", motif_size);
  fprintf(f_output, "%sGraph File:%s \"%s\"\n", html?"<li><b>":"", html?"</b>":"",graph_file);
  fprintf(f_output, "%sDirected:%s %s\n", html?"<li><b>":"", html?"</b>":"",dir?"YES":"NO");
  fprintf(f_output, "%sNr Nodes:%s %d\n", html?"<li><b>":"", html?"</b>":"",g->numNodes());
  fprintf(f_output, "%sNr Edges:%s %d\n", html?"<li><b>":"", html?"</b>":"",dir?g->numEdges():g->numEdges()/2);
  
  if (html) fprintf(f_output, "<br>&nbsp;\n");
  else      fprintf(f_output, "\n");

  fprintf(f_output, "%sMethod:%s ", html?"<li><b>":"", html?"</b>":"");
  if (method == ESU)
    fprintf(f_output, "ESU on original network\n");
  else if (method == GTRIE)
    fprintf(f_output, "GTRIE with file containing complete g-trie\n");
  else if (method == SUBGRAPHS)
    fprintf(f_output, "GTRIE with subgraphs read from file\n");

  fprintf(f_output, "%sDifferent Types of Subgraphs Found [Original Network]:%s %d\n", html?"<li><b>":"", html?"</b>":"", sg_original.countGraphs());
  fprintf(f_output, "%sSubgraph Occurrences Found [Original Network]:%s %.0f\n", html?"<li><b>":"", html?"</b>":"", sg_original.countOccurrences());
  fprintf(f_output, "%sTime for computing census on original network%s: %.6fs\n", html?"<li><b>":"", html?"</b>":"", time_original);
  fprintf(f_output, "%sAverage time for census on random network%s: %.6fs\n", html?"<li><b>":"", html?"</b>":"", time_random);

  if (html) fprintf(f_output, "<br>&nbsp;\n");
  else      fprintf(f_output, "\n");

  fprintf(f_output, "%sNumber of random networks:%s %d\n", html?"<li><b>":"", html?"</b>":"", random_number);
  fprintf(f_output, "%sRandom seed:%s %d\n", html?"<li><b>":"", html?"</b>":"", random_seed);
  fprintf(f_output, "%sExchanges per edge:%s %d\n", html?"<li><b>":"", html?"</b>":"", random_exchanges);
  fprintf(f_output, "%sNumber of tries per exchange:%s %d\n", html?"<li><b>":"", html?"</b>":"", random_tries);

  if (html) fprintf(f_output, "<hr>\n");
  else      fprintf(f_output, "%s\n", SEPARATOR);

  fprintf(f_output, "%sMotif Analysis Results%s\n", html?"<h2>":"", html?"</h2>":"");

  char adj[motif_size*motif_size+motif_size];

  if (html) fprintf(f_output, "<table cellpadding=\"3\" cellspacing=\"2\">\n<tr class=\"hd\"><th colspan=\"2\">Subgraph</th><th>Org. Frequency</th><th>Z-score</th><th>Rnd. Frequency</th></tr>\n");
  else fprintf(f_output, "\nGraph%*s   Org_Freq |  Z-score |    Rnd_Avg +/-    Rnd_Dev\n\n", motif_size>5?motif_size-5:0, "");
  for (i=0; i<nres; i++) {

    for (j=0, k=0; res[i].s[j]; j++, k++) {
      if (j>0 && j%motif_size==0) adj[k++] = '\n';
      adj[k] = res[i].s[j];
    }
    adj[k]=0;

    if (html) 
      fprintf(f_output, "<tr class=\"%s\"><td><img src=\"http://www.dcc.fc.up.pt/gtries/graph.php?%swidth=75&height=75&adj=%s\"></td><td class=\"pre\">%s</td><td>%d</td><td>%.2f</td><td>%.2f +/- %.2f</td></tr>\n",
	      (i%2)?"odd":"even", dir?"dir&":"",
	      res[i].s, adj, res[i].f_original,
	      res[i].z_score, res[i].avg_random, res[i].dev_random);
    else
      fprintf(f_output, "%s%*s %10d | %8.2f | %10.2f +/- %10.2f\n\n",
	      adj, motif_size<5?5-motif_size:0, "", res[i].f_original,
	      res[i].z_score, res[i].avg_random, res[i].dev_random);
  }
  if (html) fprintf(f_output, "</table>\n");


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, -0x3c(%rbp)
movq %rdi, %rbx
movl 0x1613b(%rip), %eax     # 0x19730
movq 0x16144(%rip), %rdi     # 0x19740
movl %eax, -0x2c(%rbp)
cmpl $0x2, %eax
jne 0x3681
leaq 0xdcbf(%rip), %rsi      # 0x112ca
leaq 0xde92(%rip), %r14      # 0x114a4
movq %r14, %rdx
xorl %eax, %eax
callq 0x22d0
movq 0x1611d(%rip), %rdi     # 0x19740
leaq 0xde87(%rip), %rsi      # 0x114b1
leaq 0xde90(%rip), %rdx      # 0x114c1
leaq 0xde8e(%rip), %r8       # 0x114c6
movq %r14, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x160f7(%rip), %rcx     # 0x19740
leaq 0xde7c(%rip), %rdi      # 0x114cc
movl $0x5, %esi
movl $0x1, %edx
callq 0x23e0
leaq 0xdeb0(%rip), %rdx      # 0x11516
leaq 0xdeae(%rip), %rcx      # 0x1151b
leaq 0xdee7(%rip), %rax      # 0x1155b
movq %rax, -0x38(%rbp)
leaq 0xdee4(%rip), %r12      # 0x11563
jmp 0x36d0
leaq 0xde29(%rip), %rsi      # 0x114b1
leaq 0xde15(%rip), %rcx      # 0x114a4
leaq 0xda12(%rip), %r14      # 0x110a8
movq %r14, %rdx
movq %r14, %r8
xorl %eax, %eax
callq 0x22d0
movq 0x16096(%rip), %rdi     # 0x19740
leaq 0xee3c(%rip), %rsi      # 0x124ed
leaq 0xde1a(%rip), %rdx      # 0x114d2
xorl %eax, %eax
callq 0x22d0
leaq 0xd9e1(%rip), %rcx      # 0x110a7
movq %r14, -0x38(%rbp)
movq %r14, %r12
movq %r14, %rdx
movq 0x16069(%rip), %rdi     # 0x19740
leaq 0xde1f(%rip), %rsi      # 0x114fd
movq %rdx, -0x50(%rbp)
xorl %eax, %eax
callq 0x22d0
xorl %edi, %edi
callq 0x21c0
leaq -0x58(%rbp), %rcx
movq %rax, (%rcx)
leaq 0x1606a(%rip), %rdi     # 0x19768
callq 0x2170
movq 0x16036(%rip), %rdi     # 0x19740
movl 0x8(%rax), %r8d
movl (%rax), %r10d
movl 0x4(%rax), %r9d
movl 0xc(%rax), %r11d
movl 0x10(%rax), %r14d
incl %r14d
movl $0x76c, %r15d           # imm = 0x76C
movl 0x14(%rax), %r13d
addl %r15d, %r13d
leaq 0xdded(%rip), %rsi      # 0x11521
movq -0x38(%rbp), %rdx
movq %r12, %rcx
xorl %eax, %eax
pushq %r13
pushq %r14
pushq %r11
pushq %r10
callq 0x22d0
addq $0x20, %rsp
leaq -0x58(%rbp), %rdi
callq 0x2170
movq 0x15fe2(%rip), %rdi     # 0x19740
movl 0x8(%rax), %r8d
movl (%rax), %r10d
movl 0x4(%rax), %r9d
movl 0xc(%rax), %r11d
movl 0x10(%rax), %r14d
incl %r14d
addl 0x14(%rax), %r15d
leaq 0xdde9(%rip), %rsi      # 0x11568
movq -0x38(%rbp), %r13
movq %r13, %rdx
movq %r12, -0x48(%rbp)
movq %r12, %rcx
xorl %eax, %eax
pushq %r15
pushq %r14
pushq %r11
pushq %r10
callq 0x22d0
addq $0x20, %rsp
movq 0x15f99(%rip), %rcx     # 0x19740
cmpl $0x2, -0x2c(%rbp)
jne 0x37c5
leaq 0xddec(%rip), %rdi      # 0x115a0
movl $0xb, %esi
movl $0x1, %edx
callq 0x23e0
jmp 0x37d2
movl $0xa, %edi
movq %rcx, %rsi
callq 0x2280
movq 0x15f67(%rip), %rdi     # 0x19740
movl 0x15f24(%rip), %r8d     # 0x19704
leaq 0xddc5(%rip), %rsi      # 0x115ac
movq %r13, %rdx
movq -0x48(%rbp), %r12
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15f41(%rip), %rdi     # 0x19740
leaq 0xddbd(%rip), %rsi      # 0x115c3
leaq 0x14af3(%rip), %r8      # 0x18300
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15f1f(%rip), %rdi     # 0x19740
leaq 0xddc3(%rip), %rax      # 0x115eb
leaq 0xddc0(%rip), %r8       # 0x115ef
cmpb $0x0, 0x15eca(%rip)     # 0x19700
cmovneq %rax, %r8
leaq 0xdd98(%rip), %rsi      # 0x115d9
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15eeb(%rip), %r14     # 0x19740
movq 0x15edc(%rip), %rdi     # 0x19738
movq (%rdi), %rax
callq *0x40(%rax)
leaq 0xdd89(%rip), %rsi      # 0x115f2
movq %r14, %rdi
movq %r13, %rdx
movq %r12, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x22d0
movq 0x15ebd(%rip), %r14     # 0x19740
movq 0x15eae(%rip), %rdi     # 0x19738
movq (%rdi), %rax
movb 0x15e6c(%rip), %r15b    # 0x19700
callq *0x48(%rax)
movl %eax, %r8d
shrl $0x1f, %r8d
addl %eax, %r8d
sarl %r8d
testb %r15b, %r15b
cmovnel %eax, %r8d
leaq 0xdd52(%rip), %rsi      # 0x11604
movq %r14, %rdi
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15e77(%rip), %rcx     # 0x19740
cmpl $0x2, -0x2c(%rbp)
jne 0x38e7
leaq 0xdcca(%rip), %rdi      # 0x115a0
movl $0xb, %esi
movl $0x1, %edx
callq 0x23e0
jmp 0x38f4
movl $0xa, %edi
movq %rcx, %rsi
callq 0x2280
movq 0x15e45(%rip), %rdi     # 0x19740
leaq 0xdd14(%rip), %rsi      # 0x11616
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movl 0x15e13(%rip), %eax     # 0x19728
cmpl $0x3, %eax
je 0x394e
cmpl $0x2, %eax
je 0x3939
cmpl $0x1, %eax
jne 0x396b
movq 0x15e15(%rip), %rcx     # 0x19740
leaq 0xdcf1(%rip), %rdi      # 0x11623
movl $0x18, %esi
jmp 0x3961
movq 0x15e00(%rip), %rcx     # 0x19740
leaq 0xdcf5(%rip), %rdi      # 0x1163c
movl $0x2b, %esi
jmp 0x3961
movq 0x15deb(%rip), %rcx     # 0x19740
leaq 0xdd0c(%rip), %rdi      # 0x11668
movl $0x24, %esi
movl $0x1, %edx
callq 0x23e0
movq 0x15dce(%rip), %r14     # 0x19740
leaq 0x15de7(%rip), %r15     # 0x19760
movq %r15, %rdi
callq 0xbec6
leaq 0xdd05(%rip), %rsi      # 0x1168d
movq %r14, %rdi
movq %r13, %rdx
movq %r12, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x22d0
movq 0x15d9e(%rip), %r14     # 0x19740
movq %r15, %rdi
callq 0xbebe
leaq 0xdd1b(%rip), %rsi      # 0x116cc
movq %r14, %rdi
movq %r13, %rdx
movq %r12, %rcx
movb $0x1, %al
callq 0x22d0
movq 0x15d78(%rip), %rdi     # 0x19740
movsd 0x15d48(%rip), %xmm0    # 0x19718
leaq 0xdd2e(%rip), %rsi      # 0x11705
movq %r13, %rdx
movq %r12, %rcx
movb $0x1, %al
callq 0x22d0
movq 0x15d55(%rip), %rdi     # 0x19740
movsd 0x15d2d(%rip), %xmm0    # 0x19720
leaq 0xdd45(%rip), %rsi      # 0x1173f
movq %r13, %rdx
movq %r12, %rcx
movb $0x1, %al
callq 0x22d0
movq 0x15d32(%rip), %rcx     # 0x19740
cmpl $0x2, -0x2c(%rbp)
jne 0x3a2c
leaq 0xdb85(%rip), %rdi      # 0x115a0
movl $0xb, %esi
movl $0x1, %edx
callq 0x23e0
jmp 0x3a39
movl $0xa, %edi
movq %rcx, %rsi
callq 0x2280
movq 0x15d00(%rip), %rdi     # 0x19740
movl 0x15cc1(%rip), %r8d     # 0x19708
leaq 0xdd27(%rip), %rsi      # 0x11775
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15cde(%rip), %rdi     # 0x19740
movl 0x15ca3(%rip), %r8d     # 0x1970c
leaq 0xdd28(%rip), %rsi      # 0x11798
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15cbc(%rip), %rdi     # 0x19740
movl 0x15c85(%rip), %r8d     # 0x19710
leaq 0xdd1b(%rip), %rsi      # 0x117ad
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15c9a(%rip), %rdi     # 0x19740
movl 0x15c67(%rip), %r8d     # 0x19714
leaq 0xdd15(%rip), %rsi      # 0x117c9
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x22d0
movq 0x15c78(%rip), %rcx     # 0x19740
cmpl $0x2, -0x2c(%rbp)
jne 0x3aed
leaq 0xd9f7(%rip), %rdi      # 0x114cc
movl $0x5, %esi
movl $0x1, %edx
callq 0x23e0
leaq 0xda30(%rip), %rcx      # 0x1151b
jmp 0x3b0c
leaq 0xe9f9(%rip), %rsi      # 0x124ed
leaq 0xd9d7(%rip), %rdx      # 0x114d2
movq %rcx, %rdi
xorl %eax, %eax
callq 0x22d0
leaq 0xd59c(%rip), %rcx      # 0x110a8
movq 0x15c2d(%rip), %rdi     # 0x19740
leaq 0xdcd5(%rip), %rsi      # 0x117ef
xorl %r14d, %r14d
movq -0x50(%rbp), %rdx
xorl %eax, %eax
callq 0x22d0
movq %rsp, -0x38(%rbp)
movl 0x15bd2(%rip), %eax     # 0x19704
leal 0x1(%rax), %ecx
imull %eax, %ecx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %r15
subq %rcx, %r15
movq %r15, %rsp
movq 0x15bf0(%rip), %rcx     # 0x19740
cmpl $0x2, -0x2c(%rbp)
jne 0x3b6e
leaq 0xdcae(%rip), %rdi      # 0x1180b
movl $0x98, %esi
movl $0x1, %edx
callq 0x23e0
jmp 0x3b99
movl 0x15b90(%rip), %eax     # 0x19704
leal -0x5(%rax), %edx
cmpl $0x6, %eax
cmovll %r14d, %edx
leaq 0xdd1f(%rip), %rsi      # 0x118a4
leaq 0xd51c(%rip), %rax      # 0x110a8
movq %rcx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x22d0
movl -0x3c(%rbp), %eax
testl %eax, %eax
jle 0x3cc4
movl %eax, %r12d
leaq 0xd4fa(%rip), %r14      # 0x110a8
xorl %r13d, %r13d
leaq (,%r13,4), %rsi
addq %r13, %rsi
movq (%rbx,%rsi,8), %r8
movb (%r8), %r10b
xorl %ecx, %ecx
testb %r10b, %r10b
je 0x3c0a
movl 0x15b34(%rip), %edi     # 0x19704
xorl %r9d, %r9d
testq %rcx, %rcx
je 0x3bf0
movl %ecx, %eax
cltd
idivl %edi
testl %edx, %edx
jne 0x3bf0
movslq %r9d, %rax
incl %r9d
movb $0xa, (%r15,%rax)
movb (%r8,%rcx), %r10b
movslq %r9d, %r9
movb %r10b, (%r15,%r9)
incl %r9d
movb 0x1(%r8,%rcx), %r10b
incq %rcx
testb %r10b, %r10b
jne 0x3bd3
movslq %r9d, %rcx
leaq (%rbx,%rsi,8), %rax
movb $0x0, (%r15,%rcx)
movq 0x15b26(%rip), %rdi     # 0x19740
cmpl $0x2, -0x2c(%rbp)
jne 0x3c7b
testb $0x1, %r13b
leaq 0xdd6b(%rip), %rdx      # 0x11996
leaq 0xdd68(%rip), %rcx      # 0x1199a
cmoveq %rcx, %rdx
cmpb $0x0, 0x15ac3(%rip)     # 0x19700
movq %r14, %rcx
leaq 0xdd58(%rip), %rsi      # 0x1199f
cmovneq %rsi, %rcx
movl 0x8(%rax), %r10d
movsd 0x20(%rax), %xmm0
movsd 0x10(%rax), %xmm1
movsd 0x18(%rax), %xmm2
subq $0x8, %rsp
leaq 0xdc79(%rip), %rsi      # 0x118e2
movq %r15, %r9
movb $0x3, %al
pushq %r10
callq 0x22d0
addq $0x10, %rsp
jmp 0x3cb8
movl 0x15a83(%rip), %edx     # 0x19704
leal -0x5(%rdx), %ecx
negl %ecx
cmpl $0x5, %edx
movl $0x0, %edx
cmovgel %edx, %ecx
movl 0x8(%rax), %r9d
movsd 0x20(%rax), %xmm0
movsd 0x10(%rax), %xmm1
movsd 0x18(%rax), %xmm2
leaq 0xdcf9(%rip), %rsi      # 0x119a4
movq %r15, %rdx
movq %r14, %r8
movb $0x3, %al
callq 0x22d0
incq %r13
cmpq %r12, %r13
jne 0x3bb1
cmpl $0x2, -0x2c(%rbp)
jne 0x3ce7
movq 0x15a6f(%rip), %rcx     # 0x19740
leaq 0xdcf5(%rip), %rdi      # 0x119cd
movl $0x9, %esi
movl $0x1, %edx
callq 0x23e0
movq -0x38(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq