// File: /workspace/github_cpp_makefile_star2_O2/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 $0x68, %rsp
movq %rdi, %rbx
leaq 0x18ec0(%rip), %r14     # 0x314e8
movl (%r14), %eax
leal -0x2(%rax), %ecx
cmpl $0x3, %ecx
jae 0x18a53
leaq 0x18e6a(%rip), %r15     # 0x314a8
movslq (%r15), %rax
leaq 0x20(%rbx), %rcx
movq %rcx, 0x30(%rsp)
leaq 0x2d0(%rbx), %rcx
movq %rcx, 0x8(%rsp)
leal -0x1(%rax), %r12d
leaq -0x8(,%rax,8), %r13
movq %rax, %rcx
decq %rcx
movq %rcx, 0x28(%rsp)
xorl %r14d, %r14d
movq %rbx, 0x38(%rsp)
movq %r12, 0x10(%rsp)
movq %r13, 0x50(%rsp)
subl 0x258(%rbx), %eax
leaq (%r12,%r14), %rbp
cmpl %ebp, %eax
ja 0x18ffe
movq 0x208(%rbx), %rax
addq %r13, %rax
movq (%rax,%r14,8), %rdi
movl 0x200(%rdi), %eax
cmpl $0x8, %eax
je 0x187e3
cmpl $0x6, %eax
je 0x18793
testl %eax, %eax
jne 0x18a48
movq 0x1d8(%rdi), %rax
cmpq 0x1d0(%rdi), %rax
jne 0x18a48
movl 0x25c(%rdi), %eax
cmpl 0x260(%rdi), %eax
jne 0x18a48
movl 0x208(%rdi), %eax
leaq 0x18dc6(%rip), %rcx     # 0x314b8
cmpl (%rcx), %eax
jne 0x18a48
movq 0x8(%rbx), %rax
movq 0x288(%rbx), %rcx
addq %r13, %rcx
cmpq (%rcx,%r14,8), %rax
jb 0x18a48
movl $0x5, 0x200(%rdi)
callq 0x1bd3c
movsd 0x8(%rbx), %xmm0
unpcklps 0xba03(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xba0b(%rip), %xmm0     # 0x24140
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x40(%rsp)
leaq 0x18df2(%rip), %rax     # 0x31540
movsd (%rax), %xmm0
leaq 0x18d3f(%rip), %rax     # 0x31498
divsd (%rax), %xmm0
callq 0x4080
addsd 0x40(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
subsd 0xdac0(%rip), %xmm0     # 0x26238
cvttsd2si %xmm0, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x280(%rbx)
jmp 0x18a48
movq %rbx, %rax
movq %r15, %rbx
movq 0x28(%rsp), %rcx
leaq (%rcx,%r14), %r13
movq 0x8(%rax), %r12
movq 0x270(%rax), %r15
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x11106
movq (%rax), %rcx
cmpq %r15, %r12
jae 0x18850
orq %rdx, %rcx
movq %rcx, (%rax)
movq %rbx, %r15
movq 0x38(%rsp), %rbx
movq 0x10(%rsp), %r12
movq 0x50(%rsp), %r13
jmp 0x18a48
movq 0x8(%rbx), %rax
movq 0x2b8(%rbx), %rcx
addq %r13, %rcx
cmpq (%rcx,%r14,8), %rax
jb 0x18a48
movl $0x1, 0x200(%rdi)
leaq 0x18c7c(%rip), %rax     # 0x31488
cmpb $0x1, (%rax)
jne 0x18a48
movq 0x187b4(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x21, 0x10(%rdi,%rax)
pushq $0x20
popq %rsi
callq 0x4440
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xdd76(%rip), %rsi      # 0x265c1
jmp 0x18a22
testq %rcx, %rdx
je 0x188a0
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x11106
notq %rdx
andq %rdx, (%rax)
leaq 0x18cc1(%rip), %rax     # 0x31530
movsd (%rax), %xmm0
leaq 0x18c1e(%rip), %rax     # 0x31498
movsd (%rax), %xmm1
movsd %xmm1, 0x20(%rsp)
divsd %xmm1, %xmm0
callq 0x4080
movapd %xmm0, 0x40(%rsp)
leaq 0x18c8e(%rip), %rax     # 0x31528
movsd (%rax), %xmm0
jmp 0x188f1
leaq 0x18c79(%rip), %rax     # 0x31520
movsd (%rax), %xmm1
movsd %xmm1, 0x60(%rsp)
leaq 0x18c78(%rip), %rax     # 0x31530
movsd (%rax), %xmm0
addsd %xmm1, %xmm0
leaq 0x18bd1(%rip), %rax     # 0x31498
movsd (%rax), %xmm1
movsd %xmm1, 0x20(%rsp)
divsd %xmm1, %xmm0
callq 0x4080
movapd %xmm0, 0x40(%rsp)
movsd 0x60(%rsp), %xmm0
leaq 0x18c3b(%rip), %rax     # 0x31528
addsd (%rax), %xmm0
divsd 0x20(%rsp), %xmm0
movq %rbx, %r15
movq 0x10(%rsp), %r12
callq 0x4080
cvttsd2si %xmm0, %rax
movsd 0xd927(%rip), %xmm1     # 0x26238
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movapd 0x40(%rsp), %xmm0
cvttsd2si %xmm0, %rax
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rcx
movq %rax, %rsi
sarq $0x3f, %rsi
andq %rcx, %rsi
orq %rax, %rsi
movq 0x38(%rsp), %rbx
movq 0x8(%rbx), %rax
addq %rax, %rsi
movq %rsi, 0x270(%rbx)
addq %rax, %rdx
movq 0x2b8(%rbx), %rax
movq 0x50(%rsp), %r13
addq %r13, %rax
movq %rdx, (%rax,%r14,8)
movq 0x208(%rbx), %rax
addq %r13, %rax
movq (%rax,%r14,8), %rax
movl $0x8, 0x200(%rax)
leaq 0x18af8(%rip), %rax     # 0x31488
cmpb $0x1, (%rax)
jne 0x18a48
leaq 0x18ae9(%rip), %rax     # 0x31489
cmpb $0x0, (%rax)
jne 0x18a48
movq 0x18620(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x21, 0x10(%rdi,%rax)
pushq $0x20
popq %rsi
callq 0x4440
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xdb9f(%rip), %rsi      # 0x2657e
callq 0x4300
movq 0x2b8(%rbx), %rcx
addq %r13, %rcx
movq (%rcx,%r14,8), %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
leaq 0xdba2(%rip), %rsi      # 0x265a6
callq 0x4300
movq 0x270(%rbx), %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
leaq 0xdb97(%rip), %rsi      # 0x265b9
callq 0x4300
movq %rax, %rdi
movl %ebp, %esi
callq 0x44f0
movq %rax, %rdi
leaq 0xea96(%rip), %rsi      # 0x274d1
callq 0x4300
movq %rax, %rdi
callq 0x4180
movl (%r15), %eax
decq %r14
jmp 0x1867f
testl %eax, %eax
je 0x18ffe
cmpl $0x1, %eax
jne 0x1900d
leaq 0x18a3d(%rip), %rbp     # 0x314a8
movl (%rbp), %eax
movq 0x208(%rbx), %rcx
xorl %edx, %edx
testl %eax, %eax
movl $0x0, %esi
cmovgl %eax, %esi
xorl %r14d, %r14d
cmpq %rdx, %rsi
je 0x18aa4
movq (%rcx,%rdx,8), %rdi
cmpl $0x0, 0x200(%rdi)
jne 0x18a9f
testb $0x1, %r14b
jne 0x18aaa
movb $0x1, %r14b
incq %rdx
jmp 0x18a84
xorb $0x1, %r14b
jmp 0x18aad
movb $0x1, %r14b
leaq 0x20(%rbx), %rcx
movq %rcx, 0x8(%rsp)
leaq 0x2d0(%rbx), %r15
xorl %r12d, %r12d
leaq 0xd8bd(%rip), %r13      # 0x26384
movslq %eax, %rcx
cmpq %rcx, %r12
jge 0x18ffe
movq 0x208(%rbx), %rcx
movq (%rcx,%r12,8), %rdi
movl 0x200(%rdi), %edx
cmpq $0x9, %rdx
ja 0x18d9c
movslq (%r13,%rdx,4), %rdx
addq %r13, %rdx
movl %eax, %eax
jmpq *%rdx
movq 0x1d8(%rdi), %rax
cmpq 0x1d0(%rdi), %rax
jne 0x18b2d
movl 0x25c(%rdi), %eax
cmpl 0x260(%rdi), %eax
jne 0x18b2d
movl 0x208(%rdi), %eax
leaq 0x18993(%rip), %rcx     # 0x314b8
cmpl (%rcx), %eax
jae 0x18de2
movl 0x26c(%rbx), %eax
addq 0x8(%rbx), %rax
movq 0x2a0(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
jmp 0x18d9c
movq 0x8(%rbx), %rax
movq 0x2b8(%rbx), %rcx
cmpq (%rcx,%r12,8), %rax
jb 0x18d9c
movl $0x1, 0x200(%rdi)
leaq 0x1891b(%rip), %rax     # 0x31488
cmpb $0x1, (%rax)
jne 0x18d9c
movq 0x18453(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x21, 0x10(%rdi,%rax)
pushq $0x20
popq %rsi
callq 0x4440
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xda15(%rip), %rsi      # 0x265c1
callq 0x4300
movq %rax, %rdi
movl %r12d, %esi
callq 0x44f0
movq %rax, %rdi
leaq 0xe90b(%rip), %rsi      # 0x274d1
jmp 0x18d8f
movq 0x8(%rbx), %rdx
cmpq 0x270(%rbx), %rdx
jae 0x18c1a
movq %r15, %rdi
movq %r12, %rsi
callq 0x11106
orq %rdx, (%rax)
jmp 0x18d9c
movq 0x8(%rbx), %rdx
movq 0x2b8(%rbx), %rsi
cmpq (%rsi,%r12,8), %rdx
jb 0x18d9c
xorl %edx, %edx
cmpq %rdx, %rax
je 0x18c43
movq (%rcx,%rdx,8), %rsi
movl $0x2, 0x200(%rsi)
incq %rdx
jmp 0x18c02
xorl %edx, %edx
cmpq %rdx, %rax
je 0x18c8e
cmpq %rdx, %r12
je 0x18c3e
movq (%rcx,%rdx,8), %rsi
movl 0x200(%rsi), %esi
cmpl $0x8, %esi
je 0x18c3e
cmpl $0x1, %esi
jne 0x18da7
incq %rdx
jmp 0x18c1c
leaq 0x1883e(%rip), %rax     # 0x31488
cmpb $0x0, (%rax)
je 0x18d9c
movq 0x18376(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x21, 0x10(%rdi,%rax)
pushq $0x20
popq %rsi
callq 0x4440
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xd95d(%rip), %rsi      # 0x265e6
jmp 0x18d8f
movq %r15, %rdi
movq %r12, %rsi
callq 0x11106
leaq 0x18880(%rip), %rcx     # 0x31520
testq %rdx, (%rax)
je 0x18cbd
movq %r15, %rdi
movq %r12, %rsi
callq 0x11106
notq %rdx
andq %rdx, (%rax)
leaq 0x18873(%rip), %rcx     # 0x31530
movsd (%rcx), %xmm0
leaq 0x18870(%rip), %rax     # 0x31538
addsd (%rax), %xmm0
leaq 0x187c5(%rip), %rax     # 0x31498
divsd (%rax), %xmm0
callq 0x4080
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xd548(%rip), %xmm0     # 0x26238
cvttsd2si %xmm0, %rdx
andq %rcx, %rdx
orq %rax, %rdx
addq 0x8(%rbx), %rdx
movq 0x2b8(%rbx), %rax
movq %rdx, (%rax,%r12,8)
movq 0x208(%rbx), %rax
movq (%rax,%r12,8), %rax
movl $0x9, 0x200(%rax)
leaq 0x18762(%rip), %rax     # 0x31488
cmpb $0x1, (%rax)
jne 0x18d9c
leaq 0x18757(%rip), %rax     # 0x31489
cmpb $0x0, (%rax)
jne 0x18d9c
movq 0x18292(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x21, 0x10(%rdi,%rax)
pushq $0x20
popq %rsi
callq 0x4440
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xd7e3(%rip), %rsi      # 0x26550
callq 0x4300
movq 0x2b8(%rbx), %rcx
movq (%rcx,%r12,8), %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
leaq 0xd7e8(%rip), %rsi      # 0x26577
callq 0x4300
movq %rax, %rdi
callq 0x4180
incq %r12
movl (%rbp), %eax
jmp 0x18ac7
movq %r15, %rdi
movq %r12, %rsi
callq 0x11106
testq %rdx, (%rax)
je 0x18e92
movq %r15, %rdi
movq %r12, %rsi
callq 0x11106
notq %rdx
andq %rdx, (%rax)
leaq 0x1875d(%rip), %rax     # 0x31530
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x18eb2
movq 0x8(%rbx), %rax
movq 0x2a0(%rbx), %rcx
cmpq (%rcx,%r12,8), %rax
jb 0x18d9c
movq 0x288(%rbx), %rcx
cmpq (%rcx,%r12,8), %rax
jb 0x18d9c
cmpl $0x0, 0x268(%rbx)
sete %al
orb %r14b, %al
testb $0x1, %al
je 0x18d9c
movl $0x5, 0x200(%rdi)
callq 0x1bd3c
movsd 0x8(%rbx), %xmm0
unpcklps 0xb304(%rip), %xmm0     # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xb30c(%rip), %xmm0     # 0x24140
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
leaq 0x186f3(%rip), %rax     # 0x31540
movsd (%rax), %xmm0
leaq 0x18640(%rip), %rax     # 0x31498
divsd (%rax), %xmm0
callq 0x4080
addsd 0x10(%rsp), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
subsd 0xd3c1(%rip), %xmm0     # 0x26238
cvttsd2si %xmm0, %rdx
sarq $0x3f, %rcx
andq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x280(%rbx)
jmp 0x18d9c
leaq 0x18687(%rip), %rax     # 0x31520
movsd (%rax), %xmm1
leaq 0x1868c(%rip), %rax     # 0x31530
movsd (%rax), %xmm0
movsd %xmm1, 0x10(%rsp)
addsd %xmm1, %xmm0
leaq 0x185df(%rip), %rax     # 0x31498
movsd (%rax), %xmm1
movsd %xmm1, 0x28(%rsp)
divsd %xmm1, %xmm0
callq 0x4080
movapd %xmm0, 0x50(%rsp)
leaq 0x1864f(%rip), %rax     # 0x31528
movsd 0x10(%rsp), %xmm0
addsd (%rax), %xmm0
divsd 0x28(%rsp), %xmm0
callq 0x4080
movapd 0x50(%rsp), %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
movsd 0xd330(%rip), %xmm1     # 0x26238
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %rdx
andq %rcx, %rdx
orq %rax, %rdx
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rsi
andq %rcx, %rsi
orq %rax, %rsi
movq 0x8(%rbx), %rax
addq %rax, %rdx
movq %rdx, 0x270(%rbx)
addq %rax, %rsi
movq 0x2b8(%rbx), %rax
movq %rsi, (%rax,%r12,8)
movq 0x208(%rbx), %rax
movq (%rax,%r12,8), %rax
movl $0x8, 0x200(%rax)
leaq 0x1851e(%rip), %rax     # 0x31488
cmpb $0x1, (%rax)
jne 0x18d9c
leaq 0x1850f(%rip), %rax     # 0x31489
cmpb $0x0, (%rax)
jne 0x18d9c
movq 0x18046(%rip), %rdi     # 0x30fd0
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x21, 0x10(%rdi,%rax)
pushq $0x20
popq %rsi
callq 0x4440
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xd5c5(%rip), %rsi      # 0x2657e
callq 0x4300
movq 0x2b8(%rbx), %rcx
movq (%rcx,%r12,8), %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
leaq 0xd5cb(%rip), %rsi      # 0x265a6
callq 0x4300
movq 0x270(%rbx), %rsi
movq %rax, %rdi
callq 0x4210
movq %rax, %rdi
leaq 0xd5c0(%rip), %rsi      # 0x265b9
jmp 0x18bac
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x17fdc(%rip), %rdi     # 0x30ff0
leaq 0xb007(%rip), %rsi      # 0x24022
callq 0x4300
leaq 0xd3f0(%rip), %rsi      # 0x26417
movq %rax, %rdi
callq 0x4300
leaq 0xb841(%rip), %rsi      # 0x24877
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
movl $0x1e7, %esi            # imm = 0x1E7
callq 0x44f0
leaq 0xafef(%rip), %rsi      # 0x24041
movq %rax, %rdi
callq 0x4300
addq $0x20, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x42b0
leaq 0xd594(%rip), %rsi      # 0x26604
movq %rax, %rdi
callq 0x4300
movl (%r14), %esi
movq %rax, %rdi
callq 0x44f0
leaq 0xe447(%rip), %rsi      # 0x274d1
movq %rax, %rdi
callq 0x4300
movq %rax, %rdi
callq 0x4180
xorl %edi, %edi
callq 0x4370
nop