// File: /workspace/github_cpp_makefile_star2_O2/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, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
callq 0x22a0
leaq 0x2ae5(%rip), %rsi      # 0x5004
pushq $0x10
popq %rdx
movq %rbx, %rdi
callq 0x2040
leaq 0xe8(%rsp), %rdi
callq 0x2070
testb %al, %al
je 0x2718
leaq 0x2ae2(%rip), %rsi      # 0x5028
leaq 0x78(%rsp), %rdi
callq 0x21b0
movq 0x10(%rsp), %rax
movq (%rax), %rbx
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
leaq 0x78(%rsp), %r12
leaq 0x58(%rsp), %r14
leaq 0x2c37(%rip), %r15      # 0x51a7
movq 0x10(%rsp), %rax
cmpq 0x8(%rax), %rbx
je 0x26e1
movq %r12, %rdi
leaq 0x2ba1(%rip), %rsi      # 0x512a
callq 0x21b0
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x22b0
movq %rax, %rdi
leaq 0x2bb4(%rip), %rsi      # 0x5158
callq 0x21b0
movq %rbx, 0x18(%rsp)
movq (%rbx), %rbp
movq 0x18(%rsp), %rax
cmpq 0x8(%rax), %rbp
je 0x26cf
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x2f0e
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x242c
movq %rbx, %rdi
callq 0x2eec
movq %r12, %rdi
leaq 0x2b6f(%rip), %rsi      # 0x5163
callq 0x21b0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x21a0
movq %rax, %rdi
leaq 0x2b5e(%rip), %rsi      # 0x516c
callq 0x21b0
movq 0x28(%rsp), %r13
cmpq 0x30(%rsp), %r13
je 0x26ad
movq %r12, %rdi
leaq 0x2b49(%rip), %rsi      # 0x5176
callq 0x21b0
addq $0x40, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x21a0
movq %rax, %rdi
leaq 0x2b56(%rip), %rsi      # 0x51a1
callq 0x21b0
movq %rax, %rbx
addq $-0x40, %r13
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2e54
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21a0
movq %rax, %rdi
leaq 0x2b2b(%rip), %rsi      # 0x51a5
callq 0x21b0
addq $0xa0, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x21a0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21b0
movq %r14, %rdi
callq 0x20f0
addq $0x20, %r13
jmp 0x2618
movq %r12, %rdi
leaq 0x2aa1(%rip), %rsi      # 0x5158
callq 0x21b0
leaq 0x28(%rsp), %rdi
callq 0x2eec
addq $0x28, %rbp
jmp 0x25b1
movq 0x18(%rsp), %rbx
addq $0x18, %rbx
incl 0xc(%rsp)
jmp 0x2570
leaq 0x2ac6(%rip), %rsi      # 0x51ae
leaq 0x78(%rsp), %rdi
callq 0x21b0
leaq 0x78(%rsp), %rdi
callq 0x2230
leaq 0x78(%rsp), %rdi
callq 0x2250
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x68d1(%rip), %rdi      # 0x8ff0
leaq 0x28ee(%rip), %rsi      # 0x5014
callq 0x21b0
leaq 0x28d2(%rip), %rsi      # 0x5004
movq %rax, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x2110
pushq $0x2
popq %rdi
callq 0x21f0
jmp 0x2750
jmp 0x2750
jmp 0x2750
movq %rax, %rbx
jmp 0x277f
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x277a
jmp 0x2763
jmp 0x2763
movq %rax, %rbx
jmp 0x2775
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x20f0
leaq 0x28(%rsp), %rdi
callq 0x2eec
leaq 0x78(%rsp), %rdi
callq 0x2250
movq %rbx, %rdi
callq 0x22c0