// File: jkunlin[P]maxclique/Vertices.cpp
// Function: Vertices::MCR_sort(bool const* const*)
void Vertices::MCR_sort(const bool * const *conn) {
	int min_degree = vertices.size();
	vvec_type::iterator min_iter = vertices.end();

	vvec_type R;
	for(vvec_type::size_type i = 0; i != vertices.size(); ++i) {
		//find vertex with min degree
		R.resize(0);
		min_degree = vertices[0].get_degree();
		min_iter = vertices.begin();
		R.push_back(*min_iter);
		for(vvec_type::iterator iter = vertices.begin() + 1; iter != vertices.end() - i; ++iter) {
			if(iter->get_degree() == min_degree) {
				R.push_back(*iter);
			}
			else if(iter->get_degree() < min_degree) {
				min_degree = iter->get_degree();
				min_iter = iter;
			}
		}

		//regular subgraph
		if(R.size() == vertices.size() - i)
			break;
		std::swap(*min_iter, *(vertices.end() - i - 1));

		//update degrees of remain vertices
		for(vvec_type::iterator iter = vertices.begin(); iter != vertices.end() - i - 1; ++iter) {
			if(conn[iter->get_index()][(vertices.end() - i - 1) ->get_index()])
				iter->dec_degree();
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x37d0
movq -0xd0(%rbp), %rdi
movl %eax, -0x14(%rbp)
callq 0x3560
movq %rax, -0x20(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x37f0
movq $0x0, -0x40(%rbp)
movq -0xd0(%rbp), %rdi
movq -0x40(%rbp), %rax
movq %rax, -0xd8(%rbp)
callq 0x37d0
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
je 0x2c98
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0x3420
jmp 0x2930
movq -0xd0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3810
movq %rax, %rdi
callq 0x3830
movl %eax, -0xdc(%rbp)
jmp 0x2950
movq -0xd0(%rbp), %rdi
movl -0xdc(%rbp), %eax
movl %eax, -0x14(%rbp)
callq 0x34b0
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x3850
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x33b0
jmp 0x2988
movq -0xd0(%rbp), %rdi
callq 0x34b0
movq %rax, -0x68(%rbp)
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
callq 0x3770
movq %rax, -0x60(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x3560
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x3870
movq %rax, -0x70(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x36d0
testb $0x1, %al
jne 0x29e1
jmp 0x2a98
leaq -0x60(%rbp), %rdi
callq 0x3710
movq %rax, %rdi
callq 0x3830
movl %eax, -0xe0(%rbp)
jmp 0x29fa
movl -0xe0(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x2a38
leaq -0x60(%rbp), %rdi
callq 0x3850
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x33b0
jmp 0x2a1c
jmp 0x2a88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3910
jmp 0x2caa
leaq -0x60(%rbp), %rdi
callq 0x3710
movq %rax, %rdi
callq 0x3830
movl %eax, -0xe4(%rbp)
jmp 0x2a51
movl -0xe4(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x2a86
leaq -0x60(%rbp), %rdi
callq 0x3710
movq %rax, %rdi
callq 0x3830
movl %eax, -0xe8(%rbp)
jmp 0x2a75
movl -0xe8(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x2a88
jmp 0x2a8a
leaq -0x60(%rbp), %rdi
callq 0x3750
jmp 0x29aa
leaq -0x38(%rbp), %rdi
callq 0x37d0
movq -0xd0(%rbp), %rdi
movq %rax, -0xf0(%rbp)
callq 0x37d0
movq %rax, %rcx
movq -0xf0(%rbp), %rax
subq -0x40(%rbp), %rcx
cmpq %rcx, %rax
jne 0x2acc
jmp 0x2c98
leaq -0x20(%rbp), %rdi
callq 0x3850
movq -0xd0(%rbp), %rdi
movq %rax, -0xf8(%rbp)
callq 0x3560
movq %rax, -0x90(%rbp)
movq -0x40(%rbp), %rsi
leaq -0x90(%rbp), %rdi
callq 0x3870
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rdi
movl $0x1, %esi
callq 0x3870
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3850
movq -0xf8(%rbp), %rdi
movq %rax, %rsi
callq 0x38b0
movq -0xd0(%rbp), %rdi
callq 0x34b0
movq %rax, -0x98(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x3560
movq %rax, -0xb0(%rbp)
movq -0x40(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x3870
movq %rax, -0xa8(%rbp)
leaq -0xa8(%rbp), %rdi
movl $0x1, %esi
callq 0x3870
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x36d0
testb $0x1, %al
jne 0x2ba4
jmp 0x2c85
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3710
movq %rax, %rdi
callq 0x35b0
movl %eax, -0xfc(%rbp)
jmp 0x2bcb
movq -0xd0(%rbp), %rdi
movq -0x108(%rbp), %rax
movl -0xfc(%rbp), %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x118(%rbp)
callq 0x3560
movq %rax, -0xc8(%rbp)
movq -0x40(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
callq 0x3870
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %rdi
movl $0x1, %esi
callq 0x3870
movq %rax, -0xb8(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x3710
movq %rax, %rdi
callq 0x35b0
movl %eax, -0x10c(%rbp)
jmp 0x2c44
movq -0x118(%rbp), %rax
movl -0x10c(%rbp), %ecx
movslq %ecx, %rcx
testb $0x1, (%rax,%rcx)
je 0x2c72
leaq -0x98(%rbp), %rdi
callq 0x3710
movq %rax, %rdi
callq 0x38f0
jmp 0x2c70
jmp 0x2c72
jmp 0x2c74
leaq -0x98(%rbp), %rdi
callq 0x3750
jmp 0x2b46
jmp 0x2c87
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x28f7
leaq -0x38(%rbp), %rdi
callq 0x3910
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x22f0
nopw %cs:(%rax,%rax)