// File: /workspace/github_cpp_makefile_star2_O3/xocoder[P]m_kcptun/vendor/kcp/ikcp.c
// Function: ikcp_create
ikcpcb* ikcp_create(IUINT32 conv, void *user)
{
	ikcpcb *kcp = (ikcpcb*)ikcp_malloc(sizeof(struct IKCPCB));
	if (kcp == NULL) return NULL;
	kcp->conv = conv;
	kcp->user = user;
	kcp->snd_una = 0;
	kcp->snd_nxt = 0;
	kcp->rcv_nxt = 0;
	kcp->ts_recent = 0;
	kcp->ts_lastack = 0;
	kcp->ts_probe = 0;
	kcp->probe_wait = 0;
	kcp->snd_wnd = IKCP_WND_SND;
	kcp->rcv_wnd = IKCP_WND_RCV;
	kcp->rmt_wnd = IKCP_WND_RCV;
	kcp->cwnd = 0;
	kcp->incr = 0;
	kcp->probe = 0;
	kcp->mtu = IKCP_MTU_DEF;
	kcp->mss = kcp->mtu - IKCP_OVERHEAD;
	kcp->stream = 0;

	kcp->buffer = (char*)ikcp_malloc((kcp->mtu + IKCP_OVERHEAD) * 3);
	if (kcp->buffer == NULL) {
		ikcp_free(kcp);
		return NULL;
	}

	iqueue_init(&kcp->snd_queue);
	iqueue_init(&kcp->rcv_queue);
	iqueue_init(&kcp->snd_buf);
	iqueue_init(&kcp->rcv_buf);
	kcp->nrcv_buf = 0;
	kcp->nsnd_buf = 0;
	kcp->nrcv_que = 0;
	kcp->nsnd_que = 0;
	kcp->state = 0;
	kcp->acklist = NULL;
	kcp->ackblock = 0;
	kcp->ackcount = 0;
	kcp->rx_srtt = 0;
	kcp->rx_rttval = 0;
	kcp->rx_rto = IKCP_RTO_DEF;
	kcp->rx_minrto = IKCP_RTO_MIN;
	kcp->current = 0;
	kcp->interval = IKCP_INTERVAL;
	kcp->ts_flush = IKCP_INTERVAL;
	kcp->nodelay = 0;
	kcp->updated = 0;
	kcp->logmask = 0;
	kcp->ssthresh = IKCP_THRESH_INIT;
	kcp->fastresend = 0;
	kcp->nocwnd = 0;
	kcp->xmit = 0;
	kcp->dead_link = IKCP_DEADLINK;
	kcp->output = NULL;
	kcp->writelog = NULL;

	return kcp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %r15d
movq 0xdb7e(%rip), %rax      # 0x10288
movl $0x108, %edi            # imm = 0x108
testq %rax, %rax
je 0x2718
callq *%rax
jmp 0x271d
callq 0x2360
movq %rax, %rbx
xorl %eax, %eax
testq %rbx, %rbx
je 0x286a
movl %r15d, (%rbx)
movq %r14, 0xd8(%rbx)
movq $0x0, 0x74(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movl %eax, 0x20(%rbx)
movaps 0x88c2(%rip), %xmm0     # 0xb010
movups %xmm0, 0x38(%rbx)
movl %eax, 0x80(%rbx)
movl %eax, 0x48(%rbx)
movabsq $0x56000000578, %rcx    # imm = 0x56000000578
movq %rcx, 0x4(%rbx)
movl %eax, 0xf0(%rbx)
movq 0xdb12(%rip), %rax      # 0x10288
movl $0x10b0, %edi           # imm = 0x10B0
testq %rax, %rax
je 0x2784
callq *%rax
jmp 0x2789
callq 0x2360
movq %rax, 0xe0(%rbx)
testq %rax, %rax
je 0x2852
leaq 0x88(%rbx), %rax
movq %rax, 0x88(%rbx)
movq %rax, 0x90(%rbx)
leaq 0x98(%rbx), %rax
movq %rax, 0x98(%rbx)
movq %rax, 0xa0(%rbx)
leaq 0xa8(%rbx), %rax
movq %rax, 0xa8(%rbx)
movq %rax, 0xb0(%rbx)
leaq 0xb8(%rbx), %rax
movq %rax, 0xb8(%rbx)
movq %rax, 0xc0(%rbx)
xorl %eax, %eax
movl %eax, 0xc(%rbx)
movq %rax, 0x28(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x5c(%rbx)
movups %xmm0, 0xc8(%rbx)
movabsq $0x64000000c8, %rcx     # imm = 0x64000000C8
movq %rcx, 0x30(%rbx)
movabsq $0x6400000000, %rcx     # imm = 0x6400000000
movq %rcx, 0x4c(%rbx)
movl $0x64, 0x54(%rbx)
movq %rax, 0x6c(%rbx)
movl %eax, 0xf4(%rbx)
movl $0x2, 0x24(%rbx)
movq %rax, 0xe8(%rbx)
movl %eax, 0x58(%rbx)
movl $0x14, 0x7c(%rbx)
movups %xmm0, 0xf8(%rbx)
jmp 0x286c
movq 0xda37(%rip), %rax      # 0x10290
movq %rbx, %rdi
testq %rax, %rax
je 0x2865
callq *%rax
jmp 0x286a
callq 0x2320
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq