// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %rbx
movq %rdi, 0x18(%rsp)
cmpl $0x2, %edx
movl $0x1, %eax
cmovgel %edx, %eax
movq %rax, 0x10(%rsp)
movb 0x5876(%rip), %al       # 0x81a8
testb %al, %al
je 0x2bb2
movb 0x5888(%rip), %al       # 0x81c8
testb %al, %al
je 0x2bbc
leaq 0x5841(%rip), %rdi      # 0x8190
xorl %esi, %esi
callq 0x2dcc
movq 0x5853(%rip), %r15      # 0x81b0
cmpq 0x5854(%rip), %r15      # 0x81b8
je 0x2976
movq %r15, %rdi
xorl %esi, %esi
callq 0x2dcc
addq $0x18, %r15
jmp 0x295d
movq 0x18(%rsp), %rax
movq (%rax), %r13
cmpq 0x8(%rax), %r13
je 0x2b31
movl 0x10(%rsp), %eax
movq %rax, 0x20(%rsp)
xorl %r15d, %r15d
movq %r13, %r12
testq %r15, %r15
sete %bpl
je 0x2a07
movq 0x5809(%rip), %rax      # 0x81b0
xorl %r14d, %r14d
leaq (%r14,%r14,2), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x8(%rax,%rcx,8), %rsi
cmpq %rsi, %rdx
setne %r8b
je 0x29f1
movslq (%r13), %rdi
movslq (%rdx), %r8
movq (%rbx,%r8,8), %r8
cmpb $0x0, (%r8,%rdi)
jne 0x29f6
addq $0x4, %rdx
cmpq %rsi, %rdx
setne %r8b
je 0x29f1
movslq (%rdx), %r9
movq (%rbx,%r9,8), %r9
addq $0x4, %rdx
cmpb $0x1, (%r9,%rdi)
jne 0x29d6
testb %r8b, %r8b
je 0x2a0c
incq %r14
cmpq %r15, %r14
sete %bpl
jne 0x29aa
movq %r15, %r14
jmp 0x2a3e
xorl %r14d, %r14d
jmp 0x2a3e
leaq (%rax,%rcx,8), %rdi
movl (%r13), %eax
movl %eax, 0xc(%rsp)
cmpq 0x10(%rdi), %rsi
je 0x2a2a
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x2a34
leaq 0xc(%rsp), %rdx
callq 0x3072
testb $0x1, %bpl
je 0x2afd
leaq 0x574b(%rip), %rbp      # 0x8190
movq %rbp, %rdi
xorl %esi, %esi
callq 0x2dcc
movl (%r13), %eax
movl %eax, 0x8(%rsp)
movq 0x573a(%rip), %rsi      # 0x8198
cmpq 0x573b(%rip), %rsi      # 0x81a0
je 0x2a76
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x5724(%rip)      # 0x8198
jmp 0x2a83
movq %rbp, %rdi
leaq 0x8(%rsp), %rdx
callq 0x3072
movq 0x572e(%rip), %rcx      # 0x81b8
movq 0x571f(%rip), %rax      # 0x81b0
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq %r15, %rcx
jbe 0x2aeb
leaq (%r15,%r15,2), %rcx
movups 0x56da(%rip), %xmm0     # 0x8190
movq 0x56e3(%rip), %rdx      # 0x81a0
movq (%rax,%rcx,8), %rsi
movq %rsi, 0x56c8(%rip)      # 0x8190
movq 0x8(%rax,%rcx,8), %rsi
movq %rsi, 0x56c4(%rip)      # 0x8198
movq 0x10(%rax,%rcx,8), %rsi
movq %rsi, 0x56c0(%rip)      # 0x81a0
movups %xmm0, (%rax,%rcx,8)
movq %rdx, 0x10(%rax,%rcx,8)
jmp 0x2afa
leaq 0x56be(%rip), %rdi      # 0x81b0
movq %rbp, %rsi
callq 0x2dfe
incq %r15
incq %r14
cmpq 0x20(%rsp), %r14
jae 0x2b1c
movl (%r13), %eax
movl %eax, (%r12)
movl $0x0, 0x4(%r12)
addq $0x8, %r12
addq $0x8, %r13
movq 0x18(%rsp), %rax
cmpq 0x8(%rax), %r13
jne 0x2997
jmp 0x2b34
movq %r13, %r12
movq 0x10(%rsp), %r10
decl %r10d
movq 0x5675(%rip), %rax      # 0x81b8
movq 0x5666(%rip), %rcx      # 0x81b0
subq %rcx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rax
cmpq %r10, %rax
jbe 0x2ba3
leaq (%r10,%r10,2), %rsi
movq (%rcx,%rsi,8), %rdx
movq 0x8(%rcx,%rsi,8), %rsi
subq %rdx, %rsi
je 0x2b9b
sarq $0x2, %rsi
xorl %edi, %edi
xorl %r8d, %r8d
movl (%rdx,%r8,4), %r9d
movl %r9d, (%r12,%r8,8)
movl %r10d, 0x4(%r12,%r8,8)
incq %r8
addq $-0x8, %rdi
cmpq %r8, %rsi
jne 0x2b7f
subq %rdi, %r12
incq %r10
cmpq %rax, %r10
jne 0x2b64
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x22e0
jmp 0x293a
callq 0x232c
jmp 0x2948