LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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:
xorl %eax, %eax
testq %rdi, %rdi
je 0x4d17
movl 0x48(%rdi), %ecx
testl %ecx, %ecx
jle 0x4d17
pushq %rbp
movq %rsp, %rbp
movq 0x38(%rdi), %rdx
testq %rdx, %rdx
je 0x4d0a
movl 0x4(%rdx), %eax
subl (%rdx), %eax
jmp 0x4d0c
xorl %eax, %eax
shll $0x10, %ecx
addl %ecx, %eax
addl $0xffff0000, %eax       # imm = 0xFFFF0000
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x4d60
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4063
pushq $0x10
popq %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2170
movzwl 0x22(%r14), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x10(%rbx)
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: rwb_destroy(s_rwbuf_head*)
static void
_rwb_destroy(rwb_head_t *h) {
   while (h->count > 0) {
      rwb_t *b = h->head;
      b->ptr = b->ptw = 0;
      _rwb_destroy_head(h);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $0x0, 0x10(%rbx)
jle 0x519b
movq (%rbx), %rax
andq $0x0, (%rax)
movq %rbx, %rdi
callq 0x51a2
jmp 0x5184
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x51ba
movl 0x4(%rdi), %eax
cmpl (%rdi), %eax
jg 0x51db
movq 0x8(%rdi), %rax
movq %rax, (%rbx)
callq *0xa081(%rip)           # 0xf248
movl 0x10(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x10(%rbx)
cmpl $0x1, %eax
jg 0x51db
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_net/src/mnet_core.c
// Function: set_nonblocking(int)
static int
_set_nonblocking(int fd) {
#if MNET_OS_WIN
   u_long imode = 1;
   int ret = ioctlsocket(fd, FIONBIO, (u_long*)&imode);
   if (ret == NO_ERROR) return 0;
#else
   int flag = fcntl(fd, F_GETFL, 0);
   if (flag != -1) return fcntl(fd, F_SETFL, flag | O_NONBLOCK);
#endif
   return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2190
cmpl $-0x1, %eax
je 0x525f
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebx, %edi
movl %eax, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2190
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa02b(%rip), %ebx      # 0xf2a0
cmpl %ebx, 0xa029(%rip)      # 0xf2a4
jge 0x5282
pushq $0x1
popq %rax
jmp 0x52d4
movq 0xa01f(%rip), %rdi      # 0xf2a8
imull $0x18, %ebx, %esi
callq *0x9fae(%rip)           # 0xf240
movq %rax, 0xa00f(%rip)      # 0xf2a8
testq %rax, %rax
je 0x52d2
addl %ebx, %ebx
leaq 0x51ff(%rip), %rdx      # 0xa4a6
leaq 0x9ff2(%rip), %rcx      # 0xf2a0
pushq $0x3
popq %rsi
xorl %edi, %edi
movl %ebx, %r8d
xorl %eax, %eax
callq 0x3eb5
movl %ebx, 0x9fdd(%rip)      # 0xf2a0
xorl %eax, %eax
cmpq $0x0, 0x9fdb(%rip)      # 0xf2a8
setne %al
jmp 0x52d4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %esi
movl $0x1505, %ecx           # imm = 0x1505
movl $0x4e67c6a7, %edx       # imm = 0x4E67C6A7
cmpq %rax, %rsi
je 0x531d
movzbl (%rdi,%rax), %r8d
imull $0x21, %ecx, %ecx
addl %r8d, %ecx
movl %edx, %r9d
shll $0x5, %r9d
movl %edx, %r10d
shrl $0x2, %r10d
addl %r9d, %r10d
addl %r8d, %r10d
xorl %r10d, %edx
incq %rax
jmp 0x52f1
shlq $0x20, %rcx
movl %edx, %eax
orq %rcx, %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 %r8, -0x30(%rbp)
movl %ecx, %r15d
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, -0x38(%rbp)
callq 0x52dc
addl $-0x8, %r15d
cmpl %ebx, %r15d
jge 0x5362
pushq $-0x2
popq %rbx
jmp 0x53b9
movq %rax, %r13
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x53cd
movq %rax, %r15
leaq -0x140(%rbp), %rdi
movq %rax, %rsi
callq 0x54de
xorq %r15, %r13
bswapl %r12d
movl %r12d, (%r14)
movq %r13, %rax
shrq $0x20, %rax
xorl %r13d, %eax
bswapl %eax
movl %eax, 0x4(%r14)
addq $0x8, %r14
movslq %ebx, %rcx
leaq -0x140(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %r14, %rdx
callq 0x551d
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_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_rc4.c
// Function: rc4_init(rc4_sbox*, unsigned long)
static void
rc4_init(struct rc4_sbox *rs, uint64_t seed) {
   rs->i=0;
   rs->j=0;
   int i;
   uint8_t k[8];
   for (i=0;i<8;i++) {
      k[i] = seed & 0xff;
      seed >>= 8;
   }
   for (i=0;i<256;i++) {
      rs->sbox[i] = (uint8_t)((i + k[i%8]) & 0xff);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $0x0, (%rdi)
xorl %eax, %eax
cmpq $0x8, %rax
je 0x54fc
movb %sil, -0x8(%rbp,%rax)
shrq $0x8, %rsi
incq %rax
jmp 0x54e8
xorl %eax, %eax
cmpq $0x100, %rax            # imm = 0x100
je 0x551b
movl %eax, %ecx
andl $0x7, %ecx
movzbl -0x8(%rbp,%rcx), %ecx
addl %eax, %ecx
movb %cl, 0x8(%rdi,%rax)
incq %rax
jmp 0x54fe
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
movq %rsp, %rbp
movq %rdx, %r8
xorl %r9d, %r9d
movl $0x100, %r10d           # imm = 0x100
cmpq %r9, %rcx
je 0x557f
movl (%rdi), %eax
incl %eax
cltd
idivl %r10d
movl %edx, (%rdi)
movslq %edx, %r11
movzbl 0x8(%rdi,%r11), %eax
addl 0x4(%rdi), %eax
cltd
idivl %r10d
movl %edx, 0x4(%rdi)
movb 0x8(%rdi,%r11), %al
movslq %edx, %rdx
movb 0x8(%rdi,%rdx), %dl
movb %dl, 0x8(%rdi,%r11)
movslq 0x4(%rdi), %r11
movb %al, 0x8(%rdi,%r11)
addb %al, %dl
movzbl %dl, %eax
movb 0x8(%rdi,%rax), %al
xorb (%rsi,%r9), %al
movb %al, (%r8,%r9)
incq %r9
jmp 0x552d
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 $0x108, %rsp            # imm = 0x108
leal -0x8(%rsi), %ebx
cmpl $0x8, %esi
setl %al
cmpl %ecx, %ebx
setg %cl
orb %al, %cl
je 0x55ab
pushq $-0x1
jmp 0x55cb
movq %rdx, %r14
movq %rdi, %r15
movl (%rdi), %eax
bswapl %eax
movl %eax, %ecx
subl %r9d, %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
cmpl $0x708, %edx            # imm = 0x708
jbe 0x55ce
pushq $-0x3
popq %rax
jmp 0x5628
movl 0x4(%r15), %r13d
bswapl %r13d
movl %eax, %esi
movq %r8, %rdi
callq 0x53cd
movq %rax, %r12
leaq -0x130(%rbp), %rdi
movq %rax, %rsi
callq 0x54de
addq $0x8, %r15
movl %ebx, %ecx
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x551d
movq %r14, %rdi
movl %ebx, %esi
callq 0x52dc
xorq %r12, %rax
movq %rax, %rcx
shrq $0x20, %rcx
xorl %eax, %ecx
cmpl %ecx, %r13d
pushq $-0x4
popq %rax
cmovel %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x56d2
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 0x56d4
xorl %eax, %eax
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x5703
testq %rdi, %rdi
je 0x5703
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x56fd
callq 0x5704
movq %rax, (%rbx)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/crypto/m_xor64.c
// Function: 64bit_xor(unsigned char*, int)
static uint64_t
_64bit_xor(uint8_t *buf, int bytes) {
   uint64_t *p=(uint64_t*)buf, ret=0;
   for (int i=0; i<(bytes>>3); i++) {
      ret = ret ^ p[i];
   }
   if (bytes & 0x7) {
      uint8_t extra[8];
      memset(extra, 0, sizeof(uint8_t)*8);
      memcpy(extra, &buf[bytes & ~0x7], bytes & 0x7);
      ret = ret ^ *((uint64_t*)extra);
   }
   return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rax
movl %esi, %ecx
shrl $0x3, %ecx
xorl %edx, %edx
xorl %ebx, %ebx
cmpq %rdx, %rcx
je 0x5729
xorq (%rax,%rdx,8), %rbx
incq %rdx
jmp 0x571b
movl %esi, %ecx
andl $0x7, %ecx
je 0x574e
leaq -0x18(%rbp), %r14
andq $0x0, (%r14)
andl $-0x8, %esi
addq %rsi, %rax
movl %ecx, %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0x2220
xorq (%r14), %rbx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x578e
testq %rdi, %rdi
je 0x578e
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rdx, %rdx
je 0x5788
callq 0x5704
movq %rax, %rcx
movq %rax, -0x10(%rbp)
xorl %eax, %eax
cmpq (%rbx), %rcx
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
addq $0x28, %r14
pushq $0x1
popq %rdi
movq %r14, %rsi
callq 0x21c0
testq %rax, %rax
je 0x5860
movq %rax, %rcx
movq %r15, 0x10(%rax)
movw %bx, 0x20(%rax)
movq %r14, 0x18(%rax)
movw $0xf00d, 0x22(%rax)     # imm = 0xF00D
pushq $0x1
popq %rdx
xorl %eax, %eax
lock
cmpxchgl %edx, 0x9ab4(%rip)      # 0xf2c8
jne 0x580a
movq 0x9abb(%rip), %rax      # 0xf2d8
testq %rax, %rax
je 0x5829
movq %rax, 0x8(%rcx)
movq %rcx, (%rax)
movq %rcx, 0x9aa8(%rip)      # 0xf2d8
incl 0x9a96(%rip)            # 0xf2cc
movq 0x18(%rcx), %rax
addq %rax, 0x9a8f(%rip)      # 0xf2d0
pushq $0x1
popq %rax
xorl %edx, %edx
lock
cmpxchgl %edx, 0x9a7a(%rip)      # 0xf2c8
addq $0x28, %rcx
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4879(%rip), %rdi      # 0xa0e0
leaq 0x4fa2(%rip), %rsi      # 0xa810
leaq 0x4fc1(%rip), %rcx      # 0xa836
pushq $0x41
popq %rdx
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O2/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
leaq 0x9a4a(%rip), %rax      # 0xf2d8
pushq $0x1
popq %rbx
movq (%rax), %rcx
testq %rcx, %rcx
je 0x58a4
leaq 0x8(%rcx), %rax
cmpq %rsi, %rcx
jne 0x5891
jmp 0x58bc
movzwl -0x8(%rdi), %edx
movq -0x18(%rdi), %rcx
leaq 0x4fb8(%rip), %rdi      # 0xa86b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2050
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rcx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0x99f0(%rip)      # 0xf2c8
jne 0x58ce
testq %rdi, %rdi
je 0x595c
movl 0x99e7(%rip), %ecx      # 0xf2cc
testl %ecx, %ecx
je 0x595c
cmpw $0xf00d, -0x6(%rdi)     # imm = 0xF00D
jne 0x5975
leaq -0x28(%rdi), %rax
cmpq %rax, 0x99d8(%rip)      # 0xf2d8
jne 0x590d
movq -0x20(%rdi), %rdx
movq %rdx, 0x99cb(%rip)      # 0xf2d8
movq -0x28(%rdi), %rdx
movq -0x20(%rdi), %rsi
testq %rdx, %rdx
je 0x591e
movq %rsi, 0x8(%rdx)
testq %rsi, %rsi
je 0x5926
movq %rdx, (%rsi)
decl %ecx
movl %ecx, 0x999e(%rip)      # 0xf2cc
movq -0x10(%rdi), %rbx
subq %rbx, 0x9997(%rip)      # 0xf2d0
addq $-0x28, %rbx
movq %rax, %rdi
callq 0x2300
pushq $0x1
popq %rax
xorl %ecx, %ecx
lock
cmpxchgl %ecx, 0x9976(%rip)      # 0xf2c8
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x477d(%rip), %rdi      # 0xa0e0
leaq 0x4ea6(%rip), %rsi      # 0xa810
leaq 0x4f28(%rip), %rcx      # 0xa899
pushq $0x68
jmp 0x59a6
movzwl -0x8(%rdi), %edx
movq -0x18(%rdi), %rsi
movq -0x10(%rdi), %rcx
leaq 0x4efd(%rip), %rdi      # 0xa885
xorl %eax, %eax
callq 0x2050
leaq 0x474a(%rip), %rdi      # 0xa0e0
leaq 0x4e73(%rip), %rsi      # 0xa810
leaq 0x4ef5(%rip), %rcx      # 0xa899
pushq $0x5b
popq %rdx
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
movl %ecx, %ebx
movq %rdx, %r15
movq %rsi, %r14
testq %rdi, %rdi
je 0x5a5b
movq %rdi, %r12
addq $-0x28, %r12
addq $0x28, %r14
movq %r12, %rdi
movq %r14, %rsi
callq 0x23d0
testq %rax, %rax
je 0x5a70
movq %rax, %rcx
pushq $0x1
popq %rdx
xorl %eax, %eax
lock
cmpxchgl %edx, 0x98d1(%rip)      # 0xf2c8
jne 0x59ed
cmpq %r12, 0x98d8(%rip)      # 0xf2d8
jne 0x5a09
movq %rcx, 0x98cf(%rip)      # 0xf2d8
movq 0x98c0(%rip), %rax      # 0xf2d0
addq %r14, %rax
subq 0x18(%rcx), %rax
movq %rax, 0x98b2(%rip)      # 0xf2d0
movq (%rcx), %rax
testq %rax, %rax
je 0x5a2a
movq %rcx, 0x8(%rax)
movq 0x8(%rcx), %rax
testq %rax, %rax
je 0x5a36
movq %rcx, (%rax)
movq %r15, 0x10(%rcx)
movw %bx, 0x20(%rcx)
movq %r14, 0x18(%rcx)
movw $0xf00d, 0x22(%rcx)     # imm = 0xF00D
pushq $0x1
popq %rax
xorl %edx, %edx
lock
cmpxchgl %edx, 0x9873(%rip)      # 0xf2c8
addq $0x28, %rcx
jmp 0x5a72
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x57cc
xorl %ecx, %ecx
movq %rcx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x5cc3
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
leaq 0x4cbf(%rip), %r15      # 0xa94f
pushq $0x64
popq %r12
movl 0x4(%r14), %eax
cmpl %ebx, %eax
jle 0x5cbb
movq 0x18(%r14), %rdi
movq 0x10(%rdi), %rcx
movq %rcx, 0x18(%r14)
decl %eax
movl %eax, 0x4(%r14)
movq %r15, %rsi
movl %r12d, %edx
callq 0x58c5
jmp 0x5c94
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_destroy
void lst_destroy(lst_t *lst) {
   if (lst) {
      lst_node_t *f = lst->first;
      while ( f ) {
         lst_node_t *n = f->next;
         mm_free(f);
         f = n;
      }
      lst_fnode_keep(lst, 0);
      mm_free(lst);
   }
}

// Assembly:
testq %rdi, %rdi
je 0x5d23
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
leaq 0x4c6d(%rip), %r14      # 0xa94f
pushq $0x6e
popq %r15
testq %rdi, %rdi
je 0x5cff
movq 0x10(%rdi), %r12
movq %r14, %rsi
movl %r15d, %edx
callq 0x58c5
movq %r12, %rdi
jmp 0x5ce6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5c6a
leaq 0x4c3f(%rip), %rsi      # 0xa94f
pushq $0x72
popq %rdx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x58c5
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_pushf
lst_node_t* lst_pushf(lst_t *lst, void *data) {
   if ( lst ) {
      lst_node_t *n = _lst_node_new(lst, data);
      if (lst->count == 0) {
         lst->first = lst->last = n;
      }
      else {
         lst->first->prev = n;
         n->next = lst->first;
         lst->first = n;
      }
      lst->count++;
      return n;
   }
   return NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x5dad
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5dc3
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x5db0
movq 0x8(%rbx), %rdx
movq %rax, 0x8(%rdx)
movq %rdx, 0x10(%rax)
jmp 0x5db4
xorl %eax, %eax
retq
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
incl %ecx
movl %ecx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_node_new(s_lst*, void*)
static inline lst_node_t*
_lst_node_new(lst_t *lst, void *data) {
   lst_node_t *n = NULL;
   if (lst->free_count > 0) {
      n = _lst_node_remove_free(lst);
      memset(n, 0, sizeof(*n));
   }
   else {
      n = (lst_node_t*)mm_malloc(sizeof(*n));
      /* assert(n); */
   }
   n->data = data;
   return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x4(%rdi), %ecx
testl %ecx, %ecx
jle 0x5df1
movq 0x18(%rdi), %rax
movq 0x10(%rax), %rdx
movq %rdx, 0x18(%rdi)
decl %ecx
movl %ecx, 0x4(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
jmp 0x5e03
leaq 0x4b57(%rip), %rsi      # 0xa94f
pushq $0x18
popq %rdi
pushq $0x38
popq %rdx
callq 0x57cc
movq %rbx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_pushl
lst_node_t* lst_pushl(lst_t *lst, void *data) {
   if ( lst ) {
      lst_node_t *n = _lst_node_new(lst, data);
      if (lst->count == 0) {
         lst->first = lst->last = n;
      }
      else {
         lst->last->next = n;
         n->prev = lst->last;
         lst->last = n;
      }
      lst->count++;
      return n;
   }
   return NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x5e37
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x5dc3
movl (%rbx), %ecx
testl %ecx, %ecx
je 0x5e3a
leaq 0x10(%rbx), %rdx
movq (%rdx), %rsi
movq %rax, 0x10(%rsi)
movq %rsi, 0x8(%rax)
jmp 0x5e42
xorl %eax, %eax
retq
movq %rax, 0x10(%rbx)
leaq 0x8(%rbx), %rdx
movq %rax, (%rdx)
incl %ecx
movl %ecx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_node_delete(s_lst*, s_lst_node*)
static inline void*
_lst_node_delete(lst_t *lst, lst_node_t *n) {
   void *data = n->data;

   if (lst->first == n) lst->first = n->next;
   if (lst->last == n) lst->last = n->prev;

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

   if ( M_FREE_NODE_RESERVE ) {
      _lst_node_add_free(lst, n);
   }
   else {
      mm_free(n);
   }
   lst->count--;
   return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rsi), %rax
cmpq %rsi, 0x8(%rdi)
jne 0x5e7e
movq 0x10(%rsi), %rcx
movq %rcx, 0x8(%rdi)
movq 0x8(%rsi), %rcx
cmpq %rsi, 0x10(%rdi)
jne 0x5e8c
movq %rcx, 0x10(%rdi)
movq 0x10(%rsi), %rdx
testq %rcx, %rcx
je 0x5e99
movq %rdx, 0x10(%rcx)
testq %rdx, %rdx
je 0x5ea2
movq %rcx, 0x8(%rdx)
movq 0x18(%rdi), %rcx
movq %rcx, 0x10(%rsi)
movq %rsi, 0x18(%rdi)
incl 0x4(%rdi)
decl (%rdi)
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_iter_init
lst_iter_t*
lst_iter_init(lst_t *lst, lst_iter_t *it, lst_direction_t from) {
   if ((lst->count>0) && it) {
      it->lst = lst;
      it->from = from;
      it->node = NULL;
      return it;
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
testq %rsi, %rsi
je 0x5f07
cmpl $0x0, (%rdi)
jle 0x5f07
movq %rdi, (%rsi)
movl %edx, 0x10(%rsi)
andq $0x0, 0x8(%rsi)
movq %rsi, %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_iter_next
lst_iter_t* lst_iter_next(lst_iter_t *it) {
   if (it && it->lst) {
      if (it->node == NULL) {
         it->node = (it->from==LST_FIRST) ? it->lst->first : it->lst->last;
      }
      else {
         it->node = (it->from==LST_FIRST) ? it->node->next : it->node->prev;
      }
      if (it->node == NULL) {
         it->lst = NULL;
         return NULL;
      }
      return it;
   }
   return NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x5f54
movq %rdi, %rax
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x5f54
pushq %rbp
movq %rsp, %rbp
xorl %edx, %edx
xorl %esi, %esi
cmpl $0x0, 0x10(%rax)
movq 0x8(%rax), %rdi
setne %dl
sete %sil
testq %rdi, %rdi
leaq (%rdi,%rsi,8), %rsi
leaq (%rcx,%rdx,8), %rcx
cmovneq %rsi, %rcx
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
testq %rcx, %rcx
jne 0x5f52
andq $0x0, (%rax)
xorl %eax, %eax
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_iter_remove
void* lst_iter_remove(lst_iter_t *it) {
   if (it && it->lst && it->node) {
      lst_t *lst = it->lst;
      lst_node_t *n = it->node;
      if (lst_count(lst) <= 1) {
         it->lst = NULL;
         it->node = NULL;
      }
      else {
         if (it->from == LST_FIRST) it->node = it->node->prev;
         else it->node = it->node->next;
      }
      return _lst_node_delete(lst, n);
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x5f81
movq %rdi, %rax
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x5f81
movq 0x8(%rax), %rsi
testq %rsi, %rsi
je 0x5f81
cmpl $0x1, (%rdi)
jg 0x5f85
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x5f99
xorl %eax, %eax
popq %rbp
retq
cmpl $0x0, 0x10(%rax)
je 0x5f91
movq 0x10(%rsi), %rcx
jmp 0x5f95
movq 0x8(%rsi), %rcx
movq %rcx, 0x8(%rax)
popq %rbp
jmp 0x5e69
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_iter_insert_next
lst_node_t* lst_iter_insert_next(lst_t *lst, lst_iter_t *it, void *data) {
   if (lst && it && it->node) {
      lst_node_t *n = it->node;
      lst_node_t *m = _lst_node_new(lst, data);
      if (n->next) {
         n->next->prev = m;
         m->next = n->next;
      }
      else {
         lst->last = m;
      }
      n->next = m;
      m->prev = n;
      lst->count++;
      return m;
   }
   return NULL;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x600d
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x8(%rsi), %r14
testq %r14, %r14
je 0x6010
movq %rdi, %rbx
movq %rdx, %rsi
callq 0x5dc3
movq 0x10(%r14), %rcx
movq %rbx, %rdx
movq %rax, %rsi
testq %rcx, %rcx
je 0x5ffd
movq %rax, 0x8(%rcx)
movq %rax, %rdx
movq %rcx, %rsi
movq %rsi, 0x10(%rdx)
movq %rax, 0x10(%r14)
movq %r14, 0x8(%rax)
incl (%rbx)
jmp 0x6012
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_list.c
// Function: lst_iter_insert_prev
lst_node_t* lst_iter_insert_prev(lst_t *lst, lst_iter_t *it, void *data) {
   if (lst && it && it->node) {
      lst_node_t *n = it->node;
      lst_node_t *m = _lst_node_new(lst, data);
      if (n->prev) {
         m->prev = n->prev;
         n->prev->next = m;
      }
      else {
         lst->first = m;
      }
      n->prev = m;
      m->next = n;
      lst->count++;
      return m;
   }
   return NULL;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x6059
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x8(%rsi), %r14
testq %r14, %r14
je 0x605c
movq %rdi, %rbx
movq %rdx, %rsi
callq 0x5dc3
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x6060
movq %rcx, 0x8(%rax)
movq 0x8(%r14), %rcx
addq $0x10, %rcx
jmp 0x6064
xorl %eax, %eax
retq
xorl %eax, %eax
jmp 0x6071
leaq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movq %rax, 0x8(%r14)
movq %r14, 0x10(%rax)
incl (%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_create_lst
tmr_t*
tmr_create_lst(void) {
   
   tmr_t *tmr = (tmr_t*)mm_malloc(sizeof(*tmr));
   if (tmr) {
      tmr->unit_skt = skt_create();
      tmr->unit_free = lst_create();
      tmr->tm_free = lst_create();
   }
   return tmr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x48f0(%rip), %rsi      # 0xa976
pushq $0x18
popq %rdi
pushq $0x2e
popq %rdx
callq 0x57cc
movq %rax, %rbx
testq %rax, %rax
je 0x60c6
callq 0x6514
movq %rax, (%rbx)
leaq 0x48ce(%rip), %r14      # 0xa976
pushq $0x31
popq %rsi
movq %r14, %rdi
callq 0x5c3c
movq %rax, 0x8(%rbx)
pushq $0x32
popq %rsi
movq %r14, %rdi
callq 0x5c3c
movq %rax, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_destroy_lst
void
tmr_destroy_lst(tmr_t *tmr) {
   
   if (tmr) {
      
      while (skt_count(tmr->unit_skt) > 0) {
         _tmr_unit_destroy( (tmr_unit_t*)skt_popf(tmr->unit_skt) );
      }
      skt_destroy(tmr->unit_skt);

      while (lst_count(tmr->unit_free) > 0) {
         _tmr_unit_destroy( (tmr_unit_t*)lst_popf(tmr->unit_free) );
      }
      lst_destroy(tmr->unit_free);

      while (lst_count(tmr->tm_free) > 0) {
         mm_free( lst_popf(tmr->tm_free) );
      }
      lst_destroy(tmr->tm_free);

      mm_free(tmr);
   }
}

// Assembly:
testq %rdi, %rdi
je 0x617e
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rbx), %rdi
callq 0x663e
movq (%rbx), %rdi
testl %eax, %eax
jle 0x6102
callq 0x68b2
movq %rax, %rdi
callq 0x617f
jmp 0x60e4
callq 0x65c2
movq 0x8(%rbx), %rdi
callq 0x5d24
movq 0x8(%rbx), %rdi
testl %eax, %eax
jle 0x6127
callq 0x5e50
movq %rax, %rdi
callq 0x617f
jmp 0x6107
callq 0x5cc4
leaq 0x4843(%rip), %r14      # 0xa976
pushq $0x76
popq %r15
movq 0x10(%rbx), %rdi
callq 0x5d24
movq 0x10(%rbx), %rdi
testl %eax, %eax
jle 0x615d
callq 0x5e50
movq %rax, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x58c5
jmp 0x6137
callq 0x5cc4
leaq 0x480d(%rip), %rsi      # 0xa976
pushq $0x7a
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x58c5
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_unit_destroy(tmr_unit_t*)
static void
_tmr_unit_destroy(tmr_unit_t *u) {

   while (lst_count(u->tm_lst) > 0) {
      mm_free( lst_popf(u->tm_lst) );
   }

   lst_destroy(u->tm_lst);
   mm_free(u);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x47e3(%rip), %r14      # 0xa976
pushq $0x5d
popq %r15
movq 0x8(%rbx), %rdi
callq 0x5d24
movq 0x8(%rbx), %rdi
testl %eax, %eax
jle 0x61bd
callq 0x5e50
movq %rax, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x58c5
jmp 0x6197
callq 0x5cc4
leaq 0x47ad(%rip), %rsi      # 0xa976
pushq $0x61
popq %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x58c5
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_update_lst
void
tmr_update_lst(tmr_t *tmr, int64_t current_ti) {
   
   if (tmr==NULL || skt_count(tmr->unit_skt)<=0) {
      return;
   }

   // check first fire unit
   tmr_unit_t *u = (tmr_unit_t*)skt_first(tmr->unit_skt);
   if (u->fire_ti > current_ti) {
      return;
   }
   
   // check timer in list
   for (int i=0; i<skt_count(tmr->unit_skt); i++) {
      
      tmr_unit_t *u = (tmr_unit_t*)skt_first(tmr->unit_skt);
      if (u->fire_ti > current_ti) {
         break;
      }

      do {
         tmr_timer_t *tm = (tmr_timer_t*)lst_popf(u->tm_lst);

         tm->cb(tm, tm->opaque);
         
         if (tm->repeat) {
            _tmr_add_tm(tmr, tm, current_ti);
         } else {
            _tmr_tm_recycle(tmr, tm);
         }
         
      } while (lst_count(u->tm_lst) > 0);

      _tmr_unit_try_suspend(tmr, u);
   }
}

// Assembly:
testq %rdi, %rdi
je 0x621e
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x663e
testl %eax, %eax
jle 0x6210
movq (%r14), %rdi
callq 0x6892
cmpq %rbx, (%rax)
jle 0x621f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r13d, %r13d
movq (%r14), %rdi
callq 0x663e
cmpl %eax, %r13d
jge 0x6210
movq (%r14), %rdi
callq 0x6892
cmpq %rbx, (%rax)
jg 0x6210
movq %rax, %r15
movq 0x8(%r15), %rdi
callq 0x5e50
movq %rax, %r12
movq 0x18(%rax), %rsi
movq %rax, %rdi
callq *0x10(%rax)
cmpb $0x0, 0x8(%r12)
je 0x626d
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x6295
jmp 0x6278
movq %r14, %rdi
movq %r12, %rsi
callq 0x633e
movq 0x8(%r15), %rdi
callq 0x5d24
testl %eax, %eax
jg 0x623f
movq %r14, %rdi
movq %r15, %rsi
callq 0x634c
incl %r13d
jmp 0x6222
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_add_tm(s_tmr*, s_tmr_timer*, long)
static tmr_timer_t*
_tmr_add_tm(tmr_t *tmr,
            tmr_timer_t *tm,
            int64_t current_ti)
{
   int64_t fire_ti = current_ti + tm->interval_ti;
   tmr_unit_t *u = (tmr_unit_t*)skt_query(tmr->unit_skt, fire_ti);
   
   if (u == NULL) {
      u = _tmr_unit_create(tmr, fire_ti);
   }

   tm->unit = u;
   tm->node = lst_pushl(u->tm_lst, tm);
   return tm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
addq (%rsi), %r14
movq (%rdi), %rdi
movq %r14, %rsi
callq 0x6650
movq %rax, %r12
testq %rax, %rax
jne 0x6317
movq 0x8(%r15), %rdi
callq 0x5d24
testl %eax, %eax
jle 0x62dd
movq 0x8(%r15), %rdi
callq 0x5e50
movq %rax, %r12
jmp 0x6305
leaq 0x4692(%rip), %r13      # 0xa976
pushq $0x10
popq %rdi
pushq $0x41
popq %rdx
movq %r13, %rsi
callq 0x57cc
movq %rax, %r12
pushq $0x42
popq %rsi
movq %r13, %rdi
callq 0x5c3c
movq %rax, 0x8(%r12)
movq %r14, (%r12)
movq (%r15), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x668c
movq %r12, 0x20(%rbx)
movq 0x8(%r12), %rdi
movq %rbx, %rsi
callq 0x5e0d
movq %rax, 0x28(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_add
tmr_timer_t*
tmr_add(tmr_t *tmr,
        int64_t current_ti,
        int64_t interval_ti,
        int repeat,
        void *opaque,
        tmr_callback cb)
{
   if (tmr && cb) {
      
      tmr_timer_t *tm = _tmr_tm_create(tmr);
      if ( tm ) {
         tm->interval_ti = interval_ti;
         tm->repeat = repeat;
         tm->cb = cb;
         tm->opaque = opaque;
         return _tmr_add_tm(tmr, tm, current_ti);
      }
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r13d
testq %rdi, %rdi
sete %al
testq %r9, %r9
sete %cl
orb %al, %cl
jne 0x6414
movq %r9, %r15
movq %rdx, %rbx
movq %rdi, %r12
movq %r8, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq 0x10(%rdi), %rdi
callq 0x5d24
testl %eax, %eax
jle 0x63d4
movq 0x10(%r12), %rdi
callq 0x5e50
jmp 0x63e8
leaq 0x459b(%rip), %rsi      # 0xa976
pushq $0x30
popq %rdi
movl $0x86, %edx
callq 0x57cc
movq %rax, %r14
testq %rax, %rax
je 0x6414
movq %rbx, (%r14)
movb %r13b, 0x8(%r14)
movq %r15, 0x10(%r14)
movq -0x30(%rbp), %rax
movq %rax, 0x18(%r14)
movq %r12, %rdi
movq %r14, %rsi
movq -0x38(%rbp), %rdx
callq 0x6295
jmp 0x6417
xorl %r14d, %r14d
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_fire
void
tmr_fire(tmr_t *tmr,
         tmr_timer_t *tm,
         int64_t current_ti,
         int run_callback)
{
   if (tmr && tm && tm->unit) {

      _tmr_tm_suspend(tmr, tm);
      _tmr_unit_try_suspend(tmr, tm->unit);
      
      if (run_callback) {
         tm->cb(tm, tm->opaque);
      }

      if ( !tm->repeat ) {
         _tmr_tm_recycle(tmr, tm);
         return;
      }

      _tmr_add_tm(tmr, tm, current_ti);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %r12d
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x6496
movq %rsi, %rbx
cmpq $0x0, 0x20(%rsi)
je 0x6496
movq %rdx, %r14
movq %rdi, %r15
movq %rbx, %rdi
callq 0x64b2
movq 0x20(%rbx), %rsi
movq %r15, %rdi
callq 0x634c
testl %r12d, %r12d
je 0x647a
movq 0x18(%rbx), %rsi
movq %rbx, %rdi
callq *0x10(%rbx)
cmpb $0x0, 0x8(%rbx)
je 0x649f
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6295
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x633e
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_invalidate
void
tmr_invalidate(tmr_t *tmr, tmr_timer_t *tm) {
   
   if (tmr && tm && tm->unit) {
      _tmr_tm_suspend(tmr, tm);
      _tmr_tm_recycle(tmr, tm);
      _tmr_unit_try_suspend(tmr, tm->unit);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x650f
movq %rsi, %r14
cmpq $0x0, 0x20(%rsi)
je 0x650f
movq %rdi, %rbx
movq %r14, %rdi
callq 0x64b2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x633e
movq 0x20(%r14), %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x634c
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_create
skt_t*
skt_create(void) {
   skt_t *lst = (skt_t*)mm_malloc(sizeof(*lst));
   if (lst) {
      prng_init(&lst->rng);
      
      lst->tail = _newNodeOfLevel(0);
      lst->tail->key = SKT_KEY_MASK;
      
      lst->randomBits = prng_next(&lst->rng);
      lst->randomsLeft = kBitsInRandom / 2;
      
      lst->level = 0;
      lst->count = 0;
      
      lst->header = _newNodeOfLevel(kMaxNumberOfLevels);
      
      for (int i=0; i<kMaxNumberOfLevels; i++) {
         lst->header->forward[i] = lst->tail;
      }
   }
   return lst;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4479(%rip), %rsi      # 0xa99e
pushq $0x30
popq %rdi
pushq $0x47
popq %rdx
callq 0x57cc
movq %rax, %rbx
testq %rax, %rax
je 0x6593
movq %rbx, %r14
addq $0x20, %r14
movq %r14, %rdi
callq 0x563c
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x65a1
movq %rax, 0x18(%rbx)
orq $-0x1, (%rax)
movq %r14, %rdi
callq 0x569d
movl %eax, 0x4(%rbx)
movl $0xf, (%rbx)
andq $0x0, 0x8(%rbx)
pushq $0x10
popq %rdi
callq 0x65a1
movq %rax, 0x10(%rbx)
cmpq $0x10, %r15
je 0x6593
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
movq %rcx, 0x10(%rax,%r15,8)
incq %r15
jmp 0x657b
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_destroy
void
skt_destroy(skt_t *lst) {
   if (lst) {
      skt_node_t *next, *p = lst->header->forward[0];
      while (p != lst->tail) {
         next = p->forward[0];
         mm_free(p);
         p = next;
      }
      mm_free(lst->header);
      mm_free(lst->tail);
      mm_free(lst);
   }
}

// Assembly:
testq %rdi, %rdi
je 0x663d
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq 0x10(%rax), %rdi
leaq 0x43ba(%rip), %r14      # 0xa99e
pushq $0x64
popq %r15
cmpq 0x18(%rbx), %rdi
je 0x6602
movq 0x10(%rdi), %r12
movq %r14, %rsi
movl %r15d, %edx
callq 0x58c5
movq %r12, %rdi
jmp 0x65e8
movq 0x10(%rbx), %rdi
leaq 0x4391(%rip), %r14      # 0xa99e
pushq $0x67
popq %rdx
movq %r14, %rsi
callq 0x58c5
movq 0x18(%rbx), %rdi
pushq $0x68
popq %rdx
movq %r14, %rsi
callq 0x58c5
pushq $0x69
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x58c5
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_query
void*
skt_query(skt_t *lst, uint64_t key) {
   int k;
   skt_node_t *p, *next;
   
   if (lst) {
      p = lst->header;
      k = lst->level;
      do {
         while (next = p->forward[k], next->key < key) {
            p = next;
         }

         if (next->key == key) {
            return next->value;
         }         
      } while (--k >= 0);
   }
   return NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x6683
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rdi), %rdx
movslq 0x8(%rdi), %rcx
xorl %eax, %eax
movq %rdx, %rdi
movq %rdi, %rdx
movq 0x10(%rdi,%rcx,8), %rdi
cmpq %rsi, (%rdi)
jb 0x6666
je 0x6686
leaq -0x1(%rcx), %rdi
testq %rcx, %rcx
movq %rdi, %rcx
jg 0x6663
jmp 0x668a
xorl %eax, %eax
retq
movq 0x8(%rdi), %rax
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_insert
void*
skt_insert(skt_t *lst, uint64_t key, void *value) {
   if (lst && key>0 && key<SKT_KEY_MASK && value) {
      int k;
      skt_node_t *p, *next;
      skt_node_t *update[kMaxNumberOfLevels];   
      
      p = lst->header;
      k = lst->level;
      do {
         while (next = p->forward[k], next->key < key) {
            p = next;
         }
         update[k] = p;
      } while(--k >= 0);

      if (next->key == key) {
         return NULL;
      }

      k = _randomLevel(lst);
      if (k > lst->level) {
         k = ++lst->level;
         update[k] = lst->header;
      }
      next = _newNodeOfLevel(k);
      next->key = key;
      next->value = value;
      do {
         p = update[k];
         next->forward[k] = p->forward[k];
         p->forward[k] = next;
      } while(--k >= 0);
      lst->count += 1;
      return value;
   }
   return NULL;
}

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
je 0x67bb
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
testq %rdi, %rdi
je 0x67aa
movq %rsi, %r15
leaq -0x1(%rsi), %rcx
cmpq $-0x3, %rcx
ja 0x67aa
movq 0x10(%r14), %rcx
movslq 0x8(%r14), %rax
movq %rcx, %rsi
movq %rsi, %rcx
movq 0x10(%rsi,%rax,8), %rsi
movq (%rsi), %rdi
cmpq %r15, %rdi
jb 0x66d3
movq %rcx, -0xb0(%rbp,%rax,8)
leaq -0x1(%rax), %rsi
testq %rax, %rax
movq %rsi, %rax
jg 0x66d0
cmpq %r15, %rdi
jne 0x6704
xorl %r12d, %r12d
jmp 0x67a7
movq %rdx, -0x30(%rbp)
leaq 0x20(%r14), %r12
movl (%r14), %ecx
movl 0x4(%r14), %ebx
pushq $-0x1
popq %r13
movl %ebx, %eax
sarl $0x2, %eax
movl %eax, 0x4(%r14)
decl %ecx
movl %ecx, (%r14)
jne 0x673d
movq %r12, %rdi
callq 0x569d
movl %eax, 0x4(%r14)
movl $0xf, (%r14)
pushq $0xf
popq %rcx
incl %r13d
testb $0x3, %bl
movl %eax, %ebx
je 0x6717
cmpl $0xf, %r13d
pushq $0xf
popq %rdi
cmovll %r13d, %edi
movslq 0x8(%r14), %rax
cmpl %eax, %edi
jle 0x6772
leaq 0x1(%rax), %rbx
movl %ebx, 0x8(%r14)
movq 0x10(%r14), %rcx
movq %rcx, -0xa8(%rbp,%rax,8)
movl %ebx, %edi
jmp 0x6774
movl %edi, %ebx
movq -0x30(%rbp), %r12
callq 0x65a1
movq %r15, (%rax)
movq %r12, 0x8(%rax)
incq %rbx
movq -0xb8(%rbp,%rbx,8), %rcx
movq 0x8(%rcx,%rbx,8), %rdx
movq %rdx, 0x8(%rax,%rbx,8)
movq %rax, 0x8(%rcx,%rbx,8)
decq %rbx
jg 0x6787
incl 0xc(%r14)
movq %r12, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_remove
void*
skt_remove(skt_t *lst, uint64_t key) {
   void *ret_value = NULL;
   if (lst && key>0 && key<SKT_KEY_MASK) {
      int k, m;
      skt_node_t *p, *next;
      skt_node_t *update[kMaxNumberOfLevels];      
      
      p = lst->header;
      k = m = lst->level;
      do {
         while (next = p->forward[k], next->key < key) {
            p = next;
         }
         update[k] = p;
      } while(--k >= 0);

      if (next->key == key) {
         ret_value = next->value;         
         for (k=0; k<=m && (p=update[k])->forward[k] == next; k++) {
            p->forward[k] = next->forward[k];
         }
         mm_free(next);
         while (lst->header->forward[m]==lst->tail && m>0) {
            m--;
         }
         lst->level = m;
         lst->count -= 1;
      }
   }
   return ret_value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
testq %rdi, %rdi
sete %al
leaq -0x1(%rsi), %rcx
cmpq $-0x2, %rcx
setae %cl
orb %al, %cl
jne 0x6844
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movslq 0x8(%rdi), %r15
movq %r15, %rcx
movq %rax, %rdi
movq %rdi, %rax
movq 0x10(%rdi,%rcx,8), %rdi
movq (%rdi), %rdx
cmpq %rsi, %rdx
jb 0x67f2
movq %rax, -0xa0(%rbp,%rcx,8)
leaq -0x1(%rcx), %r8
testq %rcx, %rcx
movq %r8, %rcx
jg 0x67ef
cmpq %rsi, %rdx
jne 0x6844
movq 0x8(%rdi), %r14
xorl %eax, %eax
cmpq %r15, %rax
jg 0x6849
movq -0xa0(%rbp,%rax,8), %rcx
cmpq %rdi, 0x10(%rcx,%rax,8)
jne 0x6849
movq 0x10(%rdi,%rax,8), %rdx
movq %rdx, 0x10(%rcx,%rax,8)
incq %rax
jmp 0x6821
xorl %r14d, %r14d
jmp 0x6881
leaq 0x414e(%rip), %rsi      # 0xa99e
movl $0xc9, %edx
callq 0x58c5
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
leal 0x1(%r15), %edx
decl %edx
testq %r15, %r15
jle 0x687b
leaq -0x1(%r15), %rsi
cmpq %rcx, 0x10(%rax,%r15,8)
movq %rsi, %r15
je 0x6866
movl %edx, 0x8(%rbx)
decl 0xc(%rbx)
movq %r14, %rax
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq