// File: /workspace/github_cpp_makefile_star2_O3/codeniko[P]mossel_tov/mossel_tov.cpp
// Function: genPage(std::vector<Match, std::allocator<Match>>, std::vector<std::vector<Student, std::allocator<Student>>, std::allocator<std::vector<Student, std::allocator<Student>>>>)
void genPage(vector<Match> matches, vector< vector<Student> > groups) {
	ofstream page;
	page.open(PAGERESULTS);
	if (!page.is_open()) {
		cerr << "Unable to write to " << PAGERESULTS << endl;
		exit(2);
	}

	page << "<html><head><title>Mossel Tov! - an grouping extension to the moss plagiarism detector</title><link rel=\"stylesheet\" type=\"text/css\" href=\"mossel_tov.css\"></head><body><table><tr><th></th><th> Matches with other Students <i>(# lines identical)</i></th></tr>";

	int i = 1;
	for (vector< vector<Student> >::iterator group_it = groups.begin(); group_it != groups.end(); group_it++, i++) {
		page << "<tr> <td colspan=\"2\" id=\"group_header\">Group " << i << "</td></tr>";
		for (vector<Student>::iterator stud_it = group_it->begin(); stud_it != group_it->end(); stud_it++) {
			vector<Match> studentMatches = getStudentMatches(matches, *stud_it);
			page << "<tr><td>" << stud_it->student << "</td><td>";
			for (vector<Match>::iterator match_it = studentMatches.begin(); match_it != studentMatches.end(); match_it++) {
				page << "<a href=\"http://moss.stanford.edu/results/" << match_it->url << "\">(" << match_it->hasStudent(*stud_it) << "," << match_it->numIdentical << ")</a> ";
			}
			page << "</td></tr>";
		}
	}
	page << "</table></body></html>";

	page.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rsi, 0x18(%rsp)
movq %rdi, 0x40(%rsp)
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x2280
leaq 0x5a60(%rip), %rsi      # 0x8020
movq %rbx, %rdi
movl $0x10, %edx
callq 0x2050
leaq 0xe8(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x285f
leaq 0x5a5b(%rip), %rsi      # 0x8044
leaq 0x78(%rsp), %rdi
movl $0x101, %edx            # imm = 0x101
callq 0x21e0
movq 0x18(%rsp), %rax
movq (%rax), %rcx
movq %rcx, 0x10(%rsp)
cmpq 0x8(%rax), %rcx
je 0x27f8
movl $0x1, 0xc(%rsp)
leaq 0x78(%rsp), %r12
leaq 0x60(%rsp), %r14
leaq 0x48(%rsp), %r13
leaq 0x5b94(%rip), %rbx      # 0x81c1
leaq 0x5b8f(%rip), %r15      # 0x81c3
movl $0x2d, %edx
movq %r12, %rdi
leaq 0x5b03(%rip), %rsi      # 0x8146
callq 0x21e0
movq %r12, %rdi
movl 0xc(%rsp), %esi
callq 0x2290
movl $0xa, %edx
movq %rax, %rdi
leaq 0x5b11(%rip), %rsi      # 0x8174
callq 0x21e0
movq 0x10(%rsp), %rax
movq (%rax), %rbp
cmpq 0x8(%rax), %rbp
je 0x27d7
movq %r14, %rdi
movq 0x40(%rsp), %rsi
callq 0x34a4
movq %r13, %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x247a
movq %r14, %rdi
callq 0x345a
movl $0x8, %edx
movq %r12, %rdi
leaq 0x5ad3(%rip), %rsi      # 0x817f
callq 0x21e0
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
movq %r12, %rdi
callq 0x21e0
movl $0x9, %edx
movq %rax, %rdi
leaq 0x5ab8(%rip), %rsi      # 0x8188
callq 0x21e0
movq 0x48(%rsp), %r13
cmpq 0x50(%rsp), %r13
je 0x27a3
movl $0x2a, %edx
movq %r12, %rdi
leaq 0x5a9e(%rip), %rsi      # 0x8192
callq 0x21e0
movq 0x40(%r13), %rsi
movq 0x48(%r13), %rdx
movq %r12, %rdi
callq 0x21e0
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0x5aa2(%rip), %rsi      # 0x81bd
callq 0x21e0
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x337c
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %r14, %rdi
callq 0x21e0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x21e0
movq 0xa0(%r13), %rsi
movq 0xa8(%r13), %rdx
movq %r14, %rdi
callq 0x21e0
movl $0x6, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21e0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2797
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21b0
addq $0xc0, %r13
jmp 0x26da
movl $0xa, %edx
movq %r12, %rdi
leaq 0x59c2(%rip), %rsi      # 0x8174
callq 0x21e0
leaq 0x60(%rsp), %r14
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x345a
addq $0x28, %rbp
movq 0x10(%rsp), %rax
jmp 0x2670
movq 0x10(%rsp), %rcx
addq $0x18, %rcx
incl 0xc(%rsp)
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rsp)
cmpq 0x8(%rax), %rcx
jne 0x2634
leaq 0x59cb(%rip), %rsi      # 0x81ca
leaq 0x78(%rsp), %rdi
movl $0x16, %edx
callq 0x21e0
leaq 0x78(%rsp), %rdi
callq 0x2210
movq 0x87a9(%rip), %rax      # 0xafc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x78(%rsp,%rcx)
callq 0x2160
leaq 0x170(%rsp), %rdi
callq 0x20b0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x878a(%rip), %rdi      # 0xaff0
leaq 0x57c3(%rip), %rsi      # 0x8030
movl $0x13, %edx
callq 0x21e0
movq 0x8772(%rip), %rdi      # 0xaff0
leaq 0x579b(%rip), %rsi      # 0x8020
movl $0xf, %edx
callq 0x21e0
movq 0x875a(%rip), %rdi      # 0xaff0
callq 0x20e0
movl $0x2, %edi
callq 0x21f0
jmp 0x28ab
jmp 0x28ab
jmp 0x28ab
movq %rax, %rbx
jmp 0x28ec
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x28e7
jmp 0x28be
jmp 0x28be
movq %rax, %rbx
jmp 0x28e2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x28e2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21b0
leaq 0x48(%rsp), %rdi
callq 0x345a
movq 0x86d5(%rip), %rax      # 0xafc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x80(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x78(%rsp,%rcx)
callq 0x2160
leaq 0x170(%rsp), %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x22a0