// File: jkunlin[P]maxclique/main.cpp
// Function: main
int main(int argc, char *argv[]) {
	assert(argc == 2);
	cout << "args = " << argv[1] << endl;

	bool **conn;
	size_t size;
	read_file(argv[1], conn, size);

	clock_t start1 = time(NULL);
	clock_t start2 = clock();

	Vertices V, V_MCR;

	cout<<"--------------------------normal sort-----------------------------------"<<endl;
	V.init(size);
	V.set_degrees(conn);
	V.degree_sort();
	V.colo_sort(conn, 1);
	expand(false, conn, V);
	/*
	cout<<"maxclique: ";
	for(vector<int>::iterator iter = maxclique.begin(); iter != maxclique.end(); ++iter) {
		cout<<*iter + 1<<' ';
	}
	cout<<endl;
	*/
	cout<<"size: "<<maxclique.size()<<endl;
	cout<<"common expand num:"<<num<<endl;
	cout<<"Time = "<<difftime(time(NULL), start1) <<endl;
	cout<<"Time (precise) = "<<((double) (clock() - start2)) / CLOCKS_PER_SEC <<endl;
	
	num = 0;
	maxclique.resize(0);

	start1 = time(NULL);
	start2 = clock();

	cout<<"--------------------------MCR sort--------------------------------------"<<endl;
	V_MCR.init(size);
	V_MCR.set_degrees(conn);
	V_MCR.MCR_sort(conn);
	V_MCR.colo_sort(conn, 1);
	expand(true, conn, V_MCR);
	/*
	cout<<"maxclique: ";
	for(vector<int>::iterator iter = maxclique.begin(); iter != maxclique.end(); ++iter) {
		cout<<*iter + 1<<' ';
	}
	cout<<endl;
	*/
	cout<<"size: "<<maxclique.size()<<endl;
	cout<<"MCR expand num:"<<num<<endl;
	cout<<"Time = "<<difftime(time(NULL), start1) <<endl;
	cout<<"Time (precise) = "<<((double) (clock() - start2)) / CLOCKS_PER_SEC <<endl;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
jne 0x6d31
jmp 0x6d50
leaq 0x5310(%rip), %rdi      # 0xc048
leaq 0x5313(%rip), %rsi      # 0xc052
movl $0xd, %edx
leaq 0x5310(%rip), %rcx      # 0xc05b
callq 0x2140
movq 0xc281(%rip), %rdi      # 0x12fd8
leaq 0x5314(%rip), %rsi      # 0xc072
callq 0x21f0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x21f0
movq %rax, %rdi
movq 0xc24b(%rip), %rsi      # 0x12fc8
callq 0x2230
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa8(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x2300
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
leaq -0x40(%rbp), %rdi
callq 0x7540
jmp 0x6dba
leaq -0x40(%rbp), %rdi
leaq -0x18(%rbp), %rsi
leaq -0x20(%rbp), %rdx
callq 0x9700
jmp 0x6dcd
leaq -0x40(%rbp), %rdi
callq 0x2120
leaq -0x41(%rbp), %rdi
callq 0x2250
xorl %eax, %eax
movl %eax, %edi
movq %rdi, -0xb0(%rbp)
callq 0x21d0
movq %rax, -0x60(%rbp)
callq 0x2150
movq -0xb0(%rbp), %rsi
movq %rax, -0x68(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x75f0
movq -0xb0(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x75f0
jmp 0x6e21
movq 0xc1b0(%rip), %rdi      # 0x12fd8
leaq 0x524b(%rip), %rsi      # 0xc07a
callq 0x21f0
movq %rax, -0xb8(%rbp)
jmp 0x6e3d
movq -0xb8(%rbp), %rdi
movq 0xc17d(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x6e52
movq -0x20(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x25a0
jmp 0x6e61
movq -0x18(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x2750
jmp 0x6e70
leaq -0x80(%rbp), %rdi
callq 0x7640
jmp 0x6e7b
movq -0x18(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movl $0x1, %edx
callq 0x2d50
jmp 0x6e8f
movq -0x18(%rbp), %rsi
xorl %edi, %edi
leaq -0x80(%rbp), %rdx
callq 0x72c0
jmp 0x6ea0
movq 0xc131(%rip), %rdi      # 0x12fd8
leaq 0x52b0(%rip), %rsi      # 0xc15e
callq 0x21f0
movq %rax, -0xc0(%rbp)
jmp 0x6ebc
leaq 0xc365(%rip), %rdi      # 0x13228
callq 0x3de0
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0xc8(%rbp)
jmp 0x6ee0
movq -0xc8(%rbp), %rdi
movq 0xc0da(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x6ef5
movq 0xc0dc(%rip), %rdi      # 0x12fd8
leaq 0x51c0(%rip), %rsi      # 0xc0c3
callq 0x21f0
movq %rax, -0xd0(%rbp)
jmp 0x6f11
movq -0xd0(%rbp), %rdi
movl 0xc33a(%rip), %esi      # 0x13258
callq 0x22e0
movq %rax, -0xd8(%rbp)
jmp 0x6f2c
movq -0xd8(%rbp), %rdi
movq 0xc08e(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x6f41
movq 0xc090(%rip), %rdi      # 0x12fd8
leaq 0x5187(%rip), %rsi      # 0xc0d6
callq 0x21f0
movq %rax, -0xe0(%rbp)
jmp 0x6f5d
xorl %eax, %eax
movl %eax, %edi
callq 0x21d0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x20f0
movq -0xe0(%rbp), %rdi
callq 0x2350
movq %rax, -0xe8(%rbp)
jmp 0x6f87
movq -0xe8(%rbp), %rdi
movq 0xc033(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x6f9c
movq 0xc035(%rip), %rdi      # 0x12fd8
leaq 0x5134(%rip), %rsi      # 0xc0de
callq 0x21f0
movq %rax, -0xf0(%rbp)
jmp 0x6fb8
callq 0x2150
movq -0xf0(%rbp), %rdi
movq -0x68(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x5068(%rip), %xmm1     # 0xc040
divsd %xmm1, %xmm0
callq 0x2350
movq %rax, -0xf8(%rbp)
jmp 0x6fea
movq -0xf8(%rbp), %rdi
movq 0xbfd0(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x6fff
movl $0x0, 0xc24f(%rip)      # 0x13258
leaq 0xc218(%rip), %rdi      # 0x13228
xorl %eax, %eax
movl %eax, %esi
callq 0x3b50
jmp 0x701b
xorl %eax, %eax
movl %eax, %edi
callq 0x21d0
movq %rax, -0x60(%rbp)
callq 0x2150
movq %rax, -0x68(%rbp)
movq 0xbfa0(%rip), %rdi      # 0x12fd8
leaq 0x50b1(%rip), %rsi      # 0xc0f0
callq 0x21f0
movq %rax, -0x100(%rbp)
jmp 0x704d
movq -0x100(%rbp), %rdi
movq 0xbf6d(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x7062
movq -0x20(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x25a0
jmp 0x7074
movq -0x18(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x2750
jmp 0x7086
movq -0x18(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0x28b0
jmp 0x7098
movq -0x18(%rbp), %rsi
leaq -0x98(%rbp), %rdi
movl $0x1, %edx
callq 0x2d50
jmp 0x70af
movq -0x18(%rbp), %rsi
movl $0x1, %edi
leaq -0x98(%rbp), %rdx
callq 0x72c0
jmp 0x70c6
movq 0xbf0b(%rip), %rdi      # 0x12fd8
leaq 0x508a(%rip), %rsi      # 0xc15e
callq 0x21f0
movq %rax, -0x108(%rbp)
jmp 0x70e2
leaq 0xc13f(%rip), %rdi      # 0x13228
callq 0x3de0
movq -0x108(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq %rax, -0x110(%rbp)
jmp 0x7106
movq -0x110(%rbp), %rdi
movq 0xbeb4(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x711b
movq 0xbeb6(%rip), %rdi      # 0x12fd8
leaq 0x5010(%rip), %rsi      # 0xc139
callq 0x21f0
movq %rax, -0x118(%rbp)
jmp 0x7137
movq -0x118(%rbp), %rdi
movl 0xc114(%rip), %esi      # 0x13258
callq 0x22e0
movq %rax, -0x120(%rbp)
jmp 0x7152
movq -0x120(%rbp), %rdi
movq 0xbe68(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x7167
movq 0xbe6a(%rip), %rdi      # 0x12fd8
leaq 0x4f61(%rip), %rsi      # 0xc0d6
callq 0x21f0
movq %rax, -0x128(%rbp)
jmp 0x7183
xorl %eax, %eax
movl %eax, %edi
callq 0x21d0
movq %rax, %rdi
movq -0x60(%rbp), %rsi
callq 0x20f0
movq -0x128(%rbp), %rdi
callq 0x2350
movq %rax, -0x130(%rbp)
jmp 0x71ad
movq -0x130(%rbp), %rdi
movq 0xbe0d(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x71c2
movq 0xbe0f(%rip), %rdi      # 0x12fd8
leaq 0x4f0e(%rip), %rsi      # 0xc0de
callq 0x21f0
movq %rax, -0x138(%rbp)
jmp 0x71de
callq 0x2150
movq -0x138(%rbp), %rdi
movq -0x68(%rbp), %rcx
subq %rcx, %rax
cvtsi2sd %rax, %xmm0
movsd 0x4e42(%rip), %xmm1     # 0xc040
divsd %xmm1, %xmm0
callq 0x2350
movq %rax, -0x140(%rbp)
jmp 0x7210
movq -0x140(%rbp), %rdi
movq 0xbdaa(%rip), %rsi      # 0x12fc8
callq 0x2230
jmp 0x7225
movl $0x0, -0x4(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x7690
leaq -0x80(%rbp), %rdi
callq 0x7690
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x7270
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2120
leaq -0x41(%rbp), %rdi
callq 0x2250
jmp 0x72aa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x72a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x7690
leaq -0x80(%rbp), %rdi
callq 0x7690
movq -0x50(%rbp), %rdi
callq 0x22f0
nopw %cs:(%rax,%rax)