// File: /workspace/github_cpp_makefile_star2_O1/SNUCSE-CTA[P]GI/src/compare.cpp
// Function: compare
int compare(const char *fname1, const char *fname2, bool *isomorphic, double *processedTime, const char *outfname)
{
	double totalTime = 0;

	Timer t;
	Context cont;

	string file1(fname1);
	string file2(fname2);

	//1. read input graph files
	Graph* g1 = new Graph(file1, cont);
	Graph* g2 = new Graph(file2, cont);

	std::shared_ptr<Graph> upg1(g1);
	std::shared_ptr<Graph> upg2(g2);

	//check if input files exist, and they have no errors.
	if (g1->fail() || g2->fail()) {
		return 0;
	}

	//2. GI algorithm
	if(g1->numNode != g2->numNode || g1->numEdge != g2->numEdge) {
		//trivially false
		*isomorphic = false;
	}
	else {
	t.start();
		Algorithm alg(cont);
		*isomorphic = alg.run(g1, g2);
	totalTime = t.end();

		if(*isomorphic && outfname != nullptr) {
			//cout << "Output isomorphism file: " << outfname << endl;
			alg.printIso(fname1, fname2, outfname);
		}
	}

	if (processedTime != nullptr) {
		*processedTime = totalTime;
	}


	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %r8, 0x10(%rsp)
movq %rcx, %r13
movq %rdx, (%rsp)
movq %rsi, %r15
movq %rdi, %r12
leaq 0xb8(%rsp), %rdi
callq 0x4fa8
leaq 0xf0(%rsp), %rdi
callq 0x33c4
leaq 0x78(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %r12, %rsi
callq 0x3134
leaq 0x58(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %r15, %rsi
callq 0x3134
movl $0x48, %edi
callq 0x2180
movq %rax, %rbp
leaq 0x48(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rdi
callq 0x31ec
leaq 0x38(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
movq %rbp, %rdi
callq 0x348c
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e4b
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2190
movl $0x48, %edi
callq 0x2180
movq %rax, %r14
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x31ec
leaq 0x18(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
movq %r14, %rdi
callq 0x348c
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2ea4
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0xb0(%rsp), %rdi
movq %rbp, -0x8(%rdi)
movq %rbp, %rsi
callq 0x330c
leaq 0xa0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0x330c
movq %rbp, %rdi
callq 0x4736
xorl %ebx, %ebx
testb %al, %al
jne 0x2fb4
movq %r14, %rdi
callq 0x4736
testb %al, %al
jne 0x2fb4
movl 0xc(%rbp), %eax
cmpl 0xc(%r14), %eax
jne 0x2f8e
movl 0x10(%rbp), %eax
cmpl 0x10(%r14), %eax
jne 0x2f8e
leaq 0xb8(%rsp), %rdi
callq 0x4fb0
leaq 0xc8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x4fe0
leaq 0xc8(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x5016
movq (%rsp), %rcx
movb %al, (%rcx)
leaq 0xb8(%rsp), %rdi
callq 0x4fbe
movsd %xmm0, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x2f7f
movq (%rsp), %rax
cmpb $0x0, (%rax)
je 0x2f7f
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq 0x10(%rsp), %rcx
callq 0x54c0
leaq 0xc8(%rsp), %rdi
callq 0x4ff4
jmp 0x2f9e
movq (%rsp), %rax
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x1, %ebx
testq %r13, %r13
je 0x2fb4
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%r13)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x2fc6
callq 0x3172
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x2fd8
callq 0x3172
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ff3
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3014
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x108(%rsp), %rdi
callq 0x4aa0
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x30bb
movq %rax, %r15
leaq 0xc8(%rsp), %rdi
callq 0x4ff4
jmp 0x30be
movq %rax, %r15
jmp 0x30d0
jmp 0x30ac
movq %rax, %r15
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x3072
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x3072
movq %rax, %r15
movl $0x48, %esi
movq %r14, %rdi
jmp 0x30a5
jmp 0x30ac
movq %rax, %r15
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x309d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x309d
movq %rax, %r15
movl $0x48, %esi
movq %rbp, %rdi
callq 0x2190
jmp 0x30e2
movq %rax, %r15
jmp 0x30e2
movq %rax, %r15
jmp 0x30fd
movq %rax, %r15
jmp 0x311e
movq %rax, %r15
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x30d0
callq 0x3172
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x30e2
callq 0x3172
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30fd
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x311e
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x108(%rsp), %rdi
callq 0x4aa0
movq %r15, %rdi
callq 0x22f0
nop