// File: /workspace/github_cpp_makefile_star2_O2/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
leaq -0x88(%rbp), %r12
andl $0x0, (%r12)
andq $0x0, 0x8(%r12)
movq %r12, 0x10(%r12)
movq %r12, 0x18(%r12)
andq $0x0, 0x20(%r12)
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x2b03
movq 0x18(%rcx), %rdx
movq %rcx, %rsi
andq $0x0, 0x20(%rsi)
cmpq %rcx, %rdx
je 0x2ae1
movq %rdx, %rsi
movq 0x18(%rdx), %rdx
cmpq %rdx, %rsi
jne 0x2acb
movq 0x18(%rax), %rdx
movq 0x10(%rcx), %rsi
movq %rdx, 0x18(%rsi)
movq %rsi, 0x10(%rdx)
movq %rax, 0x10(%rcx)
movq %rcx, 0x18(%rax)
andq $0x0, 0x8(%rax)
andl $0x0, (%rax)
jmp 0x2b07
movq 0x18(%rax), %rcx
leaq -0x48(%rbp), %r14
movq %rcx, (%r14)
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
cmpq %rax, %rcx
je 0x2b3f
movq %r15, %rdi
movq %r14, %rsi
callq 0x2d5c
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rcx
movq %rcx, -0x48(%rbp)
movq (%rbx), %rax
jmp 0x2b1e
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
xorl %esi, %esi
cmpq %rsi, %rdx
je 0x2b69
movq (%rax,%rsi,8), %rdi
movq %rdi, 0x10(%rdi)
movq %rdi, 0x18(%rdi)
incq %rsi
jmp 0x2b53
movq %rbx, -0x50(%rbp)
xorl %r13d, %r13d
leaq -0x90(%rbp), %r14
pushq $0x10
popq %r15
pushq $0x18
popq %rbx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r13, %rcx
jbe 0x2c87
movq (%rax,%r13,8), %rsi
movq %r14, %rdi
callq 0x2f0a
cmpq %r12, %rax
je 0x2c5a
movq -0x40(%rbp), %rsi
movq (%rsi,%r13,8), %rcx
movl 0x4(%rcx), %edi
movq 0x28(%rax), %rdx
cmpl 0x4(%rdx), %edi
jle 0x2be6
movq 0x10(%rdx), %rsi
movq 0x18(%rdx), %rdi
movq %rdi, 0x18(%rsi)
movq %rsi, 0x10(%rdi)
movq 0x8(%rcx), %rsi
testq %rsi, %rsi
je 0x2c04
movq %rsi, 0x10(%rdx)
movq 0x18(%rsi), %rdi
movq %rdx, 0x10(%rdi)
movq %rdi, 0x18(%rdx)
movq %rdx, 0x18(%rsi)
jmp 0x2c10
movq 0x8(%rdx), %rdi
testq %rdi, %rdi
je 0x2c18
movq %rdi, 0x10(%rcx)
movq 0x18(%rdi), %r8
addq $0x18, %rdi
leaq 0x10(%r8), %r9
movq %rbx, %r10
jmp 0x2c26
movq %rdx, 0x18(%rdx)
movq %rdx, 0x10(%rdx)
movq %rdx, 0x8(%rcx)
movq %rcx, 0x20(%rdx)
incl (%rcx)
jmp 0x2c3a
leaq 0x8(%rdx), %rdi
leaq 0x18(%rcx), %r9
movq %r15, %r10
movq %rcx, %r8
movq %rcx, (%r9)
movq %r8, (%rcx,%r10)
movq %rcx, (%rdi)
movq %rdx, 0x20(%rcx)
incl (%rdx)
movq %rdx, (%rsi,%r13,8)
movq %r14, %rdi
movq %rax, %rsi
callq 0x2f62
movq -0x40(%rbp), %rax
movq (%rax,%r13,8), %rsi
movq %r14, %rdi
callq 0x2f0a
jmp 0x2b9a
movq -0x40(%rbp), %rax
movq (%rax,%r13,8), %rax
movl (%rax), %ecx
movl %ecx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
movq %r14, %rdi
leaq -0x60(%rbp), %rsi
callq 0x2fc2
incq %r13
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
jmp 0x2b7e
movq -0x78(%rbp), %r15
movq 0x28(%r15), %r14
movq %r14, 0x18(%r14)
movq %r14, 0x10(%r14)
movq -0x50(%rbp), %rbx
cmpq %r12, %r15
je 0x2cbf
movq 0x28(%r15), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2d80
movq %rax, %r14
movq %r15, %rdi
callq 0x2100
movq %rax, %r15
jmp 0x2c9b
movq (%rbx), %r15
movq %r14, (%rbx)
leaq -0x40(%rbp), %rdi
callq 0x314a
leaq -0x90(%rbp), %rdi
callq 0x315e
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2cf4
jmp 0x2cf4
jmp 0x2cf4
jmp 0x2cf4
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x314a
leaq -0x90(%rbp), %rdi
callq 0x315e
movq %rbx, %rdi
callq 0x2270