// File: /workspace/github_cpp_makefile_star2_O3/jkunlin[P]maxclique/Vertices.cpp
// Function: Vertices::colo_sort(bool const* const*, int)
void Vertices::colo_sort(const bool * const * conn, int min_k) {
	if(min_k <= 0)
		min_k = 1;
	typedef std::vector<int> color;
	typedef std::vector<color> colors;
	static color C;
	static colors Cs;
	size_t colors_num = 0;
	C.resize(0);

	for(colors::iterator iter = Cs.begin(); iter != Cs.end(); ++iter) {
		iter->resize(0);
	}

	vvec_type::iterator insert_ver_iter = vertices.begin();
	for(vvec_type::iterator ver_iter = vertices.begin(); ver_iter != vertices.end(); ++ver_iter) {

		//find the proper color to insert vertex
		colors::size_type i = 0;
		for(; i != colors_num; ++i) {
			if(!color_conflict(conn, ver_iter->get_index(), Cs[i])) {
				//proper color found
				Cs[i].push_back(ver_iter->get_index());
				break;
			}
		}

		//no proper color found, create empty one
		if(i == colors_num) {
			C.resize(0);
			C.push_back(ver_iter->get_index());
			if(Cs.size() > colors_num)
				C.swap(Cs[colors_num]);
			else
				Cs.push_back(C);
			++colors_num;
		}
		//contain small color vertices in order
		if(i + 1 < static_cast<unsigned int>(min_k)) {
			insert_ver_iter->set_index(ver_iter->get_index());
			insert_ver_iter->set_degree(0);
			++insert_ver_iter;
		}
		/*
		//find the proper color to insert vertex
		colors::iterator colors_iter = Cs.begin();
		for(; colors_iter != Cs.end(); ++colors_iter) {
			if(!color_conflict(conn, ver_iter->get_index(), *colors_iter)) {
				//proper color found
				(*colors_iter).push_back(ver_iter->get_index());
				break;
			}
		}

		//no proper color found, create empty one
		if(colors_iter == Cs.end()) {
			C.resize(0);
			C.push_back(ver_iter->get_index());
			Cs.push_back(C);
			colors_iter = Cs.end() - 1;
			++colors_num;
		}
		//contain small color vertices in order
		if(colors_iter - Cs.begin() + 1 < min_k) {
			insert_ver_iter->set_index(ver_iter->get_index());
			insert_ver_iter->set_degree(0);
			++insert_ver_iter;
		}
		*/
	}
	colors::size_type i = min_k - 1;
	for(; i < Cs.size(); ++i) {
		for(color::size_type j = 0; j != Cs[i].size(); ++insert_ver_iter, ++j) {
			insert_ver_iter->set_index(Cs[i][j]);
			insert_ver_iter->set_degree(i);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
cmpl $0x2, %edx
movl $0x1, %r12d
cmovgel %edx, %r12d
movb 0x577f(%rip), %al       # 0x81b8
testb %al, %al
je 0x2c7e
movb 0x5791(%rip), %al       # 0x81d8
testb %al, %al
je 0x2c88
leaq 0x574a(%rip), %rdi      # 0x81a0
xorl %esi, %esi
callq 0x2ea4
movq 0x575c(%rip), %r15      # 0x81c0
cmpq 0x575d(%rip), %r15      # 0x81c8
je 0x2a7d
movq %r15, %rdi
xorl %esi, %esi
callq 0x2ea4
addq $0x18, %r15
jmp 0x2a64
movq 0x8(%rsp), %rax
movq (%rax), %rbp
cmpq 0x8(%rax), %rbp
je 0x2c09
movl %r12d, %eax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
leaq 0x56ff(%rip), %r10      # 0x81a0
movq %rbp, %r13
testq %r15, %r15
je 0x2ae7
movq 0x5710(%rip), %rcx      # 0x81c0
movl (%rbp), %eax
movslq %eax, %rdx
xorl %r14d, %r14d
leaq (%r14,%r14,2), %rdi
movq (%rcx,%rdi,8), %r8
movq 0x8(%rcx,%rdi,8), %rsi
cmpq %rsi, %r8
je 0x2b19
movslq (%r8), %r9
movq (%rbx,%r9,8), %r9
cmpb $0x0, (%r9,%rdx)
jne 0x2adf
addq $0x4, %r8
jmp 0x2ac6
incq %r14
cmpq %r15, %r14
jne 0x2ab9
movq %r10, %rdi
xorl %esi, %esi
movq %r10, %r14
callq 0x2ea4
movl (%rbp), %eax
movl %eax, (%rsp)
movq 0x56a7(%rip), %rsi      # 0x81a8
cmpq 0x56a8(%rip), %rsi      # 0x81b0
je 0x2b4c
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x5691(%rip)      # 0x81a8
jmp 0x2b57
leaq (%rcx,%rdi,8), %rdi
movl %eax, 0x4(%rsp)
cmpq 0x10(%rdi), %rsi
je 0x2b33
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2b44
leaq 0x4(%rsp), %rdx
callq 0x314a
leaq 0x565c(%rip), %r10      # 0x81a0
incq %r14
jmp 0x2bd3
movq %r14, %rdi
movq %rsp, %rdx
callq 0x314a
movq 0x566a(%rip), %rcx      # 0x81c8
movq 0x565b(%rip), %rax      # 0x81c0
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq %r15, %rcx
jbe 0x2bb3
leaq (%r15,%r15,2), %rcx
movq 0x5626(%rip), %rdx      # 0x81b0
movups (%rax,%rcx,8), %xmm0
movaps 0x560b(%rip), %xmm1     # 0x81a0
movaps %xmm0, 0x5604(%rip)     # 0x81a0
movq 0x10(%rax,%rcx,8), %rsi
movq %rsi, 0x5608(%rip)      # 0x81b0
movups %xmm1, (%rax,%rcx,8)
movq %rdx, 0x10(%rax,%rcx,8)
jmp 0x2bc6
leaq 0x5606(%rip), %rdi      # 0x81c0
leaq 0x55df(%rip), %rsi      # 0x81a0
callq 0x2ed6
incq %r15
movq %r15, %r14
leaq 0x55cd(%rip), %r10      # 0x81a0
cmpq 0x10(%rsp), %r14
jae 0x2bed
movl (%rbp), %eax
movl %eax, (%r13)
movl $0x0, 0x4(%r13)
addq $0x8, %r13
addq $0x8, %rbp
movq 0x8(%rsp), %rax
cmpq 0x8(%rax), %rbp
jne 0x2aa4
movq 0x55c1(%rip), %r15      # 0x81c8
jmp 0x2c0c
movq %rbp, %r13
decl %r12d
movq 0x55aa(%rip), %rax      # 0x81c0
subq %rax, %r15
sarq $0x3, %r15
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %r15
cmpq %r12, %r15
jbe 0x2c6f
leaq (%r12,%r12,2), %rdx
movq (%rax,%rdx,8), %rcx
movq 0x8(%rax,%rdx,8), %rdx
subq %rcx, %rdx
je 0x2c67
sarq $0x2, %rdx
xorl %esi, %esi
xorl %edi, %edi
movl (%rcx,%rdi,4), %r8d
movl %r8d, (%r13,%rdi,8)
movl %r12d, 0x4(%r13,%rdi,8)
incq %rdi
addq $-0x8, %rsi
cmpq %rdi, %rdx
jne 0x2c4a
subq %rsi, %r13
incq %r12
cmpq %r15, %r12
jne 0x2c30
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x22e0
jmp 0x2a41
callq 0x232c
jmp 0x2a4f