LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: chann_destroy(s_mnet*, s_mchann*)
static void
_chann_destroy(mnet_t *ss, chann_t *n) {
   if (n->state >= CHANN_STATE_CLOSED) {
      if (n->next) { n->next->prev = n->prev; }
      if (n->prev) { n->prev->next = n->next; }
      else { ss->channs = n->next; }
      _rwb_destroy(&n->rwb_send);
      ss->chann_count--;
      mm_log(n, MNET_LOG_VERBOSE, "chann destroy, count %d\n", ss->chann_count);
      n->state = (chann_state_t)-1;
      mm_free(n);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpl $0x0, 0x10(%rdi)
js 0x420a
movq %rdi, %rbx
movq 0x58(%rdi), %rax
testq %rax, %rax
je 0x4196
movq 0x50(%rbx), %rcx
movq %rcx, 0x50(%rax)
movq 0x50(%rbx), %rcx
leaq 0x58(%rcx), %rdx
testq %rcx, %rcx
leaq 0xc0f8(%rip), %rcx      # 0x102a0
cmovneq %rdx, %rcx
movq %rax, (%rcx)
cmpl $0x0, 0x48(%rbx)
jle 0x41d2
leaq 0x38(%rbx), %r14
movq 0x38(%rbx), %rax
movq $0x0, (%rax)
movq %r14, %rdi
callq 0x55be
cmpl $0x0, 0x48(%rbx)
jg 0x41b9
movl 0xc0c4(%rip), %ecx      # 0x1029c
decl %ecx
movl %ecx, 0xc0bc(%rip)      # 0x1029c
leaq 0x71ec(%rip), %rdx      # 0xb3d3
movq %rbx, %rdi
movl $0x3, %esi
xorl %eax, %eax
callq 0x420f
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmpq *0xc04e(%rip)           # 0x10258
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mm_log(s_mchann*, int, char const*, ...)
static inline void mm_log(chann_t *n, int level, const char *fmt, ...) {
   if (level <= _log_level) {
      char buf[192];
      va_list argptr;
      va_start(argptr, fmt);
      vsprintf(buf, fmt, argptr);
      va_end(argptr);
      mnet_log(n, level, buf);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
testb %al, %al
je 0x424c
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
movq %rcx, -0xc8(%rbp)
movq %r8, -0xc0(%rbp)
movq %r9, -0xb8(%rbp)
cmpl %esi, 0xbff9(%rip)      # 0x10260
jl 0x42b5
movl %esi, %ebx
movq %rdi, %r14
leaq -0xe0(%rbp), %rcx
leaq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movabsq $0x3000000018, %rcx     # imm = 0x3000000018
movq %rcx, (%rax)
leaq -0x1a0(%rbp), %r15
movq %r15, %rdi
movq %rdx, %rsi
movq %rax, %rdx
callq 0x2130
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq *0xbfb3(%rip)           # 0x10268
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_setlog
void
mnet_setlog(int level, mnet_log_cb cb) {
   if (level >= 0) {
      _log_level = level;
   }
   if (cb) {
      mnet_log = cb;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %edi, %edi
js 0x42fb
movl %edi, 0xbf65(%rip)      # 0x10260
testq %rsi, %rsi
je 0x4307
movq %rsi, 0xbf61(%rip)      # 0x10268
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_report
int
mnet_report(int level) {
   mnet_t *ss = _gmnet();
   if (ss->init) {
      if (level > 0) {
         mm_log(NULL, 0, "-------- channs(%d) --------\n", ss->chann_count);
         chann_t *n = ss->channs;
         while (n) {
            mm_log(NULL, 0, "chann:%p fd:%d state:%d %s:%d\n", n, n->fd, n->state, _chann_addr(n), _chann_port(n));
            n = n->next;
         }
         mm_log(NULL, 0, "------------------------\n");
      }
      return ss->chann_count;
   }
   return -1;
}

// Assembly:
cmpl $0x0, 0xbf88(%rip)      # 0x10298
je 0x43bb
testl %edi, %edi
jle 0x43b4
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0xbf6d(%rip), %ecx      # 0x1029c
leaq 0x6ecd(%rip), %rdx      # 0xb203
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x420f
movq 0xbf58(%rip), %rbx      # 0x102a0
testq %rbx, %rbx
je 0x439a
leaq 0x6ecd(%rip), %r14      # 0xb221
movl (%rbx), %r15d
movl 0x10(%rbx), %r12d
movl 0x24(%rbx), %edi
callq 0x2120
movq %rax, %r10
movzwl 0x22(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %r11d
xorl %edi, %edi
xorl %esi, %esi
movq %r14, %rdx
movq %rbx, %rcx
movl %r15d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x420f
addq $0x10, %rsp
movq 0x58(%rbx), %rbx
testq %rbx, %rbx
jne 0x4354
leaq 0x6e9f(%rip), %rdx      # 0xb240
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x420f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
movl 0xbee2(%rip), %eax      # 0x1029c
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_resolve
int
mnet_resolve(char *host, int port, chann_type_t ctype, chann_addr_t *addr) {
   int ret = 0;
   if (host && addr) {
      struct sockaddr_in *valid_in = NULL;
      struct addrinfo hints, *ai=NULL, *curr=NULL;
      char buf[32] = {0};

      memset(&hints, 0, sizeof(hints));
      hints.ai_family = AF_INET;
      hints.ai_socktype = (ctype == CHANN_TYPE_DGRAM) ? SOCK_DGRAM : SOCK_STREAM;
      if (port > 0) { sprintf(buf, "%d", port); }
      if ( getaddrinfo(host, (port>0 ? buf : NULL), &hints, &ai) ) {
         mm_log(NULL, 0, "fail to resolve host !\n");
         goto fail;
      }

      for ( curr=ai; curr!=NULL; curr=curr->ai_next) {
         char ipstr[16] = {0};
         inet_ntop(AF_INET, &(((struct sockaddr_in *)(curr->ai_addr))->sin_addr), ipstr, 16);
         if (strlen(ipstr) > 7) { // '0.0.0.0'
            valid_in = (struct sockaddr_in*)curr->ai_addr;
            break;
         }
      }

      if (valid_in) {
         if (0 == getnameinfo((struct sockaddr*)valid_in, sizeof(*valid_in),
                              (char*)addr->ip, 16,NULL, 0, NI_NUMERICHOST))
         {
            ret = 1;
            addr->port = port;
         }
      }

     fail:
      freeaddrinfo(ai);
   }
   return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rcx, %rbx
testq %rdi, %rdi
sete %al
testq %rcx, %rcx
sete %cl
xorl %r15d, %r15d
orb %al, %cl
jne 0x4487
movl %esi, %r14d
movq %rdi, %r12
movq $0x0, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x60(%rbp)
movl $0x2, -0x7c(%rbp)
xorl %eax, %eax
cmpl $0x2, %edx
sete %al
incl %eax
movl %eax, -0x78(%rbp)
testl %esi, %esi
jle 0x444f
leaq 0x6e21(%rip), %rsi      # 0xb25a
leaq -0xa0(%rbp), %r15
movq %r15, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x2090
jmp 0x4452
xorl %r15d, %r15d
leaq -0x80(%rbp), %rdx
leaq -0x30(%rbp), %rcx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2320
testl %eax, %eax
je 0x449c
leaq 0x6ded(%rip), %rdx      # 0xb25d
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x420f
movq -0x30(%rbp), %rdi
callq 0x2340
movl %r15d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, -0x34(%rbp)
movq -0x30(%rbp), %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
testq %r14, %r14
je 0x44f5
leaq -0x50(%rbp), %r13
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq 0x18(%r14), %rsi
addq $0x4, %rsi
movl $0x2, %edi
movq %r13, %rdx
movl $0x10, %ecx
callq 0x22c0
movq %r13, %rdi
callq 0x2110
cmpq $0x8, %rax
jb 0x44e6
movq 0x18(%r14), %r12
cmpq $0x8, %rax
jae 0x44f5
movq 0x28(%r14), %r14
testq %r14, %r14
jne 0x44b3
testq %r12, %r12
je 0x447e
movl $0x1, (%rsp)
xorl %r15d, %r15d
movq %r12, %rdi
movl $0x10, %esi
movq %rbx, %rdx
movl $0x10, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x21a0
testl %eax, %eax
jne 0x447e
movl -0x34(%rbp), %eax
movl %eax, 0x10(%rbx)
movl $0x1, %r15d
jmp 0x447e
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_parse_ipport
int
mnet_parse_ipport(const char *ipport, chann_addr_t *addr) {
   if (ipport && addr) {
      const char *p = strchr(ipport, ':');
      if (p >= ipport) {
         if ((p - ipport) >= 7) {
            addr->ip[p - ipport] = 0;
            strncpy(addr->ip, ipport, p - ipport);
         } else {
            strncpy(addr->ip, "0.0.0.0", 8);
         }
         addr->port = atoi(p+1);
         return 1;
      }
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x45a9
movq %rsi, %r14
movq %rdi, %rbx
movl $0x3a, %esi
callq 0x2100
movq %rax, %rdx
subq %rbx, %rdx
jb 0x45a9
movq %rax, %r15
cmpq $0x7, %rdx
jl 0x4585
movb $0x0, (%r14,%rdx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2170
jmp 0x4592
movabsq $0x302e302e302e30, %rax # imm = 0x302E302E302E30
movq %rax, (%r14)
leaq 0x1(%r15), %rdi
callq 0x23b0
movl %eax, 0x10(%r14)
movl $0x1, %eax
cmpq %rbx, %r15
jae 0x45ab
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: chann_create(s_mnet*, chann_type_t, chann_state_t)
static chann_t*
_chann_create(mnet_t *ss, chann_type_t type, chann_state_t state) {
   chann_t *n = (chann_t*)mm_malloc(sizeof(*n));
   n->state = state;
   n->type = type;
   n->next = ss->channs;
   if (ss->channs) {
      ss->channs->prev = n;
   }
   ss->channs = n;
   ss->chann_count++;
   mm_log(n, MNET_LOG_VERBOSE, "chann create, type:%d, count %d\n", type, ss->chann_count);
   return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r15d
movl %edi, %r14d
movl $0x90, %edi
callq *0xbc6b(%rip)           # 0x10248
movq %rax, %rbx
movl $0x90, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x2180
movl %r15d, 0x10(%rbx)
movl %r14d, 0x14(%rbx)
movq 0xbca2(%rip), %rax      # 0x102a0
movq %rax, 0x58(%rbx)
testq %rax, %rax
je 0x460b
movq %rbx, 0x50(%rax)
movq %rbx, 0xbc8e(%rip)      # 0x102a0
movl 0xbc83(%rip), %r8d      # 0x1029c
incl %r8d
movl %r8d, 0xbc79(%rip)      # 0x1029c
leaq 0x6de0(%rip), %rdx      # 0xb40a
movq %rbx, %rdi
movl $0x3, %esi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x420f
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_connect
int
mnet_chann_connect(chann_t *n, const char *host, int port) {
   if (n && host && port>0) {
      int fd = _chann_open_socket(n, host, port, 0);
      if (fd > 0) {
         n->fd = fd;
         if (n->type == CHANN_TYPE_STREAM) {
            int r = connect(fd, (struct sockaddr*)&n->addr, n->addr_len);
            if (r >= 0 || errno==EINPROGRESS || errno==EWOULDBLOCK) {
               n->state = CHANN_STATE_CONNECTING;
               _evt_add(n, MNET_SET_WRITE);
               mm_log(n, MNET_LOG_VERBOSE, "chann fd:%d type:%d connecting...\n", fd, n->type);
               return 1;
            }
         } else {
            n->state = CHANN_STATE_CONNECTED;
            _evt_add(n, MNET_SET_READ);
            mm_log(n, MNET_LOG_VERBOSE, "chann fd:%d type:%d connected\n", fd, n->type);
            return 1;
         }
      }
      mm_log(n, MNET_LOG_ERR, "chann %p fail to connect %d:%s\n", n, errno, strerror(errno));
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testl %edx, %edx
setle %al
xorl %r14d, %r14d
orb %cl, %al
jne 0x478b
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %ecx, %ecx
callq 0x4799
testl %eax, %eax
jle 0x475c
movl %eax, %r15d
movl %eax, (%rbx)
cmpl $0x1, 0x14(%rbx)
jne 0x4715
leaq 0x20(%rbx), %rsi
movl 0x30(%rbx), %edx
movl %r15d, %edi
callq 0x2230
testl %eax, %eax
js 0x474b
movl $0x2, 0x10(%rbx)
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x49c0
movl 0x14(%rbx), %r8d
leaq 0x6b74(%rip), %rdx      # 0xb275
movq %rbx, %rdi
movl $0x3, %esi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x420f
jmp 0x478b
movl $0x3, 0x10(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x49c0
movl 0x14(%rbx), %r8d
leaq 0x6b67(%rip), %rdx      # 0xb298
movq %rbx, %rdi
movl $0x3, %esi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x420f
movl $0x1, %r14d
jmp 0x478b
callq 0x2050
movl (%rax), %eax
cmpl $0x73, %eax
je 0x46dc
cmpl $0xb, %eax
je 0x46dc
callq 0x2050
movl (%rax), %r15d
movl %r15d, %edi
callq 0x20f0
leaq 0x6b44(%rip), %rdx      # 0xb2b7
movq %rbx, %rdi
movl $0x1, %esi
movq %rbx, %rcx
movl %r15d, %r8d
movq %rax, %r9
xorl %eax, %eax
callq 0x420f
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: evt_add(s_mchann*, int)
static int
_evt_add(chann_t *n, int set) {
   mnet_t *ss = _gmnet();
   struct s_event *chg = &ss->chg;
   if ( _evt_check_expand(chg) ) {
      mevent_t *kev = chg->array;
      memset(kev, 0, sizeof(mevent_t));
#if (MNET_OS_MACOX || MNET_OS_FreeBSD)
      kev->ident = n->fd;
      if (set == MNET_SET_READ) {
         kev->filter = EVFILT_READ;
      } else if (set == MNET_SET_WRITE) {
         kev->filter = EVFILT_WRITE;
      }
      kev->flags = EV_ADD | EV_EOF;
      kev->udata = (void*)n;
      if (kevent(ss->kq, chg->array, 1, NULL, 0, NULL) < 0) {
         mm_log(n, MNET_LOG_ERR, "kq fail to add fd:%d filter %x, errno %d:%s\n",
                n->fd, kev->filter, errno, strerror(errno));
         return 0;
      }
#else
      uint32_t events = 0;
      kev->data.ptr = (void*)n;
      if (set == MNET_SET_READ) {
         events = n->epoll_events | EPOLLIN | EPOLLRDHUP | EPOLLHUP;
      } else if (set == MNET_SET_WRITE) {
         events = n->epoll_events | EPOLLOUT | EPOLLRDHUP | EPOLLHUP;
      }
      kev->events = events;
      if (epoll_ctl(ss->kq, (n->epoll_events ? EPOLL_CTL_MOD : EPOLL_CTL_ADD), n->fd, kev) < 0) {
         mm_log(n, MNET_LOG_ERR, "epoll fail to add fd:%d filter %x, errno %d:%s\n",
                n->fd, n->epoll_events, errno, strerror(errno));
         return 0;
      }
      n->epoll_events = events;
#endif
      mm_log(n, MNET_LOG_VERBOSE, "add chann:%p fd:%d events\n", n, n->fd);
      return 1;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %rbx
callq 0x568b
testl %eax, %eax
je 0x4aa5
movq 0xb8cf(%rip), %rcx      # 0x102b8
movl $0x0, 0x8(%rcx)
movq $0x0, (%rcx)
movq %rbx, 0x4(%rcx)
xorl %eax, %eax
testl %r14d, %r14d
setne %al
movl 0x88(%rbx), %edx
leal (%rax,%rax,2), %r14d
addl $0x2011, %r14d          # imm = 0x2011
orl %edx, %r14d
movl %r14d, (%rcx)
movl 0xb888(%rip), %edi      # 0x102a8
xorl %eax, %eax
testl %edx, %edx
setne %al
leal 0x1(,%rax,2), %esi
movl (%rbx), %edx
callq 0x2360
testl %eax, %eax
js 0x4a68
movl %r14d, 0x88(%rbx)
movl (%rbx), %r8d
leaq 0x6a41(%rip), %rdx      # 0xb48b
movq %rbx, %rdi
movl $0x3, %esi
movq %rbx, %rcx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x420f
movl (%rbx), %r14d
movl 0x88(%rbx), %r15d
callq 0x2050
movl (%rax), %r12d
movl %r12d, %edi
callq 0x20f0
movq %rax, (%rsp)
leaq 0x69ce(%rip), %rdx      # 0xb45b
movq %rbx, %rdi
movl $0x1, %esi
movl %r14d, %ecx
movl %r15d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x420f
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_listen
int
mnet_chann_listen(chann_t *n, const char *host, int port, int backlog) {
   if (n && port>0) {
      int fd = _chann_open_socket(n, host, port, backlog | 1);
      if (fd > 0) {
         n->fd = fd;
         n->state = CHANN_STATE_LISTENING;
         _evt_add(n, MNET_SET_READ);
         mm_log(n, MNET_LOG_VERBOSE, "chann %p, fd:%d listen\n", n, fd);
         return 1;
      }
      mm_log(n, MNET_LOG_ERR, "chann %p fail to listen\n", n);
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
sete %al
testl %edx, %edx
setle %dil
orb %al, %dil
jne 0x4b45
orl $0x1, %ecx
movq %rbx, %rdi
callq 0x4799
movl %eax, %r14d
testl %eax, %eax
jle 0x4b22
movl %r14d, (%rbx)
movl $0x4, 0x10(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x49c0
leaq 0x67cc(%rip), %rdx      # 0xb2d7
movq %rbx, %rdi
movl $0x3, %esi
movq %rbx, %rcx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x420f
jmp 0x4b3b
leaq 0x67c6(%rip), %rdx      # 0xb2ef
movq %rbx, %rdi
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x420f
movl $0x1, %eax
testl %r14d, %r14d
jg 0x4b47
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_active_event
void
mnet_chann_active_event(chann_t *n, chann_event_t et, int active) {
   if ( n ) {
      if (et == CHANN_EVENT_SEND) {
         n->active_send_event = active;
         if (active) {
            _evt_add(n, MNET_SET_WRITE);
         } else {
            _evt_del(n, MNET_SET_WRITE);
         }
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
sete %al
cmpl $0x2, %esi
setne %cl
orb %al, %cl
jne 0x4b85
movl %edx, 0x70(%rdi)
testl %edx, %edx
je 0x4b87
movl $0x1, %esi
popq %rbp
jmp 0x49c0
popq %rbp
retq
popq %rbp
jmp 0x4b8a
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: evt_del(s_mchann*, int)
static int
_evt_del(chann_t *n, int set) {
   mnet_t *ss = _gmnet();
   struct s_event *chg = &ss->chg;
   if ( _evt_check_expand(chg) ) {
      mevent_t *kev = chg->array;
      memset(kev, 0, sizeof(mevent_t));
#if (MNET_OS_MACOX || MNET_OS_FreeBSD)
      kev->ident = n->fd;
      if (set == MNET_SET_READ) {
         kev->filter = EVFILT_READ;
      } else if (set == MNET_SET_WRITE) {
         kev->filter = EVFILT_WRITE;         
      }
      kev->flags = EV_DELETE;
      kev->udata = (void*)n;
      if (kevent(ss->kq, chg->array, 1, NULL, 0, NULL) < 0) {
         mm_log(n, MNET_LOG_ERR, "kq fail to delete fd:%d filter %x, errno %d:%s\n",
                n->fd, kev->filter, errno, strerror(errno));
         return 0;
      }
#else
      uint32_t events = 0;
      kev->data.ptr = (void*)n;
      if (set == MNET_SET_READ) {
         events = n->epoll_events & ~EPOLLIN;
      } else if (set == MNET_SET_WRITE) {
         events = n->epoll_events & ~EPOLLOUT;
      }
      kev->events = events;
      if (epoll_ctl(ss->kq, events ? EPOLL_CTL_MOD : EPOLL_CTL_DEL, n->fd, kev) < 0) {
         mm_log(n, MNET_LOG_ERR, "epoll fail to add fd:%d filter %x, errno %d, %s\n",
                n->fd, n->epoll_events, errno, strerror(errno));
         return 0;
      }
      n->epoll_events = events;
#endif
      mm_log(n, MNET_LOG_VERBOSE, "del chann:%p fd:%d events\n", n, n->fd);
      return 1;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x568b
testl %eax, %eax
je 0x4c56
movq 0xb708(%rip), %rcx      # 0x102b8
movl $0x0, 0x8(%rcx)
movq $0x0, (%rcx)
movq %rbx, 0x4(%rcx)
movl 0x88(%rbx), %r14d
xorl %esi, %esi
andl $-0x5, %r14d
movl %r14d, (%rcx)
movl 0xb6d0(%rip), %edi      # 0x102a8
sete %sil
xorl $0x3, %esi
movl (%rbx), %edx
callq 0x2360
testl %eax, %eax
js 0x4c19
movl %r14d, 0x88(%rbx)
movl (%rbx), %r8d
leaq 0x68f1(%rip), %rdx      # 0xb4ec
movq %rbx, %rdi
movl $0x3, %esi
movq %rbx, %rcx
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x420f
movl (%rbx), %r14d
movl 0x88(%rbx), %r15d
callq 0x2050
movl (%rax), %r12d
movl %r12d, %edi
callq 0x20f0
movq %rax, (%rsp)
leaq 0x687d(%rip), %rdx      # 0xb4bb
movq %rbx, %rdi
movl $0x1, %esi
movl %r14d, %ecx
movl %r15d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x420f
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_recv
int
mnet_chann_recv(chann_t *n, void *buf, int len) {
   if (n && buf && len>0 && n->state>=CHANN_STATE_CONNECTED) {
      int ret = 0;
      if (n->type == CHANN_TYPE_STREAM) {
         ret = (int)recv(n->fd, buf, len, 0);
      } else {
         n->addr_len = sizeof(n->addr);
         ret = (int)recvfrom(n->fd, buf, len, 0, (struct sockaddr*)&(n->addr), &(n->addr_len));
      }
      if (ret < 0) {
         if (errno == EWOULDBLOCK) {
            ret = 0;
         } else {
            mnet_t *ss = _gmnet();
            mm_log(n, MNET_LOG_ERR, "chann %p fd:%d, recv errno %d:%s\n",
                   n, n->fd, errno, strerror(errno));
            _chann_disconnect_socket(ss, n);
            _chann_msg(n, CHANN_EVENT_DISCONNECT, NULL, errno);
         }
      }
      n->bytes_recv += ret;
      return ret;
   }
   return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testl %edx, %edx
setle %dil
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
orb %cl, %dil
jne 0x4d3a
cmpl $0x3, 0x10(%rbx)
jl 0x4d3a
cmpl $0x1, 0x14(%rbx)
jne 0x4cb3
movl (%rbx), %edi
movl %edx, %edx
xorl %ecx, %ecx
callq 0x20e0
jmp 0x4ccd
leaq 0x30(%rbx), %r9
movl $0x10, 0x30(%rbx)
movl (%rbx), %edi
movl %edx, %edx
leaq 0x20(%rbx), %r8
xorl %ecx, %ecx
callq 0x2200
movq %rax, %r14
testl %r14d, %r14d
jns 0x4d30
callq 0x2050
movq %rax, %r15
movl (%rax), %r12d
xorl %eax, %eax
cmpl $0xb, %r12d
je 0x4d33
movl (%rbx), %r13d
movl %r12d, %edi
callq 0x20f0
movq %rax, (%rsp)
leaq 0x660a(%rip), %rdx      # 0xb308
movq %rbx, %rdi
movl $0x1, %esi
movq %rbx, %rcx
movl %r13d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
callq 0x420f
movq %rbx, %rdi
callq 0x40b7
movl (%r15), %ecx
movq %rbx, %rdi
movl $0x5, %esi
xorl %edx, %edx
callq 0x4d49
movl %r14d, %eax
movslq %eax, %rcx
addq %rcx, 0x68(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: chann_msg(s_mchann*, chann_event_t, s_mchann*, int)
static void
_chann_msg(chann_t *n, chann_event_t event, chann_t *r, int err) {
   chann_msg_t e;
   e.event = event;
   e.err = err;
   e.n = n;
   e.r = r;
   e.opaque = n->opaque;
   if ( n->cb ) {
      n->cb( &e );
   } else {
      mm_log(n, MNET_LOG_ERR, "chann fd:%d no callback\n", n->fd);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %esi, -0x20(%rbp)
movl %ecx, -0x1c(%rbp)
movq %rdi, -0x18(%rbp)
movq %rdx, -0x10(%rbp)
movq 0x8(%rdi), %rax
movq %rax, -0x8(%rbp)
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x4d7c
leaq -0x20(%rbp), %rdi
callq *%rax
addq $0x20, %rsp
popq %rbp
retq
movl (%rdi), %ecx
leaq 0x6782(%rip), %rdx      # 0xb507
movl $0x1, %esi
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
jmp 0x420f
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: rwb_cache(s_rwbuf_head*, unsigned char*, int)
static void
_rwb_cache(rwb_head_t *h, unsigned char *buf, int buf_len) {
   int buf_ptr = 0;
   while (buf_ptr < buf_len) {
      rwb_t *b = _rwb_create_tail(h);
      int len = _min_of((buf_len - buf_ptr), _rwb_available(b));
      memcpy(&b->buf[b->ptw], &buf[buf_ptr], len);
      b->ptw += len;
      buf_ptr += len;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, -0x30(%rbp)
testl %edx, %edx
jle 0x4ff7
movl %edx, %ebx
movq %rdi, %r15
xorl %r13d, %r13d
cmpl $0x0, 0x10(%r15)
jle 0x4f77
movq 0x8(%r15), %rax
testq %rax, %rax
je 0x4f42
cmpl $0x10000, 0x4(%rax)     # imm = 0x10000
jl 0x4fa9
movl $0x10018, %edi          # imm = 0x10018
callq *0xb2fb(%rip)           # 0x10248
movq %rax, %r12
movl $0x10018, %edx          # imm = 0x10018
movq %rax, %rdi
xorl %esi, %esi
callq 0x2180
leaq 0x18(%r12), %rax
movq %rax, 0x10(%r12)
movq 0x8(%r15), %rax
movq %r12, 0x8(%rax)
movq %r12, 0x8(%r15)
jmp 0x4fa5
movl $0x10018, %edi          # imm = 0x10018
callq *0xb2c6(%rip)           # 0x10248
movq %rax, %r12
movl $0x10018, %edx          # imm = 0x10018
movq %rax, %rdi
xorl %esi, %esi
callq 0x2180
leaq 0x18(%r12), %rax
movq %rax, 0x10(%r12)
movq %r12, 0x8(%r15)
movq %r12, (%r15)
incl 0x10(%r15)
movq 0x8(%r15), %r14
testq %r14, %r14
je 0x4fbd
movl $0x10000, %eax          # imm = 0x10000
subl 0x4(%r14), %eax
jmp 0x4fbf
xorl %eax, %eax
movl %ebx, %ecx
subl %r13d, %ecx
cmpl %eax, %ecx
cmovgel %eax, %ecx
movslq 0x4(%r14), %rdi
addq 0x10(%r14), %rdi
movslq %r13d, %r13
movq -0x30(%rbp), %rax
leaq (%rax,%r13), %rsi
movslq %ecx, %r12
movq %r12, %rdx
callq 0x2220
addl %r12d, 0x4(%r14)
addl %r12d, %r13d
cmpl %ebx, %r13d
jl 0x4f29
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: chann_send(s_mchann*, void*, int)
static int
_chann_send(chann_t *n, void *buf, int len) {
   int ret = 0;
   if (n->type == CHANN_TYPE_STREAM) {
      ret = (int)send(n->fd, buf, len, 0);
   } else {
      ret = (int)sendto(n->fd, buf, len, 0, (struct sockaddr*)&n->addr, n->addr_len);
   }
   if (ret > 0) {
      n->bytes_send += ret;
   }
   return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %edi
cmpl $0x1, 0x14(%rbx)
movslq %edx, %rdx
jne 0x5023
xorl %ecx, %ecx
callq 0x2160
jmp 0x5032
leaq 0x20(%rbx), %r8
movl 0x30(%rbx), %r9d
xorl %ecx, %ecx
callq 0x2070
testl %eax, %eax
jle 0x5042
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, 0x60(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_set_bufsize
int
mnet_chann_set_bufsize(chann_t *n, int bufsize) {
   if (n && bufsize>0) {
      n->buf_size = bufsize;
      if (n->fd > 0) {
         return _set_bufsize(n->fd, bufsize);
      }
      return 1;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
sete %cl
testl %esi, %esi
setle %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x506f
movl %esi, 0x74(%rdi)
movl (%rdi), %edi
testl %edi, %edi
jle 0x506a
popq %rbp
jmp 0x5071
movl $0x1, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_cached
int
mnet_chann_cached(chann_t *n) {
   if (n) {
      rwb_head_t *prh = &n->rwb_send;
      int count = _rwb_count(prh);
      if (count > 0) {
         return _rwb_buffered(prh->head) + (count - 1) * MNET_BUF_SIZE;
      }
   } 
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x50fb
movl 0x48(%rdi), %ecx
testl %ecx, %ecx
jle 0x50e7
movq 0x38(%rdi), %rdx
testq %rdx, %rdx
je 0x50e9
movl 0x4(%rdx), %eax
subl (%rdx), %eax
jmp 0x50eb
jmp 0x50f7
xorl %eax, %eax
movl %ecx, %edx
shll $0x10, %edx
addl %edx, %eax
addl $0xffff0000, %eax       # imm = 0xFFFF0000
testl %ecx, %ecx
jg 0x50fd
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: mnet_chann_addr
int
mnet_chann_addr(chann_t *n, chann_addr_t *addr) {
   if (n && addr) {
      strncpy(addr->ip, _chann_addr(n), 16);
      addr->port = _chann_port(n);
      return 1;
   }
   return 0;
}

// Assembly:
testq %rdi, %rdi
sete %cl
testq %rsi, %rsi
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x514e
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x24(%rdi), %edi
callq 0x2120
movl $0x10, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2170
movzwl 0x22(%r14), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x10(%rbx)
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: rwb_destroy_head(s_rwbuf_head*)
static void
_rwb_destroy_head(rwb_head_t *h) {
   if (_rwb_buffered(h->head) <= 0) {
      rwb_t *b = h->head;
      h->head = b->next;
      mm_free(b);
      h->count -= 1;
      if (h->count <= 0) {
         h->head = h->tail = 0;
      }
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x55d6
movl 0x4(%rdi), %eax
cmpl (%rdi), %eax
jg 0x55f7
movq 0x8(%rdi), %rax
movq %rax, (%rbx)
callq *0xac75(%rip)           # 0x10258
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x55f7
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: evt_check_expand(s_event*)
static int
_evt_check_expand(struct s_event *ev) {
   if (ev->count < ev->size) {
      return 1;
   } else {
      int nsize = ev->size * 2;
      ev->array = (mevent_t*)mm_realloc(ev->array, sizeof(mevent_t) * nsize);
      if (ev->array) {
         mm_log(NULL, MNET_LOG_VERBOSE, "evt expand %p to %d\n", ev, nsize);
         ev->size = nsize;
      }
      return (ev->array != NULL);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl 0xac19(%rip), %ebx      # 0x102b0
movl $0x1, %eax
cmpl %ebx, 0xac12(%rip)      # 0x102b4
jl 0x56fb
movq 0xac0d(%rip), %rdi      # 0x102b8
leal (,%rbx,8), %eax
leal (%rax,%rax,2), %esi
callq *0xab95(%rip)           # 0x10250
movq %rax, 0xabf6(%rip)      # 0x102b8
testq %rax, %rax
je 0x56ee
addl %ebx, %ebx
leaq 0x5dd6(%rip), %rdx      # 0xb4a6
leaq 0xabd9(%rip), %rcx      # 0x102b0
xorl %edi, %edi
movl $0x3, %esi
movl %ebx, %r8d
xorl %eax, %eax
callq 0x420f
movl %ebx, 0xabc2(%rip)      # 0x102b0
xorl %eax, %eax
cmpq $0x0, 0xabc0(%rip)      # 0x102b8
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_rc4.c
// Function: rc4_hash_key
uint64_t
rc4_hash_key(const char * str, int sz) {
   uint32_t djb_hash = 5381L;
   uint32_t js_hash = 1315423911L;

   int i;
   for (i=0;i<sz;i++) {
      uint8_t c = (uint8_t)str[i];
      djb_hash += (djb_hash << 5) + c;
      js_hash ^= ((js_hash << 5) + c + (js_hash >> 2));
   }

   return (uint64_t) djb_hash << 32 | js_hash;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %esi, %esi
jle 0x5755
movl %esi, %edx
movl $0x4e67c6a7, %eax       # imm = 0x4E67C6A7
movl $0x1505, %ecx           # imm = 0x1505
xorl %esi, %esi
movl %eax, %r8d
movzbl (%rdi,%rsi), %r9d
movl %ecx, %r10d
shll $0x5, %r10d
addl %r10d, %ecx
addl %r9d, %ecx
movl %eax, %r10d
shll $0x5, %r10d
shrl $0x2, %eax
addl %r10d, %eax
addl %r9d, %eax
xorl %r8d, %eax
incq %rsi
cmpq %rsi, %rdx
jne 0x571a
shlq $0x20, %rcx
movl %eax, %eax
orq %rcx, %rax
jmp 0x575f
movabsq $0x15054e67c6a7, %rax   # imm = 0x15054E67C6A7
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_rc4.c
// Function: rc4_encrypt
int
rc4_encrypt(const char *in, int in_sz, char *out, int out_sz, uint64_t key, time_t ti) {
   uint64_t h = rc4_hash_key(in, in_sz);
   uint32_t tmp;
   struct rc4_sbox rs;
   if (in_sz > out_sz - RC4_CRYPTO_OCCUPY) {
      return RC4_ERR_INSUFFICIENT_OUT_BUFFER_SIZE;
   }
   key = hmac(key, ti);
   rc4_init(&rs, key);
   key ^= h;
   tmp = htonl(ti);
   memcpy(out, &tmp, 4);
   tmp = htonl((uint32_t)key ^ (uint32_t)(key >> 32));
   memcpy(out+4, &tmp, 4);
   rc4_encode(&rs, (const uint8_t *)in, (uint8_t *)out+8, in_sz);

   return in_sz + RC4_CRYPTO_OCCUPY;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %r9, %r12
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, %r15
testl %esi, %esi
jle 0x57ce
movl %ebx, %esi
movl $0x4e67c6a7, %edx       # imm = 0x4E67C6A7
movl $0x1505, %eax           # imm = 0x1505
xorl %edi, %edi
movl %edx, %r9d
movzbl (%r15,%rdi), %r10d
movl %eax, %r11d
shll $0x5, %r11d
addl %r11d, %eax
addl %r10d, %eax
movl %edx, %r11d
shll $0x5, %r11d
shrl $0x2, %edx
addl %r11d, %edx
addl %r10d, %edx
xorl %r9d, %edx
incq %rdi
cmpq %rdi, %rsi
jne 0x5792
shlq $0x20, %rax
movl %edx, %r13d
orq %rax, %r13
jmp 0x57d8
movabsq $0x15054e67c6a7, %r13   # imm = 0x15054E67C6A7
addl $-0x8, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl %ebx, %ecx
jl 0x586b
movq %r8, %rdi
movq %r12, %rsi
callq 0x587d
movq $0x0, -0x138(%rbp)
xorl %ecx, %ecx
movq %rax, %rdx
movb %dl, -0x30(%rbp,%rcx)
shrq $0x8, %rdx
incq %rcx
cmpq $0x8, %rcx
jne 0x5803
xorl %ecx, %ecx
movl %ecx, %edx
andl $0x7, %edx
movzbl -0x30(%rbp,%rdx), %edx
addl %ecx, %edx
movb %dl, -0x130(%rbp,%rcx)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x5816
xorq %r13, %rax
bswapl %r12d
movl %r12d, (%r14)
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
bswapl %ecx
movl %ecx, 0x4(%r14)
addq $0x8, %r14
movslq %ebx, %rcx
leaq -0x138(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x5992
addl $0x8, %ebx
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_rc4.c
// Function: rc4_encode(rc4_sbox*, unsigned char const*, unsigned char*, unsigned long)
static void
rc4_encode(struct rc4_sbox *rs, const uint8_t *src, uint8_t *des, size_t sz) {
   size_t i;
   for (i=0;i<sz;i++) {
      rs->i = (rs->i + 1) % 256;
      rs->j = (rs->j + rs->sbox[rs->i]) % 256;
      uint8_t si = rs->sbox[rs->i];
      uint8_t sj = rs->sbox[rs->j];
      rs->sbox[rs->i] = sj;
      rs->sbox[rs->j] = si;
      uint8_t d = src[i] ^ rs->sbox[(si+sj) % 256];
      des[i] = d;
   }
}

// Assembly:
testq %rcx, %rcx
je 0x5a31
pushq %rbp
movq %rsp, %rbp
pushq %rbx
xorl %eax, %eax
movl $0xffffff00, %r8d       # imm = 0xFFFFFF00
movl (%rdi), %r9d
leal 0x1(%r9), %r10d
leal 0x100(%r9), %r11d
testl %r10d, %r10d
cmovnsl %r10d, %r11d
andl %r8d, %r11d
movl 0x4(%rdi), %r10d
negl %r11d
addl %r11d, %r9d
incl %r9d
movl %r9d, (%rdi)
movslq %r9d, %r9
movzbl 0x8(%rdi,%r9), %r11d
leal (%r10,%r11), %ebx
addl $0xff, %ebx
addl %r11d, %r10d
cmovnsl %r10d, %ebx
andl %r8d, %ebx
subl %ebx, %r10d
movl %r10d, 0x4(%rdi)
movslq %r10d, %r10
movb 0x8(%rdi,%r10), %r10b
movb 0x8(%rdi,%r9), %r11b
movb %r10b, 0x8(%rdi,%r9)
movslq 0x4(%rdi), %r9
addb %r11b, %r10b
movb %r11b, 0x8(%rdi,%r9)
movzbl %r10b, %r9d
movb 0x8(%rdi,%r9), %r9b
xorb (%rsi,%rax), %r9b
movb %r9b, (%rdx,%rax)
incq %rax
cmpq %rax, %rcx
jne 0x59a8
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_rc4.c
// Function: rc4_decrypt
int
rc4_decrypt(const char *in, int in_sz, char *out, int out_sz, uint64_t key, time_t ti) {
   uint32_t pt, check;
   uint64_t h;
   struct rc4_sbox rs;
   in_sz -= RC4_CRYPTO_OCCUPY;
   if (in_sz < 0 || out_sz < in_sz) {
      return RC4_ERR_INSUFFICIENT_IN_BUFFER_SIZE;
   }

   memcpy(&pt, in, 4);
   memcpy(&check, in+4, 4);
   pt = ntohl(pt);
   check = ntohl(check);
   if (abs((int)(pt - ti)) > DEF_TIME_DIFF) {
      return RC4_ERR_OVER_TIME_SECOND;
   }
   key = hmac(key, pt);
   rc4_init(&rs, key);

   rc4_encode(&rs, (const uint8_t *)in + RC4_CRYPTO_OCCUPY, (uint8_t *)out, in_sz);
   h = rc4_hash_key(out, in_sz);
   key ^= h;

   if (check != ((uint32_t)key ^ (uint32_t)(key >> 32))) {
      return RC4_ERR_KEY_INVALID;
   }
   return in_sz;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movl %esi, %r15d
leal -0x8(%r15), %r14d
cmpl $0x8, %esi
setl %al
cmpl %ecx, %r14d
setg %cl
orb %al, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0x5b6d
movq %rdx, %rbx
movq %rdi, %r12
movl (%rdi), %ecx
bswapl %ecx
movl %ecx, %eax
subl %r9d, %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
cmpl $0x708, %edx            # imm = 0x708
ja 0x5b6d
movl 0x4(%r12), %eax
bswapl %eax
movl %eax, -0x2c(%rbp)
movl %ecx, %esi
movq %r8, %rdi
callq 0x587d
movq %rax, %rcx
movq $0x0, -0x148(%rbp)
xorl %eax, %eax
movq %rcx, -0x38(%rbp)
movb %cl, -0x40(%rbp,%rax)
shrq $0x8, %rcx
incq %rax
cmpq $0x8, %rax
jne 0x5ab5
xorl %eax, %eax
movl %eax, %ecx
andl $0x7, %ecx
movzbl -0x40(%rbp,%rcx), %ecx
addl %eax, %ecx
movb %cl, -0x140(%rbp,%rax)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x5ac8
addq $0x8, %r12
movl %r14d, %r13d
leaq -0x148(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x5992
cmpl $0x9, %r15d
jl 0x5b4a
movl $0x4e67c6a7, %ecx       # imm = 0x4E67C6A7
movl $0x1505, %eax           # imm = 0x1505
xorl %edx, %edx
movl %ecx, %esi
movzbl (%rbx,%rdx), %edi
movl %eax, %r8d
shll $0x5, %r8d
addl %r8d, %eax
addl %edi, %eax
movl %ecx, %r8d
shll $0x5, %r8d
shrl $0x2, %ecx
addl %r8d, %ecx
addl %edi, %ecx
xorl %esi, %ecx
incq %rdx
cmpq %rdx, %r13
jne 0x5b14
shlq $0x20, %rax
movl %ecx, %ecx
orq %rax, %rcx
jmp 0x5b54
movabsq $0x15054e67c6a7, %rcx   # imm = 0x15054E67C6A7
xorq -0x38(%rbp), %rcx
movq %rcx, %rax
shrq $0x20, %rax
xorl %ecx, %eax
cmpl %eax, -0x2c(%rbp)
movl $0xfffffffc, %eax       # imm = 0xFFFFFFFC
cmovel %r14d, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_prng.c
// Function: prng_next
uint64_t
prng_next(prng_t *rng) {
   if ( rng ) {
      const uint64_t s0 = rng->seed[0];
      uint64_t s1 = rng->seed[1];
      const uint64_t result = s0 + s1;

      s1 ^= s0;
      rng->seed[0] = _rotl(s0, 55) ^ s1 ^ (s1 << 14); // a, b
      rng->seed[1] = _rotl(s1, 36); // c

      return result;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x5c1a
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
leaq (%rdx,%rcx), %rax
xorq %rcx, %rdx
rolq $0x37, %rcx
movq %rdx, %rsi
shlq $0xe, %rsi
xorq %rcx, %rsi
xorq %rdx, %rsi
movq %rsi, (%rdi)
rolq $0x24, %rdx
movq %rdx, 0x8(%rdi)
jmp 0x5c1c
xorl %eax, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_xor64.c
// Function: xor64_checksum_gen
int
xor64_checksum_gen(uint8_t *buf, int len, uint8_t *checksum) {
   if (buf && checksum && len>=16) {
      uint64_t ret = _64bit_xor(buf, len);
      memcpy(checksum, &ret, sizeof(ret));
      return 1;
   }
   return 0;
}

// Assembly:
xorl %eax, %eax
cmpl $0x10, %esi
jl 0x5c94
movq %rdi, %rcx
testq %rdi, %rdi
je 0x5c94
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5c8a
movl %esi, %eax
shrl $0x3, %eax
xorl %edx, %edx
xorl %r15d, %r15d
xorq (%rcx,%rdx,8), %r15
incq %rdx
cmpq %rdx, %rax
jne 0x5c4b
movl %esi, %eax
andl $0x7, %eax
je 0x5c82
leaq -0x20(%rbp), %r14
movq $0x0, (%r14)
andl $0x7ffffff8, %esi       # imm = 0x7FFFFFF8
addq %rsi, %rcx
movl %eax, %edx
movq %r14, %rdi
movq %rcx, %rsi
callq 0x2220
xorq (%r14), %r15
movq %r15, (%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_xor64.c
// Function: xor64_checksum_check
int
xor64_checksum_check(uint8_t *buf, int len, uint8_t *checksum) {
   if (buf && checksum && len>=16) {
      uint64_t ret = _64bit_xor(buf, len);
      return (0 == memcmp((void*)&ret, (void*)checksum, sizeof(ret)));
   }
   return 0;
}

// Assembly:
xorl %eax, %eax
cmpl $0x10, %esi
jl 0x5d0d
movq %rdi, %rcx
testq %rdi, %rdi
je 0x5d0d
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5d03
movl %esi, %eax
shrl $0x3, %eax
xorl %edx, %edx
xorl %r15d, %r15d
xorq (%rcx,%rdx,8), %r15
incq %rdx
cmpq %rdx, %rax
jne 0x5cc0
movl %esi, %eax
andl $0x7, %eax
je 0x5cf7
leaq -0x20(%rbp), %r14
movq $0x0, (%r14)
andl $0x7ffffff8, %esi       # imm = 0x7FFFFFF8
addq %rsi, %rcx
movl %eax, %edx
movq %r14, %rdi
movq %rcx, %rsi
callq 0x2220
xorq (%r14), %r15
movq %r15, -0x20(%rbp)
xorl %eax, %eax
cmpq (%rbx), %r15
sete %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_mem.c
// Function: mm_malloc_ex
void* mm_malloc_ex(unsigned long sz, const char *fname, int line) {
   memhead_t *mh = &g_mh;
   mem_t *m = (mem_t*)malloc(sz + sizeof(mem_t));
   if ( m ) {
      memset(m, 0, sizeof(*m) + sz);
      m->fname = fname;
      m->line = (unsigned short)line;
      m->size = sz + sizeof(*m);
      m->magic = _MAGIC_MARK;

      _lock(mh->lock);
      if ( mh->head ) {
         m->next = mh->head;
         mh->head->prev = m;
      }
      mh->head = m;
      mh->count++;
      mh->size += m->size;
      _unlock(mh->lock);
      return _MEM_TO_PTR(m);
   }
   assert(0);
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r14d
movq %rsi, %r12
movq %rdi, %r15
addq $0x28, %r15
movq %r15, %rdi
callq 0x2350
testq %rax, %rax
je 0x5def
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x2180
movq %r12, 0x10(%rbx)
movw %r14w, 0x20(%rbx)
movq %r15, 0x18(%rbx)
movw $0xf00d, 0x22(%rbx)     # imm = 0xF00D
movl $0x1, %ecx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0xa535(%rip)      # 0x102d8
jne 0x5d99
movq 0xa53c(%rip), %rax      # 0x102e8
testq %rax, %rax
je 0x5db8
movq %rax, 0x8(%rbx)
movq %rbx, (%rax)
movq %rbx, 0xa529(%rip)      # 0x102e8
incl 0xa517(%rip)            # 0x102dc
movq 0x18(%rbx), %rax
addq %rax, 0xa510(%rip)      # 0x102e0
xorl %ecx, %ecx
movl $0x1, %eax
lock
cmpxchgl %ecx, 0xa4f9(%rip)      # 0x102d8
addq $0x28, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x52ea(%rip), %rdi      # 0xb0e0
leaq 0x5a13(%rip), %rsi      # 0xb810
leaq 0x5a32(%rip), %rcx      # 0xb836
movl $0x41, %edx
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_mem.c
// Function: mm_has
int mm_has(void *p) {
   mem_t *m = _PTR_TO_MEM(p);
   mem_t *h = g_mh.head;
   while ( h ) {
      if (h == m) {
         return 1;
      }
      h = h->next;
   }
   _log("[mem] invalid %p, %d, %s\n", m, m->line, m->fname);
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq -0x28(%rdi), %rsi
movq 0xa4c9(%rip), %rax      # 0x102e8
testq %rax, %rax
je 0x5e2f
cmpq %rsi, %rax
je 0x5e49
movq 0x8(%rax), %rax
jmp 0x5e1f
movzwl -0x8(%rdi), %edx
movq -0x18(%rdi), %rcx
leaq 0x5a2d(%rip), %rdi      # 0xb86b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2060
jmp 0x5e4e
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_mem.c
// Function: mm_free_ex
unsigned long mm_free_ex(void *p, const char *fname, int line) {
   memhead_t *mh = &g_mh;
   _lock(mh->lock); 
   if (p && mh->count>0) {
      unsigned long sz = 0;
      mem_t *m = _PTR_TO_MEM(p);
        
      if (m->magic != _MAGIC_MARK) {
         _log("[mem] (%s:%d), %lu\n", m->fname, m->line, m->size);
         assert(0);
      }

      if (mh->head == m) mh->head = m->next;
      if (m->prev) m->prev->next = m->next;
      if (m->next) m->next->prev = m->prev;
      mh->count--;
      mh->size -= m->size;
      sz = m->size - sizeof(*m);
      free(m);
      _unlock(mh->lock);
      return sz;
   }
   assert(0);
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x1, %ecx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0xa46c(%rip)      # 0x102d8
jne 0x5e62
testq %rdi, %rdi
je 0x5ef9
movl 0xa45f(%rip), %ecx      # 0x102dc
testl %ecx, %ecx
je 0x5ef9
cmpw $0xf00d, -0x6(%rdi)     # imm = 0xF00D
jne 0x5f18
leaq -0x28(%rdi), %rax
cmpq %rax, 0xa450(%rip)      # 0x102e8
jne 0x5ea5
movq -0x20(%rdi), %rdx
movq %rdx, 0xa443(%rip)      # 0x102e8
movq (%rax), %rdx
testq %rdx, %rdx
je 0x5eb5
movq -0x20(%rdi), %rsi
movq %rsi, 0x8(%rdx)
movq -0x20(%rdi), %rsi
testq %rsi, %rsi
je 0x5ec1
movq %rdx, (%rsi)
decl %ecx
movl %ecx, 0xa413(%rip)      # 0x102dc
movq -0x10(%rdi), %rbx
subq %rbx, 0xa40c(%rip)      # 0x102e0
addq $-0x28, %rbx
movq %rax, %rdi
callq 0x2310
xorl %ecx, %ecx
movl $0x1, %eax
lock
cmpxchgl %ecx, 0xa3e9(%rip)      # 0x102d8
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x51e0(%rip), %rdi      # 0xb0e0
leaq 0x5909(%rip), %rsi      # 0xb810
leaq 0x598b(%rip), %rcx      # 0xb899
movl $0x68, %edx
callq 0x21b0
movzwl -0x8(%rdi), %edx
movq -0x18(%rdi), %rsi
movq -0x10(%rdi), %rcx
leaq 0x595a(%rip), %rdi      # 0xb885
xorl %eax, %eax
callq 0x2060
leaq 0x51a7(%rip), %rdi      # 0xb0e0
leaq 0x58d0(%rip), %rsi      # 0xb810
leaq 0x5952(%rip), %rcx      # 0xb899
movl $0x5b, %edx
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_mem.c
// Function: mm_realloc_ex
void* mm_realloc_ex(void *p, unsigned long sz, const char *fname, int line) {
   memhead_t *mh = &g_mh;
   if ( p ) {
      mem_t *m = _PTR_TO_MEM(p);
      mem_t *nm = (mem_t*)realloc(m, sz + sizeof(*m));
      if (nm == NULL) { return NULL; }

      _lock(mh->lock);
      if (mh->head == m) { mh->head = nm; }
      mh->size = mh->size - nm->size + sz + sizeof(*nm);

      if (nm->prev) nm->prev->next = nm;
      if (nm->next) nm->next->prev = nm;

      nm->fname = fname;
      nm->line = (unsigned short)line;
      nm->size = sz + sizeof(*nm);
      nm->magic = _MAGIC_MARK;
      _unlock(mh->lock);
      return _MEM_TO_PTR(nm);
   }
   return mm_malloc_ex(sz, fname, line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r12
testq %rdi, %rdi
je 0x6009
movq %rdi, %r13
addq $-0x28, %r13
leaq 0x28(%r12), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x23e0
testq %rax, %rax
je 0x6024
movq %rax, %rcx
movl $0x1, %edx
xorl %eax, %eax
lock
cmpxchgl %edx, 0xa336(%rip)      # 0x102d8
jne 0x5f98
cmpq %r13, 0xa33d(%rip)      # 0x102e8
jne 0x5fb4
movq %rcx, 0xa334(%rip)      # 0x102e8
addq 0xa325(%rip), %r12      # 0x102e0
subq 0x18(%rcx), %r12
addq $0x28, %r12
movq %r12, 0xa316(%rip)      # 0x102e0
movq (%rcx), %rax
testq %rax, %rax
je 0x5fd6
movq %rcx, 0x8(%rax)
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x5fe2
movq %rcx, (%rax)
movq %r14, 0x10(%rcx)
movw %bx, 0x20(%rcx)
movq %r15, 0x18(%rcx)
movw $0xf00d, 0x22(%rcx)     # imm = 0xF00D
xorl %edx, %edx
movl $0x1, %eax
lock
cmpxchgl %edx, 0xa2d5(%rip)      # 0x102d8
addq $0x28, %rcx
jmp 0x6026
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5d4c
xorl %ecx, %ecx
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_fnode_keep
void lst_fnode_keep(lst_t *lst, int count) {
   if (lst && count>=0) {
      while (lst->free_count > count) {
         lst_node_t *n = lst->free;
         lst->free = n->next;
         lst->free_count--;
         mm_free(n);
      }
   }
}

// Assembly:
testq %rdi, %rdi
sete %al
testl %esi, %esi
sets %cl
orb %al, %cl
jne 0x629a
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl 0x4(%rdi), %eax
cmpl %esi, %eax
jle 0x6290
leaq 0x56e6(%rip), %r15      # 0xb94f
movq 0x18(%r14), %rdi
movq 0x10(%rdi), %rcx
movq %rcx, 0x18(%r14)
decl %eax
movl %eax, 0x4(%r14)
movq %r15, %rsi
movl $0x64, %edx
callq 0x5e57
movl 0x4(%r14), %eax
cmpl %ebx, %eax
jg 0x6269
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq