// File: xocoder[P]m_kcptun/vendor/kcp/ikcp.c
// Function: ikcp_flush
void ikcp_flush(ikcpcb *kcp)
{
	IUINT32 current = kcp->current;
	char *buffer = kcp->buffer;
	char *ptr = buffer;
	int count, size, i;
	IUINT32 resent, cwnd;
	IUINT32 rtomin;
	struct IQUEUEHEAD *p;
	int change = 0;
	int lost = 0;
	IKCPSEG seg;

	// 'ikcp_update' haven't been called. 
	if (kcp->updated == 0) return;

	seg.conv = kcp->conv;
	seg.cmd = IKCP_CMD_ACK;
	seg.frg = 0;
	seg.wnd = ikcp_wnd_unused(kcp);
	seg.una = kcp->rcv_nxt;
	seg.len = 0;
	seg.sn = 0;
	seg.ts = 0;

	// flush acknowledges
	count = kcp->ackcount;
	for (i = 0; i < count; i++) {
		size = (int)(ptr - buffer);
		if (size + (int)IKCP_OVERHEAD > (int)kcp->mtu) {
			ikcp_output(kcp, buffer, size);
			ptr = buffer;
		}
		ikcp_ack_get(kcp, i, &seg.sn, &seg.ts);
		ptr = ikcp_encode_seg(ptr, &seg);
	}

	kcp->ackcount = 0;

	// probe window size (if remote window size equals zero)
	if (kcp->rmt_wnd == 0) {
		if (kcp->probe_wait == 0) {
			kcp->probe_wait = IKCP_PROBE_INIT;
			kcp->ts_probe = kcp->current + kcp->probe_wait;
		}	
		else {
			if (_itimediff(kcp->current, kcp->ts_probe) >= 0) {
				if (kcp->probe_wait < IKCP_PROBE_INIT) 
					kcp->probe_wait = IKCP_PROBE_INIT;
				kcp->probe_wait += kcp->probe_wait / 2;
				if (kcp->probe_wait > IKCP_PROBE_LIMIT)
					kcp->probe_wait = IKCP_PROBE_LIMIT;
				kcp->ts_probe = kcp->current + kcp->probe_wait;
				kcp->probe |= IKCP_ASK_SEND;
			}
		}
	}	else {
		kcp->ts_probe = 0;
		kcp->probe_wait = 0;
	}

	// flush window probing commands
	if (kcp->probe & IKCP_ASK_SEND) {
		seg.cmd = IKCP_CMD_WASK;
		size = (int)(ptr - buffer);
		if (size + (int)IKCP_OVERHEAD > (int)kcp->mtu) {
			ikcp_output(kcp, buffer, size);
			ptr = buffer;
		}
		ptr = ikcp_encode_seg(ptr, &seg);
	}

	// flush window probing commands
	if (kcp->probe & IKCP_ASK_TELL) {
		seg.cmd = IKCP_CMD_WINS;
		size = (int)(ptr - buffer);
		if (size + (int)IKCP_OVERHEAD > (int)kcp->mtu) {
			ikcp_output(kcp, buffer, size);
			ptr = buffer;
		}
		ptr = ikcp_encode_seg(ptr, &seg);
	}

	kcp->probe = 0;

	// calculate window size
	cwnd = _imin_(kcp->snd_wnd, kcp->rmt_wnd);
	if (kcp->nocwnd == 0) cwnd = _imin_(kcp->cwnd, cwnd);

	// move data from snd_queue to snd_buf
	while (_itimediff(kcp->snd_nxt, kcp->snd_una + cwnd) < 0) {
		IKCPSEG *newseg;
		if (iqueue_is_empty(&kcp->snd_queue)) break;

		newseg = iqueue_entry(kcp->snd_queue.next, IKCPSEG, node);

		iqueue_del(&newseg->node);
		iqueue_add_tail(&newseg->node, &kcp->snd_buf);
		kcp->nsnd_que--;
		kcp->nsnd_buf++;

		newseg->conv = kcp->conv;
		newseg->cmd = IKCP_CMD_PUSH;
		newseg->wnd = seg.wnd;
		newseg->ts = current;
		newseg->sn = kcp->snd_nxt++;
		newseg->una = kcp->rcv_nxt;
		newseg->resendts = current;
		newseg->rto = kcp->rx_rto;
		newseg->fastack = 0;
		newseg->xmit = 0;
	}

	// calculate resent
	resent = (kcp->fastresend > 0)? (IUINT32)kcp->fastresend : 0xffffffff;
	rtomin = (kcp->nodelay == 0)? (kcp->rx_rto >> 3) : 0;

	// flush data segments
	for (p = kcp->snd_buf.next; p != &kcp->snd_buf; p = p->next) {
		IKCPSEG *segment = iqueue_entry(p, IKCPSEG, node);
		int needsend = 0;
		if (segment->xmit == 0) {
			needsend = 1;
			segment->xmit++;
			segment->rto = kcp->rx_rto;
			segment->resendts = current + segment->rto + rtomin;
		}
		else if (_itimediff(current, segment->resendts) >= 0) {
			needsend = 1;
			segment->xmit++;
			kcp->xmit++;
			if (kcp->nodelay == 0) {
				segment->rto += kcp->rx_rto;
			}	else {
				segment->rto += kcp->rx_rto / 2;
			}
			segment->resendts = current + segment->rto;
			lost = 1;
		}
		else if (segment->fastack >= resent) {
			needsend = 1;
			segment->xmit++;
			segment->fastack = 0;
			segment->resendts = current + segment->rto;
			change++;
		}

		if (needsend) {
			int size, need;
			segment->ts = current;
			segment->wnd = seg.wnd;
			segment->una = kcp->rcv_nxt;

			size = (int)(ptr - buffer);
			need = IKCP_OVERHEAD + segment->len;

			if (size + need > (int)kcp->mtu) {
				ikcp_output(kcp, buffer, size);
				ptr = buffer;
			}

			ptr = ikcp_encode_seg(ptr, segment);

			if (segment->len > 0) {
				memcpy(ptr, segment->data, segment->len);
				ptr += segment->len;
			}

			if (segment->xmit >= kcp->dead_link) {
				kcp->state = -1;
			}
		}
	}

	// flash remain segments
	size = (int)(ptr - buffer);
	if (size > 0) {
		ikcp_output(kcp, buffer, size);
	}

	// update ssthresh
	if (change) {
		IUINT32 inflight = kcp->snd_nxt - kcp->snd_una;
		kcp->ssthresh = inflight / 2;
		if (kcp->ssthresh < IKCP_THRESH_MIN)
			kcp->ssthresh = IKCP_THRESH_MIN;
		kcp->cwnd = kcp->ssthresh + resent;
		kcp->incr = kcp->cwnd * kcp->mss;
	}

	if (lost) {
		kcp->ssthresh = cwnd / 2;
		if (kcp->ssthresh < IKCP_THRESH_MIN)
			kcp->ssthresh = IKCP_THRESH_MIN;
		kcp->cwnd = 1;
		kcp->incr = kcp->mss;
	}

	if (kcp->cwnd < 1) {
		kcp->cwnd = 1;
		kcp->incr = kcp->mss;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0xe0(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x70(%rax)
jne 0x571d
jmp 0x5f7b
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x80(%rbp)
movl $0x52, -0x7c(%rbp)
movl $0x0, -0x78(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5f90
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x68(%rbp)
movl $0x0, -0x64(%rbp)
movl $0x0, -0x6c(%rbp)
movl $0x0, -0x70(%rbp)
movq -0x8(%rbp), %rax
movl 0xd0(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x57f1
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl $0x18, %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x57b0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x28(%rbp), %edx
callq 0x5fd0
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
leaq -0x90(%rbp), %rdx
addq $0x24, %rdx
leaq -0x90(%rbp), %rcx
addq $0x20, %rcx
callq 0x60b0
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x6120
movq %rax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5773
movq -0x8(%rbp), %rax
movl $0x0, 0xd0(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x40(%rax)
jne 0x58be
movq -0x8(%rbp), %rax
cmpl $0x0, 0x78(%rax)
jne 0x583c
movq -0x8(%rbp), %rax
movl $0x1b58, 0x78(%rax)     # imm = 0x1B58
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %ecx
movq -0x8(%rbp), %rax
addl 0x78(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x74(%rax)
jmp 0x58bc
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x74(%rax), %esi
callq 0x4ae0
cmpq $0x0, %rax
jl 0x58ba
movq -0x8(%rbp), %rax
cmpl $0x1b58, 0x78(%rax)     # imm = 0x1B58
jae 0x586d
movq -0x8(%rbp), %rax
movl $0x1b58, 0x78(%rax)     # imm = 0x1B58
movq -0x8(%rbp), %rax
movl 0x78(%rax), %ecx
shrl %ecx
movq -0x8(%rbp), %rax
addl 0x78(%rax), %ecx
movl %ecx, 0x78(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1d4c0, 0x78(%rax)    # imm = 0x1D4C0
jbe 0x5898
movq -0x8(%rbp), %rax
movl $0x1d4c0, 0x78(%rax)    # imm = 0x1D4C0
movq -0x8(%rbp), %rax
movl 0x4c(%rax), %ecx
movq -0x8(%rbp), %rax
addl 0x78(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x74(%rax)
movq -0x8(%rbp), %rax
movl 0x48(%rax), %ecx
orl $0x1, %ecx
movl %ecx, 0x48(%rax)
jmp 0x58bc
jmp 0x58d4
movq -0x8(%rbp), %rax
movl $0x0, 0x74(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x78(%rax)
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x5933
movl $0x53, -0x7c(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl $0x18, %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x591f
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x28(%rbp), %edx
callq 0x5fd0
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x6120
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x48(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x5992
movl $0x54, -0x7c(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl $0x18, %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x597e
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x28(%rbp), %edx
callq 0x5fd0
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x6120
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x8(%rbp), %rax
movl 0x38(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x40(%rax), %esi
callq 0x61f0
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0xec(%rax)
jne 0x59d2
movq -0x8(%rbp), %rax
movl 0x44(%rax), %edi
movl -0x34(%rbp), %esi
callq 0x61f0
movl %eax, -0x34(%rbp)
jmp 0x59d4
movq -0x8(%rbp), %rax
movl 0x14(%rax), %edi
movq -0x8(%rbp), %rax
movl 0x10(%rax), %esi
addl -0x34(%rbp), %esi
callq 0x4ae0
cmpq $0x0, %rax
jge 0x5b7d
movq -0x8(%rbp), %rax
addq $0x88, %rax
movq -0x8(%rbp), %rcx
cmpq 0x88(%rcx), %rax
jne 0x5a10
jmp 0x5b7d
movq -0x8(%rbp), %rax
movq 0x88(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x98(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x98(%rbp), %rax
movq (%rax), %rcx
movq -0x98(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
movq $0x0, (%rax)
movq -0x98(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rcx
movq -0x98(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rcx
addq $0xa8, %rcx
movq -0x98(%rbp), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0xb0(%rax), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xb0(%rax)
movq -0x8(%rbp), %rax
movl 0x68(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x68(%rax)
movq -0x8(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x98(%rbp), %rax
movl $0x51, 0x14(%rax)
movl -0x74(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl -0xc(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
movl 0x14(%rax), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, 0x14(%rax)
movq -0x98(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x28(%rax)
movl -0xc(%rbp), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x8(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0x98(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x98(%rbp), %rax
movl $0x0, 0x38(%rax)
movq -0x98(%rbp), %rax
movl $0x0, 0x3c(%rax)
jmp 0x59d4
movq -0x8(%rbp), %rax
cmpl $0x0, 0xe8(%rax)
jle 0x5b9c
movq -0x8(%rbp), %rax
movl 0xe8(%rax), %eax
movl %eax, -0xb4(%rbp)
jmp 0x5ba9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0xb4(%rbp)
jmp 0x5ba9
movl -0xb4(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x6c(%rax)
jne 0x5bce
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
sarl $0x3, %eax
movl %eax, -0xb8(%rbp)
jmp 0x5bd8
xorl %eax, %eax
movl %eax, -0xb8(%rbp)
jmp 0x5bd8
movl -0xb8(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
addq $0xa8, %rcx
cmpq %rcx, %rax
je 0x5e86
movq -0x40(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
movq -0xa0(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jne 0x5c74
movl $0x1, -0xa4(%rbp)
movq -0xa0(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rax)
movq -0x8(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x34(%rax)
movl -0xc(%rbp), %ecx
movq -0xa0(%rbp), %rax
addl 0x34(%rax), %ecx
addl -0x38(%rbp), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x30(%rax)
jmp 0x5d70
movl -0xc(%rbp), %edi
movq -0xa0(%rbp), %rax
movl 0x30(%rax), %esi
callq 0x4ae0
cmpq $0x0, %rax
jl 0x5d15
movl $0x1, -0xa4(%rbp)
movq -0xa0(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rax)
movq -0x8(%rbp), %rax
movl 0x58(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x58(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x6c(%rax)
jne 0x5cd7
movq -0x8(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0xa0(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
jmp 0x5cf5
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0xa0(%rbp), %rax
addl 0x34(%rax), %ecx
movl %ecx, 0x34(%rax)
movl -0xc(%rbp), %ecx
movq -0xa0(%rbp), %rax
addl 0x34(%rax), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x30(%rax)
movl $0x1, -0x48(%rbp)
jmp 0x5d6e
movq -0xa0(%rbp), %rax
movl 0x38(%rax), %eax
cmpl -0x30(%rbp), %eax
jb 0x5d6c
movl $0x1, -0xa4(%rbp)
movq -0xa0(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rax)
movq -0xa0(%rbp), %rax
movl $0x0, 0x38(%rax)
movl -0xc(%rbp), %ecx
movq -0xa0(%rbp), %rax
addl 0x34(%rax), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x5d6e
jmp 0x5d70
cmpl $0x0, -0xa4(%rbp)
je 0x5e74
movl -0xc(%rbp), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x74(%rbp), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movl 0x2c(%rax), %eax
addl $0x18, %eax
movl %eax, -0xac(%rbp)
movl -0xa8(%rbp), %eax
addl -0xac(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x4(%rcx), %eax
jle 0x5dfc
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0xa8(%rbp), %edx
callq 0x5fd0
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x6120
movq %rax, -0x20(%rbp)
movq -0xa0(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jbe 0x5e54
movq -0x20(%rbp), %rdi
movq -0xa0(%rbp), %rsi
addq $0x40, %rsi
movq -0xa0(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, %edx
callq 0x3290
movq -0xa0(%rbp), %rax
movl 0x2c(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0xa0(%rbp), %rax
movl 0x3c(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x7c(%rcx), %eax
jb 0x5e72
movq -0x8(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
jmp 0x5e74
jmp 0x5e76
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x5bf0
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x5eaa
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x28(%rbp), %edx
callq 0x5fd0
cmpl $0x0, -0x44(%rbp)
je 0x5f12
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x8(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %ecx
shrl %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x24(%rax)
jae 0x5ee8
movq -0x8(%rbp), %rax
movl $0x2, 0x24(%rax)
movq -0x8(%rbp), %rax
movl 0x24(%rax), %ecx
addl -0x30(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x8(%rbp), %rax
movl 0x44(%rax), %ecx
movq -0x8(%rbp), %rax
imull 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x80(%rax)
cmpl $0x0, -0x48(%rbp)
je 0x5f55
movl -0x34(%rbp), %ecx
shrl %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x8(%rbp), %rax
cmpl $0x2, 0x24(%rax)
jae 0x5f39
movq -0x8(%rbp), %rax
movl $0x2, 0x24(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x44(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x80(%rax)
movq -0x8(%rbp), %rax
cmpl $0x1, 0x44(%rax)
jae 0x5f7b
movq -0x8(%rbp), %rax
movl $0x1, 0x44(%rax)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x80(%rax)
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)