// File: /workspace/github_cpp_makefile_star2_O3/comptotherescue[P]Fibonacci-Heap/keywordcounter.cpp
// Function: Fibops::RemoveMax()
Fib* RemoveMax()
	{
		map<int, Fib*> l_pTreet;
		map<int, Fib*>::iterator it;
		int max = INT_MIN;
		Fib *q, *p, *l_pMax = NULL;
		q = m_pMax->m_pChild;
		//make parent pointer of all children of removed node NULL
		if (q != NULL)
		{
			do
			{
				q->m_pParent = NULL;
				q = q->m_pRightsib;
			} while (q != m_pMax->m_pChild && q != q->m_pRightsib);
			m_pMax->m_pChild->m_pLeftsib->m_pRightsib = m_pMax->m_pRightsib;
			m_pMax->m_pRightsib->m_pLeftsib = m_pMax->m_pChild->m_pLeftsib;
			m_pMax->m_pChild->m_pLeftsib = m_pMax;
			m_pMax->m_pRightsib = m_pMax->m_pChild;
			m_pMax->m_pChild = NULL;
			m_pMax->m_iDegree = 0;
		}
		q = m_pMax->m_pRightsib;
		vector<Fib*> Vec;
		map<int, Fib*>::iterator itr;
		Vec.clear();
		while (q != m_pMax)
		{
			Vec.push_back(q);
			q = q->m_pRightsib;
		}
		//Remove links for each node
		for (int i = 0; i < Vec.size(); i++)
		{
			Vec[i]->m_pLeftsib = Vec[i];
			Vec[i]->m_pRightsib = Vec[i];
		}
		Fib*y, *x;
		for (int i = 0; i<Vec.size(); i++)
		{
			it = l_pTreet.find(Vec[i]->m_iDegree);
			while (it != l_pTreet.end()) {
				if (Vec[i]->m_iData > it->second->m_iData)
				{
					y = Vec[i];
					x = it->second;
					x->m_pLeftsib->m_pRightsib = x->m_pRightsib;
					x->m_pRightsib->m_pLeftsib = x->m_pLeftsib;
					if (y->m_pChild == NULL)
					{
						x->m_pRightsib = x;
						x->m_pLeftsib = x;
						y->m_pChild = x;
						x->m_pParent = y;
						y->m_iDegree = y->m_iDegree + 1;
					}
					else
					{
						x->m_pLeftsib = y->m_pChild;
						y->m_pChild->m_pRightsib->m_pLeftsib = x;
						x->m_pRightsib = y->m_pChild->m_pRightsib;
						y->m_pChild->m_pRightsib = x;
						x->m_pParent = y;
						y->m_iDegree = y->m_iDegree + 1;
					}
				}
				else {
					x = Vec[i];
					y = it->second;
					if (y->m_pChild == NULL)
					{
						x->m_pRightsib = x;
						x->m_pLeftsib = x;
						y->m_pChild = x;
						x->m_pParent = y;
						y->m_iDegree += 1;
					}
					else
					{
						x->m_pLeftsib = y->m_pChild;
						y->m_pChild->m_pRightsib->m_pLeftsib = x;
						x->m_pRightsib = y->m_pChild->m_pRightsib;
						y->m_pChild->m_pRightsib = x;
						x->m_pParent = y;
						y->m_iDegree += 1;
					}
					Vec[i] = y;
				}
				l_pTreet.erase(it);
				it = l_pTreet.find(Vec[i]->m_iDegree);
			}
			if (it == l_pTreet.end())
			{
				l_pTreet.insert({ Vec[i]->m_iDegree,Vec[i] });
			}

		}
		itr = l_pTreet.begin();
		itr->second->m_pRightsib = itr->second;
		itr->second->m_pLeftsib = itr->second;
		l_pMax = itr->second;
		while (itr != l_pTreet.end())
		{
			l_pMax = Consolidate(l_pMax, itr->second);
			itr++;
		}
		Fib* t = m_pMax;
		m_pMax = l_pMax;
		return t;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq -0x80(%rbp), %r13
movl $0x0, (%r13)
xorl %eax, %eax
movq %rax, 0x8(%r13)
movq %r13, 0x10(%r13)
movq %r13, 0x18(%r13)
movq %rax, 0x20(%r13)
movq (%rdi), %rcx
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x2d7a
movq 0x18(%rax), %rdx
movq %rax, %rsi
movq $0x0, 0x20(%rsi)
cmpq %rax, %rdx
je 0x2d52
movq %rdx, %rsi
movq 0x18(%rdx), %rdx
cmpq %rdx, %rsi
jne 0x2d39
movq 0x18(%rcx), %rdx
movq 0x10(%rax), %rsi
movq %rdx, 0x18(%rsi)
movq %rsi, 0x10(%rdx)
movq %rcx, 0x10(%rax)
movq %rax, 0x18(%rcx)
movq $0x0, 0x8(%rcx)
movl $0x0, (%rcx)
jmp 0x2d7e
movq 0x18(%rcx), %rax
movq %rax, -0x48(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
cmpq %rcx, %rax
je 0x2f9e
leaq -0x40(%rbp), %r14
leaq -0x48(%rbp), %r15
movq -0x38(%rbp), %rsi
cmpq -0x30(%rbp), %rsi
je 0x2db6
movq %rax, (%rsi)
addq $0x8, -0x38(%rbp)
jmp 0x2dc1
movq %r14, %rdi
movq %r15, %rdx
callq 0x3152
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq (%rbx), %rax
jne 0x2da2
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rax
movq %rax, %rcx
subq %r12, %rcx
je 0x2fa1
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
movq (%r12,%rdx,8), %rsi
movq %rsi, 0x10(%rsi)
movq %rsi, 0x18(%rsi)
incq %rdx
cmpq %rdx, %rcx
jne 0x2df4
cmpq %r12, %rax
je 0x2fa1
xorl %r15d, %r15d
leaq -0x88(%rbp), %r14
movq -0x78(%rbp), %r8
testq %r8, %r8
je 0x2f68
movq (%r12,%r15,8), %rax
movl (%rax), %eax
movq %r13, %rsi
movq %rsi, %rcx
movq %r8, %rdx
movl 0x20(%r8), %edi
xorl %r8d, %r8d
cmpl %eax, %edi
setl %r8b
movq %rdx, %rsi
cmovlq %rcx, %rsi
movq 0x10(%rdx,%r8,8), %r8
testq %r8, %r8
jne 0x2e31
cmpq %r13, %rsi
je 0x2f68
cmpl %eax, %edi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
jl 0x2f68
movq -0x40(%rbp), %rdx
movq (%rdx,%r15,8), %rax
movl 0x4(%rax), %edi
movq 0x28(%rsi), %rcx
cmpl 0x4(%rcx), %edi
jle 0x2eb0
movq 0x10(%rcx), %rdx
movq 0x18(%rcx), %rdi
movq %rdi, 0x18(%rdx)
movq %rdx, 0x10(%rdi)
movq 0x8(%rax), %rdx
testq %rdx, %rdx
je 0x2ed1
movq %rdx, 0x10(%rcx)
movq 0x18(%rdx), %rdi
movq %rcx, 0x10(%rdi)
movq %rdi, 0x18(%rcx)
movq %rcx, 0x18(%rdx)
jmp 0x2edd
movq 0x8(%rcx), %rdi
testq %rdi, %rdi
je 0x2ee5
movq %rdi, 0x10(%rax)
movq 0x18(%rdi), %r9
addq $0x18, %rdi
leaq 0x10(%r9), %r8
movl $0x18, %r10d
jmp 0x2ef6
movq %rcx, 0x18(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x8(%rax)
movq %rax, 0x20(%rcx)
incl (%rax)
jmp 0x2f0a
leaq 0x8(%rcx), %rdi
leaq 0x18(%rax), %r8
movl $0x10, %r10d
movq %rax, %r9
movq %rax, (%r8)
movq %r9, (%rax,%r10)
movq %rax, (%rdi)
movq %rcx, 0x20(%rax)
incl (%rcx)
movq %rcx, (%rdx,%r15,8)
movq %r14, %rdi
callq 0x328c
movq -0x78(%rbp), %r8
testq %r8, %r8
je 0x2f64
movq -0x40(%rbp), %rax
movq (%rax,%r15,8), %rax
movl (%rax), %eax
movq %r13, %rsi
movq %rsi, %rcx
movq %r8, %rdx
movl 0x20(%r8), %edi
xorl %r8d, %r8d
cmpl %eax, %edi
setl %r8b
movq %rdx, %rsi
cmovlq %rcx, %rsi
movq 0x10(%rdx,%r8,8), %r8
testq %r8, %r8
jne 0x2f28
cmpq %r13, %rsi
je 0x2f64
cmpl %eax, %edi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
cmovlq %r13, %rsi
jge 0x2e6d
movq -0x40(%rbp), %r12
movq (%r12,%r15,8), %rax
movl (%rax), %ecx
movl %ecx, -0x58(%rbp)
movq %rax, -0x50(%rbp)
movq %r14, %rdi
leaq -0x58(%rbp), %rsi
callq 0x32ce
incq %r15
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %rax
subq %r12, %rax
sarq $0x3, %rax
cmpq %r15, %rax
ja 0x2e1b
jmp 0x2fa1
xorl %r12d, %r12d
movq -0x70(%rbp), %rax
movq 0x28(%rax), %r15
movq %r15, 0x18(%r15)
movq %r15, 0x10(%r15)
cmpq %r13, %rax
je 0x2ff4
movq 0x28(%rax), %rcx
movq 0x18(%r15), %rdx
cmpq %rcx, %rdx
je 0x2fd0
movq %rcx, 0x10(%rdx)
movq %rdx, 0x18(%rcx)
movq %rcx, %rdx
jmp 0x2fd7
movq %rcx, 0x10(%r15)
movq %r15, %rdx
movq %r15, 0x10(%rcx)
movq %rdx, 0x18(%r15)
movl 0x4(%rcx), %edx
cmpl 0x4(%r15), %edx
cmovgq %rcx, %r15
movq %rax, %rdi
callq 0x20e0
jmp 0x2fb1
movq (%rbx), %r14
movq %r15, (%rbx)
testq %r12, %r12
je 0x3007
movq %r12, %rdi
callq 0x2140
leaq -0x88(%rbp), %rdi
callq 0x33ec
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3029
jmp 0x3029
movq %rax, %rbx
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x303a
callq 0x2140
leaq -0x88(%rbp), %rdi
callq 0x33ec
movq %rbx, %rdi
callq 0x2270