// File: /workspace/github_cpp_makefile_star2_O3/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 0x4f1c
leaq 0xf0(%rsp), %rdi
callq 0x33b4
leaq 0x78(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %r12, %rsi
callq 0x3114
leaq 0x58(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
movq %r15, %rsi
callq 0x3114
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 0x31cc
leaq 0x38(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
movq %rbp, %rdi
callq 0x347c
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x2e2b
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 0x31cc
leaq 0x18(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
movq %r14, %rdi
callq 0x347c
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2e84
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0xb0(%rsp), %rdi
movq %rbp, -0x8(%rdi)
movq %rbp, %rsi
callq 0x32f8
leaq 0xa0(%rsp), %rdi
movq %r14, -0x8(%rdi)
movq %r14, %rsi
callq 0x32f8
movq %rbp, %rdi
callq 0x46bc
xorl %ebx, %ebx
testb %al, %al
jne 0x2f94
movq %r14, %rdi
callq 0x46bc
testb %al, %al
jne 0x2f94
movl 0xc(%rbp), %eax
cmpl 0xc(%r14), %eax
jne 0x2f6e
movl 0x10(%rbp), %eax
cmpl 0x10(%r14), %eax
jne 0x2f6e
leaq 0xb8(%rsp), %rdi
callq 0x4f24
leaq 0xc8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x4f54
leaq 0xc8(%rsp), %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x4f8a
movq (%rsp), %rcx
movb %al, (%rcx)
leaq 0xb8(%rsp), %rdi
callq 0x4f32
movsd %xmm0, 0x8(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x2f5f
movq (%rsp), %rax
cmpb $0x0, (%rax)
je 0x2f5f
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
movq 0x10(%rsp), %rcx
callq 0x5434
leaq 0xc8(%rsp), %rdi
callq 0x4f68
jmp 0x2f7e
movq (%rsp), %rax
movb $0x0, (%rax)
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x1, %ebx
testq %r13, %r13
je 0x2f94
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%r13)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x2fa6
callq 0x3152
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x2fb8
callq 0x3152
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2fd3
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ff4
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x108(%rsp), %rdi
callq 0x4a20
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x309b
movq %rax, %r15
leaq 0xc8(%rsp), %rdi
callq 0x4f68
jmp 0x309e
movq %rax, %r15
jmp 0x30b0
jmp 0x308c
movq %rax, %r15
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x3052
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x3052
movq %rax, %r15
movl $0x48, %esi
movq %r14, %rdi
jmp 0x3085
jmp 0x308c
movq %rax, %r15
movq 0x38(%rsp), %rdi
cmpq %r14, %rdi
je 0x307d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x307d
movq %rax, %r15
movl $0x48, %esi
movq %rbp, %rdi
callq 0x2190
jmp 0x30c2
movq %rax, %r15
jmp 0x30c2
movq %rax, %r15
jmp 0x30dd
movq %rax, %r15
jmp 0x30fe
movq %rax, %r15
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x30b0
callq 0x3152
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x30c2
callq 0x3152
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30dd
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x88(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x30fe
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x108(%rsp), %rdi
callq 0x4a20
movq %r15, %rdi
callq 0x22f0
nop