// File: /workspace/github_cpp_makefile_star2_O3/xocoder[P]m_kcptun/vendor/kcp/ikcp.c
// Function: ikcp_release
void ikcp_release(ikcpcb *kcp)
{
	assert(kcp);
	if (kcp) {
		IKCPSEG *seg;
		while (!iqueue_is_empty(&kcp->snd_buf)) {
			seg = iqueue_entry(kcp->snd_buf.next, IKCPSEG, node);
			iqueue_del(&seg->node);
			ikcp_segment_delete(kcp, seg);
		}
		while (!iqueue_is_empty(&kcp->rcv_buf)) {
			seg = iqueue_entry(kcp->rcv_buf.next, IKCPSEG, node);
			iqueue_del(&seg->node);
			ikcp_segment_delete(kcp, seg);
		}
		while (!iqueue_is_empty(&kcp->snd_queue)) {
			seg = iqueue_entry(kcp->snd_queue.next, IKCPSEG, node);
			iqueue_del(&seg->node);
			ikcp_segment_delete(kcp, seg);
		}
		while (!iqueue_is_empty(&kcp->rcv_queue)) {
			seg = iqueue_entry(kcp->rcv_queue.next, IKCPSEG, node);
			iqueue_del(&seg->node);
			ikcp_segment_delete(kcp, seg);
		}
		if (kcp->buffer) {
			ikcp_free(kcp->buffer);
		}
		if (kcp->acklist) {
			ikcp_free(kcp->acklist);
		}

		kcp->nrcv_buf = 0;
		kcp->nsnd_buf = 0;
		kcp->nrcv_que = 0;
		kcp->nsnd_que = 0;
		kcp->ackcount = 0;
		kcp->buffer = NULL;
		kcp->acklist = NULL;
		ikcp_free(kcp);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2a61
movq %rdi, %rbx
leaq 0xa8(%rdi), %r14
movq 0xa8(%rdi), %rdi
movq 0xd9eb(%rip), %rax      # 0x10290
cmpq %rdi, %r14
je 0x28e5
movq %rax, %r15
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq %rcx, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
testq %rax, %rax
je 0x28d4
callq *%rax
movq 0xd9c1(%rip), %rax      # 0x10290
movq %rax, %r15
jmp 0x28db
callq 0x2320
xorl %eax, %eax
movq (%r14), %rdi
cmpq %rdi, %r14
jne 0x28ad
jmp 0x28e8
movq %rax, %r15
leaq 0xb8(%rbx), %r14
movq 0xb8(%rbx), %rdi
cmpq %rdi, %r14
je 0x2934
movq %r15, %rax
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq %rcx, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
testq %rax, %rax
je 0x2925
callq *%rax
movq 0xd970(%rip), %rax      # 0x10290
movq %rax, %r15
jmp 0x292c
callq 0x2320
xorl %eax, %eax
movq (%r14), %rdi
cmpq %rdi, %r14
jne 0x28fe
leaq 0x88(%rbx), %r14
movq 0x88(%rbx), %rdi
cmpq %rdi, %r14
je 0x2980
movq %r15, %rax
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq %rcx, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
testq %rax, %rax
je 0x2971
callq *%rax
movq 0xd924(%rip), %rax      # 0x10290
movq %rax, %r15
jmp 0x2978
callq 0x2320
xorl %eax, %eax
movq (%r14), %rdi
cmpq %rdi, %r14
jne 0x294a
leaq 0x98(%rbx), %r14
movq 0x98(%rbx), %rdi
cmpq %rdi, %r14
je 0x29cc
movq %r15, %rax
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, 0x8(%rcx)
movq %rcx, (%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
testq %rax, %rax
je 0x29bd
callq *%rax
movq 0xd8d8(%rip), %rax      # 0x10290
movq %rax, %r15
jmp 0x29c4
callq 0x2320
xorl %eax, %eax
movq (%r14), %rdi
cmpq %rdi, %r14
jne 0x2996
movq 0xe0(%rbx), %rdi
testq %rdi, %rdi
je 0x29e7
testq %r15, %r15
je 0x2a09
callq *%r15
movq 0xd8a9(%rip), %r15      # 0x10290
movq 0xc8(%rbx), %rdi
testq %rdi, %rdi
je 0x2a04
testq %r15, %r15
je 0x2a1a
callq *%r15
movq 0xd88e(%rip), %rcx      # 0x10290
jmp 0x2a21
movq %r15, %rcx
jmp 0x2a21
callq 0x2320
movq 0xc8(%rbx), %rdi
testq %rdi, %rdi
je 0x2a1f
callq 0x2320
xorl %ecx, %ecx
movl $0x0, 0xd0(%rbx)
xorl %eax, %eax
movq %rax, 0xe0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x5c(%rbx)
movq %rax, 0xc8(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
testq %rcx, %rcx
je 0x2a56
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rcx
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2320
leaq 0x85d8(%rip), %rdi      # 0xb040
leaq 0x85d5(%rip), %rsi      # 0xb044
leaq 0x85e0(%rip), %rcx      # 0xb056
movl $0x12d, %edx            # imm = 0x12D
callq 0x21b0