// File: /workspace/github_cpp_makefile_star2_O3/estwings57[P]CasHMC/sources/HMCController.cpp
// Function: CasHMC::HMCController::LinkPowerEntryManager()
void HMCController::LinkPowerEntryManager()
{
	switch(LINK_POWER) {
		case NO_MANAGEMENT:{
			break;
		}
		case QUIESCE_SLEEP:{
			//Check for last active link
			bool lastActive = false;
			for(int l=0; l<NUM_LINKS; l++) {
				if(downLinkMasters[l]->currentState == ACTIVE) {
					if(!lastActive) {
						lastActive = true;
					}
					else {
						lastActive = false;
						break;
					}
				}
			}
				
			for(int l=0; l<NUM_LINKS; l++) {
				if(downLinkMasters[l]->currentState == ACTIVE) {
					//Setting the quiesce link traffic cycle to enter low power mode
					if(downLinkMasters[l]->Buffers.size() > 0
					|| downLinkMasters[l]->retBufReadP != downLinkMasters[l]->retBufWriteP
					|| downLinkMasters[l]->tokenCount < MAX_LINK_BUF) {
						quiesceLink[l] = currentClockCycle + quiesceClk;
					}
					else if(currentClockCycle >= quiesceLink[l] && currentClockCycle >= stayActive[l]) {
						//In order to prevent from blocking response packet to HMC controller 
						if(!lastActive || returnTransCnt == 0) {
							//Check the opposite link state for entering low power mode
							downLinkMasters[l]->currentState = WAIT;
							downLinkMasters[l]->QuitePacket();
							staySREF = currentClockCycle + ceil((double)(tSREF)/CPU_CLK_PERIOD);
						}
					}
				}
				else if(downLinkMasters[l]->currentState == CONFIRM) {
					//Stagger transition between active mode and sleep modes in order to avoid supply voltage shifts
					if(currentClockCycle >= staggerSleep) {
						//When the last link exits active mode, links are transitioned to down mode to further reduce power consumption
						bool lastExit = true;
						for(int k=0; k<NUM_LINKS; k++) {
							if(l != k && !(downLinkMasters[k]->currentState == SLEEP || downLinkMasters[k]->currentState == TRANSITION_TO_SLEEP)) {
								lastExit = false;
								break;
							}
						}
						
						if(lastExit) {
							uint64_t tran = 0;
							if(staggeringSleep[l]) {
								staggeringSleep[l] = false;
								tran = ceil((double)(tSS+tSD)/CPU_CLK_PERIOD);
							}
							else {
								tran = ceil((double)(tPST+tSD)/CPU_CLK_PERIOD);
							}
							modeTransition[l] = currentClockCycle + tran;
							downLinkMasters[l]->currentState = TRANSITION_TO_DOWN;
							DEBUG(ALI(33)<<header<<"Down) link DOWN MODE transition after "<<modeTransition[l]<<" cycle");
						}
						//Link sleep mode entry
						else {
							uint64_t stag = 0;
							uint64_t tran = 0;
							if(staggeringSleep[l]) {
								staggeringSleep[l] = false;
								stag = ceil((double)tSS/CPU_CLK_PERIOD);
								tran = ceil((double)(tSS+tSME)/CPU_CLK_PERIOD);
							}
							else {
								stag = ceil((double)(tPST+tSS)/CPU_CLK_PERIOD);
								tran = ceil((double)(tPST+tSME)/CPU_CLK_PERIOD);
							}
							staggerSleep = currentClockCycle + stag;
							modeTransition[l] = currentClockCycle + tran;
							downLinkMasters[l]->currentState = TRANSITION_TO_SLEEP;
							DEBUG(ALI(33)<<header<<"Down) link SLEEP MODE transition after "<<modeTransition[l]<<" cycle (stagger : "<<staggerSleep<<") (LM_D"<<l<<")");
						}
					}
					else {
						staggeringSleep[l] = true;
					}
				}
				//Sleep mode entry
				else if(downLinkMasters[l]->currentState == TRANSITION_TO_SLEEP) {
					if(currentClockCycle >= modeTransition[l]) {
						downLinkMasters[l]->currentState = SLEEP;
						DE_CR(ALI(33)<<header<<"Down) entering link SLEEP MODE (LM_D"<<l<<")");
					}
				}
				//Down mode entry
				else if(downLinkMasters[l]->currentState == TRANSITION_TO_DOWN) {
					if(currentClockCycle >= modeTransition[l]) {
						for(int k=0; k<NUM_LINKS; k++) {
							downLinkMasters[k]->currentState = DOWN;
						}
						DE_CR(ALI(33)<<header<<"Down) entering link DOWN MODE");
					}
				}
			}
			break;
		}
		case MSHR:
		case LINK_MONITOR:
		case AUTONOMOUS:{
			//Transition links to sleep mode as many as sleepLink
			for(int l=NUM_LINKS - 1; l>=NUM_LINKS-sleepLink; l--) {
				if(downLinkMasters[l]->currentState == ACTIVE) {
					//The condition to enter sleep mode
					if(downLinkMasters[l]->Buffers.size() == 0
					&& downLinkMasters[l]->retBufReadP == downLinkMasters[l]->retBufWriteP
					&& downLinkMasters[l]->tokenCount == MAX_LINK_BUF
					&& currentClockCycle >= stayActive[l]) {
						//Check the opposite link state for entering low power mode
						downLinkMasters[l]->currentState = WAIT;
						downLinkMasters[l]->QuitePacket();
						staySREF = currentClockCycle + ceil((double)(tSREF)/CPU_CLK_PERIOD);
					}
				}
				else if(downLinkMasters[l]->currentState == CONFIRM) {
					//Stagger transition between active mode and sleep modes in order to avoid supply voltage shifts
					if(currentClockCycle >= staggerSleep) {
						uint64_t stag = 0;
						uint64_t tran = 0;
						if(staggeringSleep[l]) {
							staggeringSleep[l] = false;
							stag = ceil((double)tSS/CPU_CLK_PERIOD);
							tran = ceil((double)tSME/CPU_CLK_PERIOD);
						}
						else {
							stag = ceil((double)(tPST+tSS)/CPU_CLK_PERIOD);
							tran = ceil((double)(tPST+tSME)/CPU_CLK_PERIOD);
						}
						staggerSleep = currentClockCycle + stag;
						modeTransition[l] = currentClockCycle + tran;
						downLinkMasters[l]->currentState = TRANSITION_TO_SLEEP;
						DEBUG(ALI(33)<<header<<"Down) link SLEEP MODE transition after "<<modeTransition[l]<<" cycle (stagger : "<<staggerSleep<<") (LM_D"<<l<<")");
					}
					else {
						staggeringSleep[l] = true;
					}
				}
				//Sleep mode entry
				else if(downLinkMasters[l]->currentState == TRANSITION_TO_SLEEP) {
					if(currentClockCycle >= modeTransition[l]) {
						downLinkMasters[l]->currentState = SLEEP;
						DE_CR(ALI(33)<<header<<"Down) entering link SLEEP MODE (LM_D"<<l<<")");
					}
				}
			}
			break;
		}
		default:{
			ERROR(header<<"   == Error - WRONG LINK_POWER parameter  (LINK_POWER : "<<LINK_POWER<<")");
			exit(0);
			break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0x1b06c(%rip), %r14     # 0x3b4e8
movl (%r14), %eax
leal -0x2(%rax), %ecx
cmpl $0x3, %ecx
jae 0x20a08
leaq 0x1b016(%rip), %rdi     # 0x3b4a8
movslq (%rdi), %rdx
leal -0x1(%rdx), %eax
movl 0x258(%rbx), %ecx
movq %rdx, %rsi
subl %ecx, %edx
cmpl %edx, %eax
jb 0x21173
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
leaq -0x8(,%rsi,8), %r9
decq %rsi
movq %rsi, 0x8(%rsp)
movl %eax, %r12d
xorl %r15d, %r15d
leaq 0x3f(%rcx), %rax
movq %rax, 0x20(%rsp)
movq %r9, 0x10(%rsp)
movq 0x208(%rbx), %rax
addq %r9, %rax
movq (%rax,%r15,8), %r13
movl 0x200(%r13), %eax
cmpl $0x8, %eax
je 0x20667
cmpl $0x6, %eax
je 0x205ef
testl %eax, %eax
jne 0x209ec
movq 0x1d8(%r13), %rax
cmpq 0x1d0(%r13), %rax
jne 0x209ec
movl 0x25c(%r13), %eax
cmpl 0x260(%r13), %eax
jne 0x209ec
movl 0x208(%r13), %eax
leaq 0x1af7a(%rip), %rcx     # 0x3b4b8
cmpl (%rcx), %eax
jne 0x209ec
movq 0x8(%rbx), %rax
movq 0x288(%rbx), %rcx
addq %r9, %rcx
cmpq (%rcx,%r15,8), %rax
jb 0x209ec
movl $0x5, 0x200(%r13)
movq %r13, %rdi
callq 0x24f90
movsd 0x8(%rbx), %xmm0
unpcklps 0xfba3(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xfb8b(%rip), %xmm0     # 0x30110
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
leaq 0x1afa2(%rip), %rax     # 0x3b540
movsd (%rax), %xmm0
leaq 0x1aeef(%rip), %rax     # 0x3b498
divsd (%rax), %xmm0
callq 0x4090
movq 0x10(%rsp), %r9
leaq 0x1aeea(%rip), %rdi     # 0x3b4a8
addsd 0x30(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
subsd 0x11c84(%rip), %xmm0    # 0x32258
cvttsd2si %xmm0, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x280(%rbx)
jmp 0x209ec
movq 0x8(%rsp), %rax
leaq (%rax,%r15), %rcx
movq %r12, %r14
leaq (%r12,%r15), %rbp
leal 0x3f(%rbp), %eax
testl %ebp, %ebp
cmovnsl %ebp, %eax
sarl $0x6, %eax
cltq
shlq $0x3, %rax
addq 0x2d0(%rbx), %rax
movq 0x8(%rbx), %r12
movq %rcx, %rdx
andq 0x20(%rsp), %rdx
xorl %esi, %esi
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
cmpq %r8, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
leaq -0x8(,%rsi,8), %rcx
movq -0x8(%rax,%rsi,8), %rsi
cmpq 0x270(%rbx), %r12
jae 0x20767
orq %rdx, %rsi
movq %rsi, (%rax,%rcx)
movq %r14, %r12
jmp 0x209ec
movq 0x8(%rbx), %rax
movq 0x2b8(%rbx), %rcx
addq %r9, %rcx
cmpq (%rcx,%r15,8), %rax
jb 0x209ec
movl $0x1, 0x200(%r13)
leaq 0x1adf7(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x209ec
movq 0x1a92f(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x21, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x206d8
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1a8e1(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r13
movl $0x24, %edx
movq %rax, %rdi
leaq 0x11ecb(%rip), %rsi     # 0x325d1
callq 0x4340
leal (%r12,%r15), %esi
movq %r13, %rdi
callq 0x4500
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x12db8(%rip), %rsi     # 0x334e1
callq 0x4340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
leaq 0x1ad4b(%rip), %rdi     # 0x3b4a8
movq 0x10(%rsp), %r9
jmp 0x209ec
testq %rdx, %rsi
je 0x207cf
notq %rdx
andq %rdx, %rsi
movq %rsi, (%rax,%rcx)
leaq 0x1adb3(%rip), %rax     # 0x3b530
movsd (%rax), %xmm0
leaq 0x1ada0(%rip), %rax     # 0x3b528
movhpd (%rax), %xmm0           # xmm0 = xmm0[0],mem[0]
leaq 0x1ad05(%rip), %rax     # 0x3b498
movsd (%rax), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm0
movapd %xmm0, 0x40(%rsp)
callq 0x4090
movapd %xmm0, 0x30(%rsp)
movapd 0x40(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4090
movapd 0x30(%rsp), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movq 0x8(%rbx), %r12
jmp 0x20835
leaq 0x1ad4a(%rip), %rax     # 0x3b520
movsd (%rax), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
leaq 0x1ad4b(%rip), %rax     # 0x3b530
movsd (%rax), %xmm0
leaq 0x1ad38(%rip), %rax     # 0x3b528
movhpd (%rax), %xmm0           # xmm0 = xmm0[0],mem[0]
addpd %xmm1, %xmm0
leaq 0x1ac99(%rip), %rax     # 0x3b498
movsd (%rax), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm0
movapd %xmm0, 0x40(%rsp)
callq 0x4090
movapd %xmm0, 0x30(%rsp)
movapd 0x40(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4090
movapd 0x30(%rsp), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
cvttsd2si %xmm0, %rax
movsd 0x11a0e(%rip), %xmm1    # 0x32258
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
cvttsd2si %xmm2, %rax
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rcx
movq %rax, %rsi
sarq $0x3f, %rsi
andq %rcx, %rsi
orq %rax, %rsi
addq %r12, %rsi
movq %rsi, 0x270(%rbx)
addq %r12, %rdx
movq 0x2b8(%rbx), %rax
movq 0x10(%rsp), %r9
addq %r9, %rax
movq %rdx, (%rax,%r15,8)
movl $0x8, 0x200(%r13)
leaq 0x1abdb(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
leaq 0x1abf1(%rip), %rdi     # 0x3b4a8
movq %r14, %r12
jne 0x209ec
leaq 0x1abc2(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x209ec
movq 0x1a6f9(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x21, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x2090e
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1a6ab(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r13
movl $0x27, %edx
movq %rax, %rdi
leaq 0x11c52(%rip), %rsi     # 0x3258e
callq 0x4340
movq 0x2b8(%rbx), %rax
movq 0x10(%rsp), %r14
addq %r14, %rax
movq (%rax,%r15,8), %rsi
movq %r13, %rdi
callq 0x41e0
movq %rax, %r13
movl $0x12, %edx
movq %rax, %rdi
leaq 0x11c48(%rip), %rsi     # 0x325b6
callq 0x4340
movq 0x270(%rbx), %rsi
movq %r13, %rdi
callq 0x41e0
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
leaq 0x11c35(%rip), %rsi     # 0x325c9
callq 0x4340
movq %r13, %rdi
movl %ebp, %esi
callq 0x4500
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x12b2c(%rip), %rsi     # 0x334e1
callq 0x4340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
movq %r14, %r9
leaq 0x1aabc(%rip), %rdi     # 0x3b4a8
movl (%rdi), %eax
subl 0x258(%rbx), %eax
decq %r15
leal (%r12,%r15), %ecx
cmpl %ecx, %eax
jbe 0x204d9
jmp 0x21173
testl %eax, %eax
je 0x21173
cmpl $0x1, %eax
jne 0x21182
leaq 0x1aa88(%rip), %rbp     # 0x3b4a8
movslq (%rbp), %rax
testq %rax, %rax
jle 0x21173
movq 0x208(%rbx), %rcx
xorl %edx, %edx
xorl %edi, %edi
movq (%rcx,%rdx,8), %rsi
cmpl $0x0, 0x200(%rsi)
jne 0x20a4e
testb $0x1, %dil
jne 0x20a61
movb $0x1, %dil
incq %rdx
cmpq %rdx, %rax
jne 0x20a38
xorb $0x1, %dil
movq %rdi, 0x8(%rsp)
jmp 0x20a68
movb $0x1, %cl
movq %rcx, 0x8(%rsp)
testl %eax, %eax
jle 0x21173
xorl %r14d, %r14d
leaq 0x1191a(%rip), %r12     # 0x32394
movq 0x208(%rbx), %rcx
movq (%rcx,%r14,8), %r13
movl 0x200(%r13), %edx
cmpq $0x9, %rdx
ja 0x20e68
movslq (%r12,%rdx,4), %rdx
addq %r12, %rdx
jmpq *%rdx
movq 0x1d8(%r13), %rax
cmpq 0x1d0(%r13), %rax
jne 0x20ad5
movl 0x25c(%r13), %eax
cmpl 0x260(%r13), %eax
jne 0x20ad5
movl 0x208(%r13), %eax
leaq 0x1a9eb(%rip), %rcx     # 0x3b4b8
cmpl (%rcx), %eax
jae 0x20e7d
movl 0x26c(%rbx), %eax
addq 0x8(%rbx), %rax
movq 0x2a0(%rbx), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x20e68
movq 0x8(%rbx), %rax
movq 0x2b8(%rbx), %rcx
cmpq (%rcx,%r14,8), %rax
jb 0x20e68
movl $0x1, 0x200(%r13)
leaq 0x1a972(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
jne 0x20e68
movq 0x1a4aa(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x21, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x20b5d
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1a45c(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r13
movl $0x24, %edx
movq %rax, %rdi
leaq 0x11a46(%rip), %rsi     # 0x325d1
callq 0x4340
movq %r13, %rdi
movl %r14d, %esi
callq 0x4500
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
leaq 0x12934(%rip), %rsi     # 0x334e1
jmp 0x20e3b
movq %rbp, %r15
movq 0x8(%rbx), %rbp
cmpq 0x270(%rbx), %rbp
jae 0x20c9e
movq 0x2d0(%rbx), %rax
movl %r14d, %edx
movl $0x1, %esi
movl %r14d, %ecx
shlq %cl, %rsi
shrl $0x6, %edx
orq %rsi, (%rax,%rdx,8)
movq %r15, %rbp
jmp 0x20e68
movq 0x8(%rbx), %rdx
movq 0x2b8(%rbx), %rsi
cmpq (%rsi,%r14,8), %rdx
jb 0x20e68
testl %eax, %eax
jle 0x20c1d
movl %eax, %eax
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movl $0x2, 0x200(%rsi)
incq %rdx
cmpq %rdx, %rax
jne 0x20c07
leaq 0x1a864(%rip), %rax     # 0x3b488
cmpb $0x0, (%rax)
je 0x20e68
movq 0x1a39c(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x21, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x20c6b
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1a34e(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r13
movl $0x1d, %edx
movq %rax, %rdi
leaq 0x1195d(%rip), %rsi     # 0x325f6
jmp 0x20e3b
testl %eax, %eax
jle 0x20ccb
movl %eax, %eax
xorl %edx, %edx
cmpq %rdx, %r14
je 0x20cc3
movq (%rcx,%rdx,8), %rsi
movl 0x200(%rsi), %esi
cmpl $0x8, %esi
je 0x20cc3
cmpl $0x1, %esi
jne 0x20f32
incq %rdx
cmpq %rdx, %rax
jne 0x20ca6
movq 0x2d0(%rbx), %rax
movl $0x1, %edx
movl %r14d, %ecx
shlq %cl, %rdx
movq %r14, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rsi
btq %r14, %rsi
jae 0x20d24
notq %rdx
andq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
leaq 0x1a831(%rip), %rax     # 0x3b530
movsd (%rax), %xmm0
leaq 0x1a82e(%rip), %rax     # 0x3b538
addsd (%rax), %xmm0
leaq 0x1a783(%rip), %rax     # 0x3b498
divsd (%rax), %xmm0
callq 0x4090
movq 0x8(%rbx), %rbp
jmp 0x20d4a
leaq 0x1a7f5(%rip), %rax     # 0x3b520
movsd (%rax), %xmm0
leaq 0x1a802(%rip), %rax     # 0x3b538
addsd (%rax), %xmm0
leaq 0x1a757(%rip), %rax     # 0x3b498
divsd (%rax), %xmm0
callq 0x4090
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x114fa(%rip), %xmm0    # 0x32258
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
addq %rbp, %rdx
movq 0x2b8(%rbx), %rax
movq %rdx, (%rax,%r14,8)
movl $0x9, 0x200(%r13)
leaq 0x1a6ff(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
movq %r15, %rbp
jne 0x20e68
leaq 0x1a6ed(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x20e68
movq 0x1a224(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x21, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x20de3
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x1a1d6(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r13
movl $0x26, %edx
movq %rax, %rdi
leaq 0x1174f(%rip), %rsi     # 0x32560
callq 0x4340
movq 0x2b8(%rbx), %rax
movq (%rax,%r14,8), %rsi
movq %r13, %rdi
callq 0x41e0
movq %rax, %r13
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1174c(%rip), %rsi     # 0x32587
callq 0x4340
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r13, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x41f0
incq %r14
movslq (%rbp), %rax
cmpq %rax, %r14
jl 0x20a7a
jmp 0x21173
movq 0x8(%rbx), %rax
movq 0x2a0(%rbx), %rcx
cmpq (%rcx,%r14,8), %rax
jb 0x20e68
movq 0x288(%rbx), %rcx
cmpq (%rcx,%r14,8), %rax
jb 0x20e68
cmpl $0x0, 0x268(%rbx)
sete %al
orb 0x8(%rsp), %al
testb $0x1, %al
je 0x20e68
movl $0x5, 0x200(%r13)
movq %r13, %rdi
callq 0x24f90
movsd 0x8(%rbx), %xmm0
unpcklps 0xf254(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xf23c(%rip), %xmm0     # 0x30110
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x20(%rsp)
leaq 0x1a653(%rip), %rax     # 0x3b540
movsd (%rax), %xmm0
leaq 0x1a5a0(%rip), %rax     # 0x3b498
divsd (%rax), %xmm0
callq 0x4090
addsd 0x20(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
subsd 0x11341(%rip), %xmm0    # 0x32258
cvttsd2si %xmm0, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x280(%rbx)
jmp 0x20e68
movq 0x2d0(%rbx), %rax
movl $0x1, %edx
movl %r14d, %ecx
shlq %cl, %rdx
movq %r14, %rcx
shrq $0x6, %rcx
movq (%rax,%rcx,8), %rsi
btq %r14, %rsi
jae 0x20fc0
notq %rdx
andq %rdx, %rsi
movq %rsi, (%rax,%rcx,8)
leaq 0x1a5ca(%rip), %rax     # 0x3b530
movsd (%rax), %xmm1
leaq 0x1a5b7(%rip), %rax     # 0x3b528
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
unpcklpd %xmm1, %xmm0            # xmm0 = xmm0[0],xmm1[0]
leaq 0x1a514(%rip), %rax     # 0x3b498
movsd (%rax), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm0
movapd %xmm0, 0x10(%rsp)
callq 0x4090
movapd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4090
movapd 0x20(%rsp), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movq 0x8(%rbx), %rbp
jmp 0x21026
leaq 0x1a559(%rip), %rax     # 0x3b520
movsd (%rax), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
leaq 0x1a552(%rip), %rax     # 0x3b528
movsd (%rax), %xmm0
leaq 0x1a54f(%rip), %rax     # 0x3b530
movhpd (%rax), %xmm0           # xmm0 = xmm0[0],mem[0]
addpd %xmm1, %xmm0
leaq 0x1a4a8(%rip), %rax     # 0x3b498
movsd (%rax), %xmm1
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
divpd %xmm1, %xmm0
movapd %xmm0, 0x10(%rsp)
callq 0x4090
movapd %xmm0, 0x20(%rsp)
movapd 0x10(%rsp), %xmm0
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
callq 0x4090
movapd 0x20(%rsp), %xmm2
unpcklpd %xmm0, %xmm2            # xmm2 = xmm2[0],xmm0[0]
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
cvttsd2si %xmm0, %rax
movsd 0x1121d(%rip), %xmm1    # 0x32258
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
cvttsd2si %xmm2, %rcx
orq %rax, %rdx
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movq %rcx, %rsi
sarq $0x3f, %rsi
andq %rax, %rsi
orq %rcx, %rsi
addq %rbp, %rdx
movq %rdx, 0x270(%rbx)
addq %rbp, %rsi
movq 0x2b8(%rbx), %rax
movq %rsi, (%rax,%r14,8)
movl $0x8, 0x200(%r13)
leaq 0x1a3f2(%rip), %rax     # 0x3b488
cmpb $0x1, (%rax)
movq %r15, %rbp
jne 0x20e68
leaq 0x1a3e0(%rip), %rax     # 0x3b489
cmpb $0x0, (%rax)
jne 0x20e68
movq 0x19f17(%rip), %rdx     # 0x3afd0
movq (%rdx), %rax
movq -0x18(%rax), %rcx
movq $0x21, 0x10(%rdx,%rcx)
movq -0x18(%rax), %rax
leaq (%rdx,%rax), %r13
cmpb $0x0, 0xe1(%rdx,%rax)
jne 0x210f0
movq %r13, %rdi
movl $0x20, %esi
callq 0x42d0
movb $0x1, 0xe1(%r13)
movb $0x20, 0xe0(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
movq 0x19ec9(%rip), %rdi     # 0x3afd0
callq 0x4340
movq %rax, %r13
movl $0x27, %edx
movq %rax, %rdi
leaq 0x11470(%rip), %rsi     # 0x3258e
callq 0x4340
movq 0x2b8(%rbx), %rax
movq (%rax,%r14,8), %rsi
movq %r13, %rdi
callq 0x41e0
movq %rax, %r13
movl $0x12, %edx
movq %rax, %rdi
leaq 0x1146e(%rip), %rsi     # 0x325b6
callq 0x4340
movq 0x270(%rbx), %rsi
movq %r13, %rdi
callq 0x41e0
movq %rax, %r13
movl $0x7, %edx
movq %rax, %rdi
leaq 0x1145b(%rip), %rsi     # 0x325c9
jmp 0x20b8b
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x19e67(%rip), %rdi     # 0x3aff0
leaq 0xee92(%rip), %rsi      # 0x30022
callq 0x42e0
leaq 0x1128b(%rip), %rsi     # 0x32427
movq %rax, %rdi
callq 0x42e0
leaq 0xf6ec(%rip), %rsi      # 0x30897
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
movl $0x1e7, %esi            # imm = 0x1E7
callq 0x4500
leaq 0xee7a(%rip), %rsi      # 0x30041
movq %rax, %rdi
callq 0x42e0
addq $0x20, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4290
leaq 0x1142f(%rip), %rsi     # 0x32614
movq %rax, %rdi
callq 0x42e0
movl (%r14), %esi
movq %rax, %rdi
callq 0x4500
leaq 0x122e2(%rip), %rsi     # 0x334e1
movq %rax, %rdi
callq 0x42e0
movq %rax, %rdi
callq 0x4170
xorl %edi, %edi
callq 0x4360