LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: 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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xb109
cmpq $0x0, -0x38(%rbp)
je 0xb109
movq -0x10(%rbp), %rdi
callq 0xb120
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0xb107
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movl -0x24(%rbp), %eax
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xaf70
movq %rax, -0x8(%rbp)
jmp 0xb111
jmp 0xb109
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_tm_create(s_tmr*)
static tmr_timer_t*
_tmr_tm_create(tmr_t *tmr) {
   tmr_timer_t *tm = NULL;
   if (lst_count(tmr->tm_free) > 0) {
      tm = (tmr_timer_t*)lst_popf(tmr->tm_free);
   } else {
      tm = (tmr_timer_t*)mm_malloc(sizeof(*tm));
   }
   return tm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa3c0
cmpl $0x0, %eax
jle 0xb159
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xa660
movq %rax, -0x10(%rbp)
jmp 0xb173
movl $0x30, %edi
leaq 0x87e3(%rip), %rsi      # 0x13948
movl $0x86, %edx
callq 0x9aa0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb214
cmpq $0x0, -0x10(%rbp)
je 0xb214
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xb214
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xb220
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xb030
cmpl $0x0, -0x1c(%rbp)
je 0xb1ea
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rsi
callq *%rax
movq -0x10(%rbp), %rax
cmpb $0x0, 0x8(%rax)
jne 0xb203
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xb000
jmp 0xb214
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xaf70
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb2a4
cmpq $0x0, -0x10(%rbp)
je 0xb2a4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xb2a4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xb220
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xb000
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xb030
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_timer.c
// Function: tmr_unit_create(s_tmr*, long)
static tmr_unit_t*
_tmr_unit_create(tmr_t *tmr, int64_t fire_ti) {
   
   tmr_unit_t *u = NULL;

   if (lst_count(tmr->unit_free) > 0) {
      u = (tmr_unit_t*)lst_popf(tmr->unit_free);
   } else {
      u = (tmr_unit_t*)mm_malloc(sizeof(*u));
      u->tm_lst = lst_create();
   }

   u->fire_ti = fire_ti;
   skt_insert(tmr->unit_skt, fire_ti, u);

   return u;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa3c0
cmpl $0x0, %eax
jle 0xb2ed
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xa660
movq %rax, -0x18(%rbp)
jmp 0xb323
movl $0x10, %edi
leaq 0x864f(%rip), %rsi      # 0x13948
movl $0x41, %edx
callq 0x9aa0
movq %rax, -0x18(%rbp)
leaq 0x863a(%rip), %rdi      # 0x13948
movl $0x42, %esi
callq 0xa260
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xb5e0
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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
subq $0x10, %rsp
movl $0x30, %edi
leaq 0x860c(%rip), %rsi      # 0x13970
movl $0x47, %edx
callq 0x9aa0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb429
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
callq 0x9770
xorl %edi, %edi
callq 0xb440
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq $-0x1, (%rax)
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
callq 0x9800
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl $0xf, (%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0xc(%rax)
movl $0x10, %edi
callq 0xb440
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x10, -0xc(%rbp)
jge 0xb427
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xb3fd
jmp 0xb429
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb517
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x18(%rcx), %rax
je 0xb4d0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x84b4(%rip), %rsi      # 0x13970
movl $0x64, %edx
callq 0x9c60
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0xb497
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x8491(%rip), %rsi      # 0x13970
movl $0x67, %edx
callq 0x9c60
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x8478(%rip), %rsi      # 0x13970
movl $0x68, %edx
callq 0x9c60
movq -0x8(%rbp), %rdi
leaq 0x8463(%rip), %rsi      # 0x13970
movl $0x69, %edx
callq 0x9c60
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: 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:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xb5d0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0xb57b
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jae 0xb5a3
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xb57b
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0xb5be
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0xb5d8
jmp 0xb5c0
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0xb579
jmp 0xb5d0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nop
// File: 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:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xb75a
cmpq $0x0, -0x18(%rbp)
jbe 0xb75a
cmpq $-0x1, -0x18(%rbp)
jae 0xb75a
cmpq $0x0, -0x20(%rbp)
je 0xb75a
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0xb63b
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jae 0xb663
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xb63b
movq -0x30(%rbp), %rcx
movslq -0x24(%rbp), %rax
movq %rcx, -0xc0(%rbp,%rax,8)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
jge 0xb639
movq -0x38(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0xb69b
movq $0x0, -0x8(%rbp)
jmp 0xb762
movq -0x10(%rbp), %rdi
callq 0xb770
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jle 0xb6d7
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x8(%rcx)
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x24(%rbp), %rax
movq %rcx, -0xc0(%rbp,%rax,8)
movl -0x24(%rbp), %edi
callq 0xb440
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movslq -0x24(%rbp), %rax
movq -0xc0(%rbp,%rax,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rdx
movq -0x38(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
jge 0xb6fa
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb762
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nop
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: randomLevel(s_skt*)
static inline int
_randomLevel(skt_t *lst) {
   int level = 0;
   int b;
   do {
      b = lst->randomBits & 3;  /* 25% */
      if (!b) {
         level++;
      }
      lst->randomBits>>=2;
      if (--lst->randomsLeft == 0) {
         lst->randomBits = prng_next(&lst->rng);
         lst->randomsLeft = kBitsInRandom/2;
      }
   } while (!b);
   return (level > kMaxLevel ? kMaxLevel : level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x3, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jne 0xb79f
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x4(%rax), %ecx
sarl $0x2, %ecx
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rcx
movl (%rcx), %eax
addl $-0x1, %eax
movl %eax, (%rcx)
cmpl $0x0, %eax
jne 0xb7dc
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
callq 0x9800
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x8(%rbp), %rax
movl $0xf, (%rax)
jmp 0xb7de
cmpl $0x0, -0x10(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xb783
cmpl $0xf, -0xc(%rbp)
jle 0xb7fb
movl $0xf, %eax
movl %eax, -0x14(%rbp)
jmp 0xb801
movl -0xc(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: 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
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xb9ad
cmpq $0x0, -0x10(%rbp)
jbe 0xb9ad
cmpq $-0x1, -0x10(%rbp)
jae 0xb9ad
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x20(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0xb867
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jae 0xb88f
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xb867
movq -0x28(%rbp), %rcx
movslq -0x1c(%rbp), %rax
movq %rcx, -0xb0(%rbp,%rax,8)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0xb865
movq -0x30(%rbp), %rax
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xb9ab
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x20(%rbp), %ecx
movb %al, -0xb1(%rbp)
jg 0xb907
movslq -0x1c(%rbp), %rax
movq -0xb0(%rbp,%rax,8), %rax
movq %rax, -0x28(%rbp)
movslq -0x1c(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rax
cmpq -0x30(%rbp), %rax
sete %al
movb %al, -0xb1(%rbp)
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0xb913
jmp 0xb938
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rdx
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, 0x10(%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb8d1
movq -0x30(%rbp), %rdi
leaq 0x802d(%rip), %rsi      # 0x13970
movl $0xc9, %edx
callq 0x9c60
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x20(%rbp), %rcx
movq 0x10(%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rdx
xorl %eax, %eax
cmpq 0x18(%rdx), %rcx
movb %al, -0xb2(%rbp)
jne 0xb97d
cmpl $0x0, -0x20(%rbp)
setg %al
movb %al, -0xb2(%rbp)
movb -0xb2(%rbp), %al
testb $0x1, %al
jne 0xb989
jmp 0xb994
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xb94d
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %ecx
subl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0xb9ad
movq -0x18(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_popf
void*
skt_popf(skt_t *lst) {
   if (lst && lst->count>0) {
      skt_node_t *p = lst->header->forward[0];
      return skt_remove(lst, p->key);
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xba43
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0xba43
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0xb810
movq %rax, -0x8(%rbp)
jmp 0xba4b
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_iter_init
skt_iter_t*
skt_iter_init(skt_t *lst, skt_iter_t *it) {
   if (lst && lst->count>0 && it) {
      memset(it, 0, sizeof(*it));
      return it;
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xbaa2
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0xbaa2
cmpq $0x0, -0x18(%rbp)
je 0xbaa2
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x31c0
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbaaa
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_iter_next
skt_iter_t*
skt_iter_next(skt_t *lst, skt_iter_t *it) {
   if (lst && lst->count>0 && it) {
      if (it->prev == NULL) {
         it->prev = lst->header;
      } else if ( it->curr ) {
         it->prev = ((skt_node_t*)it->prev)->forward[0];
      }
      it->curr = ((skt_node_t*)it->prev)->forward[0];
      skt_node_t *node = (skt_node_t*)it->curr;
      if (node != lst->tail) {
         it->key = node->key;
         it->value = node->value;
         return it;
      }
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xbb82
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0xbb82
cmpq $0x0, -0x18(%rbp)
je 0xbb82
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xbb0b
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0xbb2a
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xbb28
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0xbb2a
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
je 0xbb80
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbb8a
jmp 0xbb82
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
// File: xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_skiplist.c
// Function: skt_iter_remove
void*
skt_iter_remove(skt_t *lst, skt_iter_t *it) {
   if (lst && lst->count>0 && it) {
      if (it->key > 0) {
         it->curr = NULL;
         return skt_remove(lst, it->key);
      }
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xbbe8
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0xbbe8
cmpq $0x0, -0x18(%rbp)
je 0xbbe8
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jbe 0xbbe6
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xb810
movq %rax, -0x8(%rbp)
jmp 0xbbf0
jmp 0xbbe8
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
nopl (%rax)
// File: xocoder[P]m_kcptun/src/session_proto.cpp
// Function: proto_probe(unsigned char const*, int, proto_t*)
int
proto_probe(const unsigned char *buf, int buf_len, proto_t *proto) {
   if (buf && buf_len>0 && proto) {
      proto->ptype = (buf[0] >> _TYPE_OFFSET);
      proto->sid = (buf[1]<<8) | buf[2];
      if (proto->ptype == PROTO_TYPE_CTRL) {
         proto->u.cmd = (buf[0] & _CMD_MASK);
      } else {
         proto->u.data = (unsigned char*)(buf + 3);

      }
      proto->data_length = buf_len - 3;
      return 1;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xbc93
cmpl $0x0, -0x14(%rbp)
jle 0xbc93
cmpq $0x0, -0x20(%rbp)
je 0xbc93
movq -0x10(%rbp), %rax
movzbl (%rax), %ecx
sarl $0x5, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movzbl 0x1(%rax), %ecx
shll $0x8, %ecx
movq -0x10(%rbp), %rax
movzbl 0x2(%rax), %eax
orl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x20(%rbp), %rax
cmpl $0x1, (%rax)
jne 0xbc6d
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
andl $0x1f, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x8(%rax)
jmp 0xbc7d
movq -0x10(%rbp), %rcx
addq $0x3, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x14(%rbp), %ecx
subl $0x3, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xbc9a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nop
// File: xocoder[P]m_kcptun/src/session_proto.cpp
// Function: proto_mark_cmd(unsigned char*, unsigned int, int)
int
proto_mark_cmd(unsigned char *buf, unsigned sid, int cmd) {
   if (buf && cmd>0) {
      buf[0] = (PROTO_TYPE_CTRL << _TYPE_OFFSET) | (cmd & _CMD_MASK);
      buf[1] = (sid >> 8) & 0xff;
      buf[2] = sid & 0xff;
      return 3;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xbcfa
cmpl $0x0, -0x18(%rbp)
jle 0xbcfa
movl -0x18(%rbp), %eax
andl $0x1f, %eax
orl $0x20, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl -0x14(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x14(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x2(%rax)
movl $0x3, -0x4(%rbp)
jmp 0xbd01
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/src/session_proto.cpp
// Function: proto_mark_data(unsigned char*, unsigned int)
int
proto_mark_data(unsigned char *buf, unsigned sid) {
   if (buf) {
      buf[0] = (PROTO_TYPE_DATA << _TYPE_OFFSET);
      buf[1] = (sid >> 8) & 0xff;
      buf[2] = (sid & 0xff);
      return 3;
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xbd57
movq -0x10(%rbp), %rax
movb $0x40, (%rax)
movl -0x14(%rbp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x14(%rbp), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x2(%rax)
movl $0x3, -0x4(%rbp)
jmp 0xbd5e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: xocoder[P]m_kcptun/src/conf_kcp.cpp
// Function: str_empty(char const*)
static bool
_str_empty(const char *str) {
   if (str==NULL || str[0]=='\0') {
      return true;
   } else {
      return false;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xcecb
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xced1
movb $0x1, -0x1(%rbp)
jmp 0xced5
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
popq %rbp
retq
nopl (%rax)
// File: xocoder[P]m_kcptun/src/kcp_local.cpp
// Function: main
int
main(int argc, const char *argv[]) {

   tun_local_t *tun = new tun_local_t;
   memset(tun, 0, sizeof(*tun));

   if ( tun ) {

      tun->conf = conf_create(argc, argv);
      if ( tun->conf ) {

         if ( _local_network_init(tun) ) {
            
            _local_network_runloop(tun);

            _local_network_fini(tun);
         }
         
         conf_release(tun->conf);
      }

      delete tun;
   }

   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x10098, %edi          # imm = 0x10098
callq 0x3310
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
movl $0x10098, %edx          # imm = 0x10098
callq 0x31c0
cmpq $0x0, -0x18(%rbp)
je 0xd3a8
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0xbd70
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x78(%rax)
je 0xd38a
movq -0x18(%rbp), %rdi
callq 0xd3b0
cmpl $0x0, %eax
je 0xd37d
movq -0x18(%rbp), %rdi
callq 0xd620
movq -0x18(%rbp), %rdi
callq 0xd850
movq -0x18(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0xcee0
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xd3a6
movq -0x20(%rbp), %rdi
movl $0x10098, %esi          # imm = 0x10098
callq 0x3330
jmp 0xd3a8
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
// File: xocoder[P]m_kcptun/src/kcp_local.cpp
// Function: local_network_fini(tun_local_t*)
static int
_local_network_fini(tun_local_t *tun) {
   if (tun && tun->is_init) {
      tmr_destroy_lst(tun->tmr);
      while (skt_count(tun->session_lst) > 0) {
         session_unit_t *u = (session_unit_t*)skt_first(tun->session_lst);
         mnet_chann_close(u->tcp);
         session_destroy(NULL, u);
      }
      skt_destroy(tun->session_lst);
      _local_kcpout_destroy(tun);
      rskcp_release(tun->rt);
      mnet_fini();
   }
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xd8eb
movq -0x8(%rbp), %rax
cmpl $0x0, 0x70(%rax)
je 0xd8eb
movq -0x8(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0xad00
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xb520
cmpl $0x0, %eax
jle 0xd8c0
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xb9c0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x7290
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0xe4d0
jmp 0xd881
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0xb470
movq -0x8(%rbp), %rdi
callq 0xe390
movq -0x8(%rbp), %rax
movq 0x90(%rax), %rdi
callq 0xe5f0
callq 0x6880
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/src/kcp_local.cpp
// Function: local_tcpin_listen(chann_msg_t*)
void
_local_tcpin_listen(chann_msg_t *e) {
   if (e->event == CHANN_EVENT_ACCEPT) {

      tun_local_t *tun = (tun_local_t*)e->opaque;
      if ( tun ) {

         // setup local session
         unsigned sid = ++tun->session_idx;
         session_unit_t *u = session_create(tun->session_lst, sid, e->r, tun);
         if ( u ) {
            mnet_chann_set_cb(e->r, _local_tcpin_callback, u);

            // open remote tcp
            unsigned char buf[16] = { 0 };
            if ( proto_mark_cmd(buf, sid, PROTO_CMD_OPEN) ) {
               ikcp_send(tun->kcpout, (const char*)buf, 16);
            }

            cout << "accept tcpin: " << e->r << ", sid " << sid << endl;
            return;
         }
      }

      mnet_chann_disconnect(e->r);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x3, (%rax)
jne 0xda1c
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xda0f
movq -0x10(%rbp), %rcx
movl 0x58(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x58(%rcx)
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x14(%rbp), %esi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x10(%rbp), %rcx
callq 0xe3d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xda0d
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rdx
leaq 0x3d2(%rip), %rsi       # 0xdd50
callq 0x7950
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x31c0
leaq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
movl $0x1, %edx
callq 0xbca0
cmpl $0x0, %eax
je 0xd9bf
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq -0x30(%rbp), %rsi
movl $0x10, %edx
callq 0x4420
movq 0xa60a(%rip), %rdi      # 0x17fd0
leaq 0x65a1(%rip), %rsi      # 0x13f6e
callq 0x32f0
movq %rax, %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x3270
movq %rax, %rdi
leaq 0x6591(%rip), %rsi      # 0x13f7d
callq 0x32f0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x3440
movq %rax, %rdi
movq 0xa5ba(%rip), %rsi      # 0x17fc0
callq 0x3340
jmp 0xda1c
jmp 0xda0f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x7860
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/src/kcp_local.cpp
// Function: local_udpout_create(tun_local_t*)
static int
_local_udpout_create(tun_local_t *tun) {
   for (int i=0; i<tun->conf->src_count; i++) {
      tun->udpout[i] = mnet_chann_open(CHANN_TYPE_DGRAM);
      if (tun->udpout[i] == NULL) {
         cerr << "Fail to create udp out !" << endl;
         return 0;
      }

      mnet_chann_set_cb(tun->udpout[i], _local_udpout_callback, tun);
      if (mnet_chann_connect(tun->udpout[i], tun->conf->dest_ip[i], tun->conf->dest_port[i]) <= 0) {
         cerr << "Fail to connect to udp out !" << endl;
         return 0;
      }

      mnet_chann_set_bufsize(tun->udpout[i], 512*1024);
   }
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
movq 0x78(%rcx), %rcx
cmpl (%rcx), %eax
jge 0xdb5f
movl $0x2, %edi
callq 0x71b0
movq %rax, %rdx
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, 0x8(%rax,%rcx,8)
jne 0xdaae
movq 0xa569(%rip), %rdi      # 0x17ff0
leaq 0x6528(%rip), %rsi      # 0x13fb6
callq 0x32f0
movq %rax, %rdi
movq 0xa523(%rip), %rsi      # 0x17fc0
callq 0x3340
movl $0x0, -0x4(%rbp)
jmp 0xdb66
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rdx
leaq 0x49a(%rip), %rsi       # 0xdf60
callq 0x7950
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rsi
addq $0x98, %rsi
movslq -0x14(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movslq -0x14(%rbp), %rcx
movl 0x118(%rax,%rcx,4), %edx
callq 0x7300
cmpl $0x0, %eax
jg 0xdb3a
movq 0xa4da(%rip), %rdi      # 0x17ff0
leaq 0x64b2(%rip), %rsi      # 0x13fcf
callq 0x32f0
movq %rax, %rdi
movq 0xa494(%rip), %rsi      # 0x17fc0
callq 0x3340
movl $0x0, -0x4(%rbp)
jmp 0xdb66
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movl $0x80000, %esi          # imm = 0x80000
callq 0x8110
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xda43
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: xocoder[P]m_kcptun/src/kcp_local.cpp
// Function: local_kcpout_create(tun_local_t*)
static int
_local_kcpout_create(tun_local_t *tun) {
   ikcp_allocator(kcp_malloc, kcp_free);

   IUINT32 iconv = _local_gen_kcpconv();
   cout << "using kcp_conv " << iconv  << endl;
   
   tun->kcpout = ikcp_create(iconv, tun);
   if (tun->kcpout == NULL) {
      cerr << "Fail to create kcp out !" << endl;
      return 0;
   }

   ikcp_setoutput(tun->kcpout, _local_kcpout_callback);
   ikcp_nodelay(tun->kcpout, tun->conf->nodelay, tun->conf->interval, tun->conf->resend, tun->conf->nc);
   ikcp_wndsize(tun->kcpout, tun->conf->snd_wndsize, tun->conf->rcv_wndsize);
   ikcp_setmtu(tun->kcpout, tun->conf->mtu);

   if (tun->conf->fast == 3) {
      tun->kcpout->rx_minrto = 20;
   } else if (tun->conf->fast == 2) {
      tun->kcpout->rx_minrto = 40;
   }
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
leaq -0xc63(%rip), %rdi      # 0xcf20
leaq -0xc3a(%rip), %rsi      # 0xcf50
callq 0x3750
callq 0xe170
movl %eax, -0x14(%rbp)
movq 0xa432(%rip), %rdi      # 0x17fd0
leaq 0x645e(%rip), %rsi      # 0x14003
callq 0x32f0
movq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x3440
movq %rax, %rdi
movq 0xa401(%rip), %rsi      # 0x17fc0
callq 0x3340
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3890
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0xdc14
movq 0xa403(%rip), %rdi      # 0x17ff0
leaq 0x641f(%rip), %rsi      # 0x14013
callq 0x32f0
movq %rax, %rdi
movq 0xa3bd(%rip), %rsi      # 0x17fc0
callq 0x3340
movl $0x0, -0x4(%rbp)
jmp 0xdcfd
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
leaq 0x56d(%rip), %rsi       # 0xe190
callq 0x3f50
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x130(%rax), %esi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x134(%rax), %edx
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x138(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x13c(%rax), %r8d
callq 0x6520
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x12c(%rax), %esi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x128(%rax), %edx
callq 0x65c0
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl 0x140(%rax), %esi
callq 0x6440
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
cmpl $0x3, 0x144(%rax)
jne 0xdcd4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl $0x14, 0x34(%rax)
jmp 0xdcf6
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
cmpl $0x2, 0x144(%rax)
jne 0xdcf4
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl $0x28, 0x34(%rax)
jmp 0xdcf6
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/src/session_mgnt.cpp
// Function: session_create(s_skt*, unsigned int, s_mchann*, void*)
session_unit_t*
session_create(skt_t *lst, unsigned sid, chann_t *tcp, void *opaque) {
   if (lst && tcp) {
      session_unit_t *u = (session_unit_t*)malloc(sizeof(*u));
      if (u) {
         u->sid = sid;
         u->tcp = tcp;
         u->opaque = opaque;
         u->connected = 0;
         if ( skt_insert(lst, sid, u) ) {
            return u;
         }
         free(u); // fail to insert
      }
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xe463
cmpq $0x0, -0x20(%rbp)
je 0xe463
movl $0x20, %edi
callq 0x3430
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xe461
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
movq -0x30(%rbp), %rdx
callq 0xb5e0
cmpq $0x0, %rax
je 0xe458
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xe46b
movq -0x30(%rbp), %rdi
callq 0x33d0
jmp 0xe463
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xocoder[P]m_kcptun/src/session_mgnt.cpp
// Function: session_find_sid(s_skt*, unsigned int)
session_unit_t*
session_find_sid(skt_t *lst, unsigned sid) {
   session_unit_t *u = (session_unit_t*)skt_query(lst, sid);
   if (u && u->sid == sid) {
      return u;
   }
   return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xb550
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe4bd
movq -0x20(%rbp), %rax
movl (%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0xe4bd
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xe4c5
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: xocoder[P]m_kcptun/src/session_mgnt.cpp
// Function: session_destroy(s_skt*, session_unit_t*)
void
session_destroy(skt_t *lst, session_unit_t *u) {
   if (lst && u) {
      skt_remove(lst, u->sid);
   }
   if ( u ) {
      memset(u, 0, sizeof(*u));
      free(u);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xe4ff
cmpq $0x0, -0x10(%rbp)
je 0xe4ff
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0xb810
cmpq $0x0, -0x10(%rbp)
je 0xe51f
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x31c0
movq -0x10(%rbp), %rdi
callq 0x33d0
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
nopl (%rax,%rax)
// File: xocoder[P]m_kcptun/src/rs_kcp.cpp
// Function: rskcp_create(int, int)
rskcp_t*
rskcp_create(int data_bytes, int parity_bytes) {
   if ( cm256_init() ) {
      return (rskcp_t*)0;
   }

   rskcp_t *rt = (rskcp_t*)mm_malloc(sizeof(rskcp_t));
   if (rt) {
      cm256_encoder_params p = { data_bytes, parity_bytes, 1 };
      rt->param = p;
      for (int i=0; i<(data_bytes + parity_bytes); i++) {
         rt->blocks[i].Index = i;
      }
   }
   return rt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl $0x2, %edi
callq 0xe9c0
cmpl $0x0, %eax
je 0xe55a
movq $0x0, -0x8(%rbp)
jmp 0xe5e3
movl $0x1010, %edi           # imm = 0x1010
leaq 0x5b25(%rip), %rsi      # 0x1408b
movl $0x1d, %edx
callq 0x9aa0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xe5db
movl -0xc(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x1, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movq -0x24(%rbp), %rcx
movq %rcx, (%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x8(%rax)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl -0xc(%rbp), %ecx
addl -0x10(%rbp), %ecx
cmpl %ecx, %eax
jge 0xe5d9
movl -0x28(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
addq $0x10, %rax
movslq -0x28(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movb %cl, 0x8(%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xe5a6
jmp 0xe5db
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: xocoder[P]m_kcptun/src/rs_kcp.cpp
// Function: rskcp_enc_info(s_rskcp*, int, int*)
int
rskcp_enc_info(rskcp_t *rt, int raw_len, int *parity_len) {
   if (!rt || raw_len<=0 || !parity_len) {
      return 0;
   }

   cm256_encoder_params *p = &rt->param;
   int di=0, pi=0;
   do {
      di += p->OriginalCount;
      pi += p->RecoveryCount;
   } while (di < raw_len);

   *parity_len = pi;
   return di;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xe643
cmpl $0x0, -0x14(%rbp)
jle 0xe643
cmpq $0x0, -0x20(%rbp)
jne 0xe64c
movl $0x0, -0x4(%rbp)
jmp 0xe692
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jl 0xe662
movl -0x30(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x2c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: xocoder[P]m_kcptun/src/rs_kcp.cpp
// Function: rskcp_dec_info(s_rskcp*, int)
int
rskcp_dec_info(rskcp_t *rt, int data_len) {
   if (!rt || data_len<=0) {
      return 0;
   }

   cm256_encoder_params *p = &rt->param;
   int di=0, pi=0;
   do {
      di += p->OriginalCount;
      pi += p->RecoveryCount;
   } while (data_len < di + pi);

   return di;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xe6b8
cmpl $0x0, -0x14(%rbp)
jg 0xe6c1
movl $0x0, -0x4(%rbp)
jmp 0xe703
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl -0x24(%rbp), %ecx
addl -0x28(%rbp), %ecx
cmpl %ecx, %eax
jl 0xe6d7
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: xocoder[P]m_kcptun/src/rs_kcp.cpp
// Function: rskcp_encode(s_rskcp*, unsigned char*, int, unsigned char*)
int
rskcp_encode(rskcp_t *rt, unsigned char *raw, int raw_len, unsigned char *parity) {
   if (!rt || !raw_len || raw_len<=0 || !parity) {
      return 0;
   }

   cm256_encoder_params *p = &rt->param;
   cm256_block *blocks = rt->blocks;
   int ri=0, pi=0, ret=0;
   
   do {
      _rskcp_fill_blocks(blocks, &raw[ri], p->OriginalCount);

      ret = cm256_encode(*p, blocks, &parity[pi]);
      if ( !ret ) {
         ri += p->OriginalCount;
         pi += p->RecoveryCount;
      }
   } while (!ret && raw_len<ri);

   return !ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xe741
cmpl $0x0, -0x1c(%rbp)
je 0xe741
cmpl $0x0, -0x1c(%rbp)
jle 0xe741
cmpq $0x0, -0x28(%rbp)
jne 0xe74d
movl $0x0, -0x4(%rbp)
jmp 0xe821
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x30(%rbp), %rax
movl (%rax), %edx
callq 0xe830
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
movslq -0x40(%rbp), %rax
addq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x60(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0xebe0
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0xe7ec
movq -0x30(%rbp), %rax
movl (%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0xe7ee
xorl %eax, %eax
cmpl $0x0, -0x44(%rbp)
movb %al, -0x61(%rbp)
jne 0xe805
movl -0x1c(%rbp), %eax
cmpl -0x3c(%rbp), %eax
setl %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0xe776
cmpl $0x0, -0x44(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: xocoder[P]m_kcptun/src/rs_kcp.cpp
// Function: rskcp_decode(s_rskcp*, unsigned char*, int, unsigned char*)
int
rskcp_decode(rskcp_t *rt, unsigned char *data, int data_len, unsigned char *parity) {
   if (!rt || !data || data_len<=0 || !parity) {
      return 0;
   }

   cm256_encoder_params *p = &rt->param;
   cm256_block *blocks = rt->blocks;
   int di=0, pi=0, ret=0;
   
   do {
      _rskcp_fill_blocks(blocks, &data[di], p->OriginalCount);
      _rskcp_fill_blocks(blocks + p->OriginalCount, &parity[pi], p->RecoveryCount);
      
      ret = cm256_decode(*p, blocks);
      if ( !ret ) {
         di += p->OriginalCount;
         pi += p->RecoveryCount;
      }
   } while (!ret && data_len<di+pi);
   
   return !ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xe8b2
cmpq $0x0, -0x18(%rbp)
je 0xe8b2
cmpl $0x0, -0x1c(%rbp)
jle 0xe8b2
cmpq $0x0, -0x28(%rbp)
jne 0xe8be
movl $0x0, -0x4(%rbp)
jmp 0xe9b5
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x3c(%rbp), %rax
addq %rax, %rsi
movq -0x30(%rbp), %rax
movl (%rax), %edx
callq 0xe830
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rax
movslq (%rax), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movslq -0x40(%rbp), %rax
addq %rax, %rsi
movq -0x30(%rbp), %rax
movl 0x4(%rax), %edx
callq 0xe830
movq -0x30(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x48(%rbp)
movq -0x38(%rbp), %rdx
movq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x60(%rbp), %rdi
movl -0x58(%rbp), %esi
callq 0xfd10
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0xe97b
movq -0x30(%rbp), %rax
movl (%rax), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0xe97d
xorl %eax, %eax
cmpl $0x0, -0x44(%rbp)
movb %al, -0x61(%rbp)
jne 0xe999
movl -0x1c(%rbp), %eax
movl -0x3c(%rbp), %ecx
addl -0x40(%rbp), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0xe8e7
cmpl $0x0, -0x44(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nop
// File: xocoder[P]m_kcptun/vendor/cm256/cm256.cpp
// Function: cm256_encode
int cm256_encode(
    cm256_encoder_params params, // Encoder params
    cm256_block* originals,      // Array of pointers to original blocks
    void* recoveryBlocks)        // Output recovery blocks end-to-end
{
    // Validate input:
    if (params.OriginalCount <= 0 ||
        params.RecoveryCount <= 0 ||
        params.BlockBytes <= 0)
    {
        return -1;
    }
    if (params.OriginalCount + params.RecoveryCount > 256)
    {
        return -2;
    }
    if (!originals || !recoveryBlocks)
    {
        return -3;
    }

    uint8_t* recoveryBlock = static_cast<uint8_t*>(recoveryBlocks);

    for (int block = 0; block < params.RecoveryCount; ++block, recoveryBlock += params.BlockBytes)
    {
        cm256_encode_block(params, originals, (params.OriginalCount + block), recoveryBlock);
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x20(%rbp)
movl %esi, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x8(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
cmpl $0x0, -0x10(%rbp)
jle 0xec17
cmpl $0x0, -0xc(%rbp)
jle 0xec17
cmpl $0x0, -0x8(%rbp)
jg 0xec23
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xecc3
movl -0x10(%rbp), %eax
addl -0xc(%rbp), %eax
cmpl $0x100, %eax            # imm = 0x100
jle 0xec3c
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xecc3
cmpq $0x0, -0x28(%rbp)
je 0xec4a
cmpq $0x0, -0x30(%rbp)
jne 0xec53
movl $0xfffffffd, -0x4(%rbp) # imm = 0xFFFFFFFD
jmp 0xecc3
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xecbc
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rdx
movl -0x10(%rbp), %ecx
addl -0x3c(%rbp), %ecx
movq -0x38(%rbp), %r8
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x40(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x58(%rbp), %rdi
movl -0x50(%rbp), %esi
callq 0xe9f0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x8(%rbp), %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
jmp 0xec62
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)