// File: SNUCSE-CTA[P]GI/src/program.cpp
// Function: main
int main(int argc, char* argv[])
{
	if( argc != 3 && argc != 4) {
		bool handled = false;
		if( argc == 2 ) {
			if( strcmp(argv[1], "--help") == 0 ) {
				//print help
				cout << "Usage: " << argv[0] << " graph1 graph2 (isomorphism_output)" << endl;
				cout << "Other options:" << endl;
				cout << "  --help        Display help" << endl;
				cout << "  --example     Display example file format" << endl;
				handled = true;
			}
			else if( strcmp(argv[1], "--example") == 0 ) {
				//print example file format
				printExample();
				handled = true;
			}
		}

		if(handled == false) {
			//print usages
			cout << "Usage: " << argv[0] << " graph1 graph2 (isomorphism_output)" << endl;
			cout << "Try '" << argv[0] << " --help' for more information" << endl;
		}
		return -1;
	}

	double totalTime;
	bool isomorphic;
	char* outfname = (argc == 4 ? argv[3] : nullptr);
	int ret = compare(argv[1], argv[2], &isomorphic, &totalTime, outfname);
	if (ret == 0) {
		//cout << "There is no file" << endl;
		return -1;
	}

	cout << "Elasped Time: " << totalTime << endl;
	if (isomorphic) {
		cout << "True: " << argv[1] << " and " << argv[2] << " are isomorphic" << endl;
	} else {
		cout << "False: " << argv[1] << " and " << argv[2] << " are not isomorphic" << endl;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
je 0x3964
cmpl $0x4, -0x8(%rbp)
je 0x3964
movb $0x0, -0x11(%rbp)
cmpl $0x2, -0x8(%rbp)
jne 0x38c7
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x1481d(%rip), %rsi     # 0x18004
callq 0x32b0
cmpl $0x0, %eax
jne 0x38a1
movq 0x1c7d4(%rip), %rdi     # 0x1ffd0
leaq 0x14808(%rip), %rsi     # 0x1800b
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x147f2(%rip), %rsi     # 0x18013
callq 0x31b0
movq %rax, %rdi
movq 0x1c788(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movq 0x1c794(%rip), %rdi     # 0x1ffd0
leaq 0x147f4(%rip), %rsi     # 0x18037
callq 0x31b0
movq %rax, %rdi
movq 0x1c766(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movq 0x1c772(%rip), %rdi     # 0x1ffd0
leaq 0x147e1(%rip), %rsi     # 0x18046
callq 0x31b0
movq %rax, %rdi
movq 0x1c744(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movq 0x1c750(%rip), %rdi     # 0x1ffd0
leaq 0x147dc(%rip), %rsi     # 0x18063
callq 0x31b0
movq %rax, %rdi
movq 0x1c722(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movb $0x1, -0x11(%rbp)
jmp 0x38c5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x147df(%rip), %rsi     # 0x1808f
callq 0x32b0
cmpl $0x0, %eax
jne 0x38c3
callq 0x3ad0
movb $0x1, -0x11(%rbp)
jmp 0x38c5
jmp 0x38c7
movb -0x11(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x3958
movq 0x1c6f1(%rip), %rdi     # 0x1ffd0
leaq 0x14725(%rip), %rsi     # 0x1800b
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x1470f(%rip), %rsi     # 0x18013
callq 0x31b0
movq %rax, %rdi
movq 0x1c6a5(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movq 0x1c6b1(%rip), %rdi     # 0x1ffd0
leaq 0x14773(%rip), %rsi     # 0x18099
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x1475b(%rip), %rsi     # 0x1809f
callq 0x31b0
movq %rax, %rdi
movq 0x1c665(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3abc
cmpl $0x4, -0x8(%rbp)
jne 0x3978
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x3980
xorl %eax, %eax
movq %rax, -0x40(%rbp)
jmp 0x3980
movq -0x40(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %r8
leaq -0x21(%rbp), %rdx
leaq -0x20(%rbp), %rcx
callq 0x3c30
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x39be
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3abc
movq 0x1c60b(%rip), %rdi     # 0x1ffd0
leaq 0x146f1(%rip), %rsi     # 0x180bd
callq 0x31b0
movq %rax, %rdi
movsd -0x20(%rbp), %xmm0
callq 0x33b0
movq %rax, %rdi
movq 0x1c5d0(%rip), %rsi     # 0x1ffb8
callq 0x31e0
testb $0x1, -0x21(%rbp)
je 0x3a55
movq 0x1c5d6(%rip), %rdi     # 0x1ffd0
leaq 0x146cb(%rip), %rsi     # 0x180cc
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x146b3(%rip), %rsi     # 0x180d3
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x1469a(%rip), %rsi     # 0x180d9
callq 0x31b0
movq %rax, %rdi
movq 0x1c56a(%rip), %rsi     # 0x1ffb8
callq 0x31e0
jmp 0x3ab5
movq 0x1c574(%rip), %rdi     # 0x1ffd0
leaq 0x14686(%rip), %rsi     # 0x180e9
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x14651(%rip), %rsi     # 0x180d3
callq 0x31b0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x31b0
movq %rax, %rdi
leaq 0x14650(%rip), %rsi     # 0x180f1
callq 0x31b0
movq %rax, %rdi
movq 0x1c508(%rip), %rsi     # 0x1ffb8
callq 0x31e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)