// File: /workspace/github_cpp_makefile_star2_O2/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, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
leaq 0x38(%rsp), %rdi
callq 0x43c8
leaq 0xf0(%rsp), %rdi
callq 0x2d94
leaq 0xd0(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %r12, %rsi
callq 0x2b80
leaq 0xb0(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %r15, %rsi
callq 0x2b80
pushq $0x48
popq %rdi
callq 0x2180
movq %rax, %rbp
leaq 0x90(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
callq 0x2200
leaq 0x90(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
movq %rbp, %rdi
callq 0x2e4c
leaq 0x90(%rsp), %rdi
callq 0x20c0
pushq $0x48
popq %rdi
callq 0x2180
movq %rax, %r14
leaq 0x70(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2200
leaq 0x70(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
movq %r14, %rdi
callq 0x2e4c
leaq 0x70(%rsp), %rdi
callq 0x20c0
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x2cd8
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x2cd8
movq %rbp, %rdi
callq 0x3b7c
xorl %ebx, %ebx
testb %al, %al
jne 0x2a86
movq %r14, %rdi
callq 0x3b7c
testb %al, %al
jne 0x2a86
movl 0xc(%rbp), %eax
cmpl 0xc(%r14), %eax
jne 0x2a63
movl 0x10(%rbp), %eax
cmpl 0x10(%r14), %eax
jne 0x2a63
leaq 0x38(%rsp), %rdi
callq 0x43d0
leaq 0x48(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x4400
leaq 0x48(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x4438
movb %al, (%r13)
leaq 0x38(%rsp), %rdi
callq 0x43de
movsd %xmm0, (%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x2a57
cmpb $0x0, (%r13)
je 0x2a57
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq 0x8(%rsp), %rcx
callq 0x489c
leaq 0x48(%rsp), %rdi
callq 0x4416
jmp 0x2a70
movb $0x0, (%r13)
xorps %xmm0, %xmm0
movsd %xmm0, (%rsp)
pushq $0x1
popq %rbx
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0x2a86
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
leaq 0x20(%rsp), %rdi
callq 0x2bbc
leaq 0x30(%rsp), %rdi
callq 0x2bbc
leaq 0xb0(%rsp), %rdi
callq 0x20c0
leaq 0xd0(%rsp), %rdi
callq 0x20c0
leaq 0x108(%rsp), %rdi
callq 0x3eb4
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b3a
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x4416
jmp 0x2b3d
movq %rax, %rbx
jmp 0x2b47
jmp 0x2b2b
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x20c0
jmp 0x2aff
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %r14, %rdi
jmp 0x2b24
jmp 0x2b2b
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x20c0
jmp 0x2b1e
movq %rax, %rbx
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x2190
jmp 0x2b51
movq %rax, %rbx
jmp 0x2b51
movq %rax, %rbx
jmp 0x2b5e
movq %rax, %rbx
jmp 0x2b6b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2bbc
leaq 0x30(%rsp), %rdi
callq 0x2bbc
leaq 0xb0(%rsp), %rdi
callq 0x20c0
leaq 0xd0(%rsp), %rdi
callq 0x20c0
leaq 0x108(%rsp), %rdi
callq 0x3eb4
movq %rbx, %rdi
callq 0x22e0