// File: /workspace/github_cpp_makefile_star2_O1/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 -0x88(%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), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x30(%rbp)
testq %rcx, %rcx
je 0x2d94
movq -0x30(%rbp), %rdx
movq $0x0, 0x20(%rdx)
movq 0x18(%rdx), %rdx
cmpq %rcx, %rdx
je 0x2d66
cmpq 0x18(%rdx), %rdx
jne 0x2d4f
movq %rdx, -0x30(%rbp)
movq 0x18(%rax), %rdx
movq 0x10(%rcx), %rsi
movq %rdx, 0x18(%rsi)
movq 0x18(%rax), %rdx
movq %rsi, 0x10(%rdx)
movq %rax, 0x10(%rcx)
movq %rcx, 0x18(%rax)
movq $0x0, 0x8(%rax)
movl $0x0, (%rax)
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x2dba
movq $0x0, -0x48(%rbp)
movq -0x30(%rbp), %rax
cmpq (%rbx), %rax
je 0x2dfb
leaq -0x50(%rbp), %r14
leaq -0x30(%rbp), %r15
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x2ddf
movq %rax, (%rsi)
addq $0x8, -0x48(%rbp)
jmp 0x2dea
movq %r14, %rdi
movq %r15, %rdx
callq 0x3150
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq (%rbx), %rax
jne 0x2dcb
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rax, %rcx
je 0x2e2e
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
movq %rsi, 0x10(%rsi)
movq (%rax,%rdx,8), %rsi
movq %rsi, 0x18(%rsi)
incq %rdx
cmpq %rdx, %rcx
jne 0x2e16
movq -0x50(%rbp), %r12
cmpq %r12, -0x48(%rbp)
je 0x2fa9
xorl %r15d, %r15d
leaq -0x90(%rbp), %r14
movq (%r12,%r15,8), %rax
movq -0x80(%rbp), %rdx
movq %r13, %rcx
testq %rdx, %rdx
je 0x2f54
movl (%rax), %esi
movq %r13, %rcx
xorl %edi, %edi
cmpl %esi, 0x20(%rdx)
setl %dil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0x2e5f
jmp 0x2f54
movq -0x50(%rbp), %rdx
movq (%rdx,%r15,8), %rax
movl 0x4(%rax), %edi
movq 0x28(%rsi), %rcx
cmpl 0x4(%rcx), %edi
jle 0x2ec2
movq 0x10(%rcx), %rdx
movq 0x18(%rcx), %rdi
movq %rdi, 0x18(%rdx)
movq 0x18(%rcx), %rdi
movq %rdx, 0x10(%rdi)
movq 0x8(%rax), %rdx
testq %rdx, %rdx
je 0x2ee3
movq %rdx, 0x10(%rcx)
movq 0x18(%rdx), %rdi
movq %rcx, 0x10(%rdi)
movq %rdi, 0x18(%rcx)
movq %rcx, 0x18(%rdx)
jmp 0x2eef
movq 0x8(%rcx), %rdi
testq %rdi, %rdi
je 0x2ef7
movq %rdi, 0x10(%rax)
movq 0x18(%rdi), %r9
addq $0x18, %rdi
leaq 0x10(%r9), %r8
movl $0x18, %r10d
jmp 0x2f08
movq %rcx, 0x18(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x8(%rax)
movq %rax, 0x20(%rcx)
incl (%rax)
jmp 0x2f1c
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 0x328a
movq -0x50(%rbp), %rax
movq (%rax,%r15,8), %rax
movq -0x80(%rbp), %rdx
movq %r13, %rcx
testq %rdx, %rdx
je 0x2f54
movl (%rax), %esi
movq %r13, %rcx
xorl %edi, %edi
cmpl %esi, 0x20(%rdx)
setl %dil
cmovgeq %rdx, %rcx
movq 0x10(%rdx,%rdi,8), %rdx
testq %rdx, %rdx
jne 0x2f3d
movq %r13, %rsi
cmpq %r13, %rcx
je 0x2f68
movl (%rax), %eax
cmpl 0x20(%rcx), %eax
cmovlq %r13, %rcx
movq %rcx, %rsi
cmpq %r13, %rsi
jne 0x2e7b
movq -0x50(%rbp), %rax
movq (%rax,%r15,8), %rax
movl (%rax), %ecx
movl %ecx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
movq %r14, %rdi
leaq -0x60(%rbp), %rsi
callq 0x32cc
incq %r15
movq -0x50(%rbp), %r12
movq -0x48(%rbp), %rax
subq %r12, %rax
sarq $0x3, %rax
cmpq %r15, %rax
ja 0x2e46
movq -0x78(%rbp), %rax
movq 0x28(%rax), %r15
movq %r15, 0x18(%r15)
movq %r15, 0x10(%r15)
cmpq %r13, %rax
je 0x3000
movq 0x28(%rax), %rcx
leaq 0x18(%r15), %rdx
movq 0x18(%r15), %rsi
cmpq %rcx, %rsi
je 0x2fe0
movq %rcx, 0x10(%rsi)
movq %rsi, 0x18(%rcx)
movq %rcx, (%rdx)
leaq 0x10(%rcx), %rdx
jmp 0x2fe8
movq %rcx, 0x10(%r15)
movq %r15, 0x10(%rcx)
movq %r15, (%rdx)
movl 0x4(%rcx), %edx
cmpl 0x4(%r15), %edx
cmovgq %rcx, %r15
movq %rax, %rdi
callq 0x20e0
jmp 0x2fb9
movq (%rbx), %r14
movq %r15, (%rbx)
testq %r12, %r12
je 0x3013
movq %r12, %rdi
callq 0x2140
leaq -0x90(%rbp), %rdi
callq 0x33f6
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3035
jmp 0x3035
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3046
callq 0x2140
leaq -0x90(%rbp), %rdi
callq 0x33f6
movq %rbx, %rdi
callq 0x2270