LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_shutdown
err_t
tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("tcp_shutdown: invalid pcb", pcb != NULL, return ERR_ARG);

  if (pcb->state == LISTEN) {
    return ERR_CONN;
  }
  if (shut_rx) {
    /* shut down the receive side: set a flag not to receive any more data... */
    tcp_set_flags(pcb, TF_RXCLOSED);
    if (shut_tx) {
      /* shutting down the tx AND rx side is the same as closing for the raw API */
      return tcp_close_shutdown(pcb, 1);
    }
    /* ... and free buffered data */
    if (pcb->refused_data != NULL) {
      pbuf_free(pcb->refused_data);
      pcb->refused_data = NULL;
    }
  }
  if (shut_tx) {
    /* This can't happen twice since if it succeeds, the pcb's state is changed.
       Only close in these states as the others directly deallocate the PCB */
    switch (pcb->state) {
      case SYN_RCVD:
      case ESTABLISHED:
      case CLOSE_WAIT:
        return tcp_close_shutdown(pcb, (u8_t)shut_rx);
      default:
        /* Not (yet?) connected, cannot shutdown the TX side as that would bring us
          into CLOSED state, where the PCB is deallocated. */
        return ERR_CONN;
    }
  }
  return ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7236
movq %rdi, %r14
movb $-0xb, %bl
cmpl $0x1, 0x48(%rdi)
jne 0x71d2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %r15d
movl %esi, %ebp
testl %esi, %esi
je 0x7203
orb $0x10, 0x52(%r14)
movb $0x1, %al
testl %r15d, %r15d
jne 0x721d
movq 0xc0(%r14), %rdi
testq %rdi, %rdi
je 0x7203
callq 0x5069
movq $0x0, 0xc0(%r14)
testl %r15d, %r15d
je 0x7232
movl 0x48(%r14), %eax
cmpl $0x7, %eax
ja 0x71c5
movl $0x98, %ecx
btl %eax, %ecx
jae 0x71c5
movl %ebp, %eax
movzbl %al, %esi
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6fa8
xorl %ebx, %ebx
jmp 0x71c5
leaq 0xe08f(%rip), %rdi      # 0x152cc
leaq 0xea8c(%rip), %rsi      # 0x15cd0
leaq 0xea54(%rip), %rcx      # 0x15c9f
movl $0x207, %edx            # imm = 0x207
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_pcb_remove
void
tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
{
  LWIP_ASSERT("tcp_pcb_remove: invalid pcb", pcb != NULL);
  LWIP_ASSERT("tcp_pcb_remove: invalid pcblist", pcblist != NULL);

  TCP_RMV(pcblist, pcb);

  tcp_pcb_purge(pcb);

  /* if there is an outstanding delayed ACKs, send it */
  if ((pcb->state != TIME_WAIT) &&
      (pcb->state != LISTEN) &&
      (pcb->flags & TF_ACK_DELAY)) {
    tcp_ack_now(pcb);
    tcp_output(pcb);
  }

  if (pcb->state != LISTEN) {
    LWIP_ASSERT("unsent segments leaking", pcb->unsent == NULL);
    LWIP_ASSERT("unacked segments leaking", pcb->unacked == NULL);
#if TCP_QUEUE_OOSEQ
    LWIP_ASSERT("ooseq segments leaking", pcb->ooseq == NULL);
#endif /* TCP_QUEUE_OOSEQ */
  }

  pcb->state = CLOSED;
  /* reset the local port to prevent the pcb from being 'bound' */
  pcb->local_port = 0;

  LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
}

// Assembly:
pushq %rbx
testq %rsi, %rsi
je 0x74e9
testq %rdi, %rdi
je 0x7505
movq %rsi, %rbx
movq (%rdi), %rax
cmpq %rsi, %rax
je 0x7473
testq %rax, %rax
je 0x747a
movq %rax, %rdi
movq 0x38(%rax), %rax
cmpq %rbx, %rax
jne 0x745b
addq $0x38, %rdi
movq %rbx, %rax
movq 0x38(%rax), %rax
movq %rax, (%rdi)
movq $0x0, 0x38(%rbx)
movq %rbx, %rdi
callq 0x7fc6
movl 0x48(%rbx), %eax
cmpl $0x1, %eax
je 0x74ae
cmpl $0xa, %eax
je 0x74ae
movzwl 0x52(%rbx), %eax
testb $0x1, %al
je 0x74ae
orl $0x2, %eax
movw %ax, 0x52(%rbx)
movq %rbx, %rdi
callq 0xbfab
cmpl $0x1, 0x48(%rbx)
je 0x74d6
cmpq $0x0, 0xa8(%rbx)
jne 0x7521
cmpq $0x0, 0xb0(%rbx)
jne 0x753d
cmpq $0x0, 0xb8(%rbx)
jne 0x7559
movl $0x0, 0x48(%rbx)
movw $0x0, 0x4e(%rbx)
popq %rbx
jmp 0x871e
leaq 0xdddc(%rip), %rdi      # 0x152cc
leaq 0xecb0(%rip), %rsi      # 0x161a7
leaq 0xe7a1(%rip), %rcx      # 0x15c9f
movl $0x883, %edx            # imm = 0x883
jmp 0x7573
leaq 0xddc0(%rip), %rdi      # 0x152cc
leaq 0xecb0(%rip), %rsi      # 0x161c3
leaq 0xe785(%rip), %rcx      # 0x15c9f
movl $0x884, %edx            # imm = 0x884
jmp 0x7573
leaq 0xdda4(%rip), %rdi      # 0x152cc
leaq 0xecb4(%rip), %rsi      # 0x161e3
leaq 0xe769(%rip), %rcx      # 0x15c9f
movl $0x893, %edx            # imm = 0x893
jmp 0x7573
leaq 0xdd88(%rip), %rdi      # 0x152cc
leaq 0xecb0(%rip), %rsi      # 0x161fb
leaq 0xe74d(%rip), %rcx      # 0x15c9f
movl $0x894, %edx            # imm = 0x894
jmp 0x7573
leaq 0xdd6c(%rip), %rdi      # 0x152cc
leaq 0xecad(%rip), %rsi      # 0x16214
leaq 0xe731(%rip), %rcx      # 0x15c9f
movl $0x896, %edx            # imm = 0x896
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_segs_free
void
tcp_segs_free(struct tcp_seg *seg)
{
  while (seg != NULL) {
    struct tcp_seg *next = seg->next;
    tcp_seg_free(seg);
    seg = next;
  }
}

// Assembly:
testq %rdi, %rdi
je 0x759d
pushq %rbx
movq (%rdi), %rbx
callq 0x828a
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x758c
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_new_port
static u16_t
tcp_new_port(void)
{
  u8_t i;
  u16_t n = 0;
  struct tcp_pcb *pcb;

again:
  tcp_port++;
  if (tcp_port == TCP_LOCAL_PORT_RANGE_END) {
    tcp_port = TCP_LOCAL_PORT_RANGE_START;
  }
  /* Check all PCB lists. */
  for (i = 0; i < NUM_TCP_PCB_LISTS; i++) {
    for (pcb = *tcp_pcb_lists[i]; pcb != NULL; pcb = pcb->next) {
      if (pcb->local_port == tcp_port) {
        n++;
        if (n > (TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START)) {
          return 0;
        }
        goto again;
      }
    }
  }
  return tcp_port;
}

// Assembly:
movzwl 0x158db(%rip), %ecx     # 0x1d148
xorl %eax, %eax
movl $0xc000, %edx           # imm = 0xC000
leaq 0x154e5(%rip), %rsi     # 0x1cd60
incl %ecx
cmpw $-0x1, %cx
cmovel %edx, %ecx
xorl %edi, %edi
movq (%rsi,%rdi,8), %r8
movq (%r8), %r8
testq %r8, %r8
je 0x789f
cmpw %cx, 0x4e(%r8)
je 0x78aa
movq 0x38(%r8), %r8
jmp 0x788d
incq %rdi
cmpq $0x4, %rdi
jne 0x7886
jmp 0x78bb
incl %eax
movzwl %ax, %edi
cmpl $0x4000, %edi           # imm = 0x4000
jne 0x787b
xorl %eax, %eax
jmp 0x78bd
movl %ecx, %eax
movw %cx, 0x15884(%rip)      # 0x1d148
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_accept_null
static err_t
tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
{
  LWIP_UNUSED_ARG(arg);
  LWIP_UNUSED_ARG(err);

  LWIP_ASSERT("tcp_accept_null: invalid pcb", pcb != NULL);

  tcp_abort(pcb);

  return ERR_ABRT;
}

// Assembly:
pushq %rax
testq %rsi, %rsi
je 0x7a7b
movq %rsi, %rdi
movl $0x1, %esi
callq 0x7263
movb $-0xd, %al
popq %rcx
retq
leaq 0xd84a(%rip), %rdi      # 0x152cc
leaq 0xe8c3(%rip), %rsi      # 0x1634c
leaq 0xe20f(%rip), %rcx      # 0x15c9f
movl $0x30f, %edx            # imm = 0x30F
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_update_rcv_ann_wnd
u32_t
tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb)
{
  u32_t new_right_edge;

  LWIP_ASSERT("tcp_update_rcv_ann_wnd: invalid pcb", pcb != NULL);
  new_right_edge = pcb->rcv_nxt + pcb->rcv_wnd;

  if (TCP_SEQ_GEQ(new_right_edge, pcb->rcv_ann_right_edge + LWIP_MIN((TCP_WND / 2), pcb->mss))) {
    /* we can advertise more window */
    pcb->rcv_ann_wnd = pcb->rcv_wnd;
    return new_right_edge - pcb->rcv_ann_right_edge;
  } else {
    if (TCP_SEQ_GT(pcb->rcv_nxt, pcb->rcv_ann_right_edge)) {
      /* Can happen due to other end sending out of advertised window,
       * but within actual available (but not yet advertised) window */
      pcb->rcv_ann_wnd = 0;
    } else {
      /* keep the right edge of window constant */
      u32_t new_rcv_ann_wnd = pcb->rcv_ann_right_edge - pcb->rcv_nxt;
#if !LWIP_WND_SCALE
      LWIP_ASSERT("new_rcv_ann_wnd <= 0xffff", new_rcv_ann_wnd <= 0xffff);
#endif
      pcb->rcv_ann_wnd = (tcpwnd_size_t)new_rcv_ann_wnd;
    }
    return 0;
  }
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x7aff
movl 0x5c(%rdi), %edx
movl 0x64(%rdi), %ecx
movzwl 0x60(%rdi), %esi
leal (%rdx,%rsi), %eax
movzwl 0x6a(%rdi), %r8d
movl $0x4000, %r9d           # imm = 0x4000
cmpl %r9d, %r8d
cmovbl %r8d, %r9d
addl %ecx, %r9d
cmpl %r9d, %eax
js 0x7add
movw %si, 0x62(%rdi)
subl %ecx, %eax
jmp 0x7afd
movl %edx, %eax
subl %ecx, %eax
testl %eax, %eax
jle 0x7aed
movw $0x0, 0x62(%rdi)
jmp 0x7afb
subl %edx, %ecx
cmpl $0x10000, %ecx          # imm = 0x10000
jae 0x7b2c
movw %cx, 0x62(%rdi)
xorl %eax, %eax
popq %rcx
retq
leaq 0xd7c6(%rip), %rdi      # 0x152cc
leaq 0xe2c9(%rip), %rsi      # 0x15dd6
leaq 0xe18b(%rip), %rcx      # 0x15c9f
movl $0x3a6, %edx            # imm = 0x3A6
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
leaq 0xd799(%rip), %rdi      # 0x152cc
leaq 0xe2c0(%rip), %rsi      # 0x15dfa
leaq 0xe15e(%rip), %rcx      # 0x15c9f
movl $0x3b6, %edx            # imm = 0x3B6
jmp 0x7b19
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_recved
void
tcp_recved(struct tcp_pcb *pcb, u16_t len)
{
  u32_t wnd_inflation;
  tcpwnd_size_t rcv_wnd;

  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("tcp_recved: invalid pcb", pcb != NULL, return);

  /* pcb->state LISTEN not allowed here */
  LWIP_ASSERT("don't call tcp_recved for listen-pcbs",
              pcb->state != LISTEN);

  rcv_wnd = (tcpwnd_size_t)(pcb->rcv_wnd + len);
  if ((rcv_wnd > TCP_WND_MAX(pcb)) || (rcv_wnd < pcb->rcv_wnd)) {
    /* window got too big or tcpwnd_size_t overflow */
    LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: window got too big or tcpwnd_size_t overflow\n"));
    pcb->rcv_wnd = TCP_WND_MAX(pcb);
  } else  {
    pcb->rcv_wnd = rcv_wnd;
  }

  wnd_inflation = tcp_update_rcv_ann_wnd(pcb);

  /* If the change in the right edge of window is significant (default
   * watermark is TCP_WND/4), then send an explicit update now.
   * Otherwise wait for a packet to be sent in the normal course of
   * events (or more window to be available later) */
  if (wnd_inflation >= TCP_WND_UPDATE_THRESHOLD) {
    tcp_ack_now(pcb);
    tcp_output(pcb);
  }

  LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: received %"U16_F" bytes, wnd %"TCPWNDSIZE_F" (%"TCPWNDSIZE_F").\n",
                          len, pcb->rcv_wnd, (u16_t)(TCP_WND_MAX(pcb) - pcb->rcv_wnd)));
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7b93
movq %rdi, %rbx
cmpl $0x1, 0x48(%rdi)
je 0x7baf
movzwl 0x60(%rbx), %eax
leal (%rsi,%rax), %ecx
movzwl %cx, %edx
movl $0x8000, %edi           # imm = 0x8000
cmpl %edi, %edx
cmovael %edi, %ecx
addw %ax, %si
cmovbl %edi, %ecx
movw %cx, 0x60(%rbx)
movq %rbx, %rdi
callq 0x7aa8
cmpl $0x16d0, %eax           # imm = 0x16D0
jb 0x7b91
orb $0x2, 0x52(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0xbfab
popq %rbx
retq
leaq 0xd732(%rip), %rdi      # 0x152cc
leaq 0xe273(%rip), %rsi      # 0x15e14
leaq 0xe0f7(%rip), %rcx      # 0x15c9f
movl $0x3cf, %edx            # imm = 0x3CF
jmp 0x7bc9
leaq 0xd716(%rip), %rdi      # 0x152cc
leaq 0xe26f(%rip), %rsi      # 0x15e2c
leaq 0xe0db(%rip), %rcx      # 0x15c9f
movl $0x3d3, %edx            # imm = 0x3D3
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_next_iss
u32_t
tcp_next_iss(struct tcp_pcb *pcb)
{
#ifdef LWIP_HOOK_TCP_ISN
  LWIP_ASSERT("tcp_next_iss: invalid pcb", pcb != NULL);
  return LWIP_HOOK_TCP_ISN(&pcb->local_ip, pcb->local_port, &pcb->remote_ip, pcb->remote_port);
#else /* LWIP_HOOK_TCP_ISN */
  static u32_t iss = 6510;

  LWIP_ASSERT("tcp_next_iss: invalid pcb", pcb != NULL);
  LWIP_UNUSED_ARG(pcb);

  iss += tcp_ticks;       /* XXX */
  return iss;
#endif /* LWIP_HOOK_TCP_ISN */
}

// Assembly:
testq %rdi, %rdi
je 0x7ed3
movl 0x15286(%rip), %eax     # 0x1d14c
addl 0x15a50(%rip), %eax     # 0x1d91c
movl %eax, 0x1527a(%rip)     # 0x1d14c
retq
pushq %rax
leaq 0xd3f1(%rip), %rdi      # 0x152cc
leaq 0xe349(%rip), %rsi      # 0x1622b
leaq 0xddb6(%rip), %rcx      # 0x15c9f
movl $0x8af, %edx            # imm = 0x8AF
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_free_ooseq
void
tcp_free_ooseq(struct tcp_pcb *pcb)
{
  if (pcb->ooseq) {
    tcp_segs_free(pcb->ooseq);
    pcb->ooseq = NULL;
#if LWIP_TCP_SACK_OUT
    memset(pcb->rcv_sacks, 0, sizeof(pcb->rcv_sacks));
#endif /* LWIP_TCP_SACK_OUT */
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xb8(%rdi), %rdi
testq %rdi, %rdi
je 0x7fbe
movq (%rdi), %r14
callq 0x828a
movq %r14, %rdi
testq %r14, %r14
jne 0x7fa3
movq $0x0, 0xb8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_pcb_purge
void
tcp_pcb_purge(struct tcp_pcb *pcb)
{
  LWIP_ERROR("tcp_pcb_purge: invalid pcb", pcb != NULL, return);

  if (pcb->state != CLOSED &&
      pcb->state != TIME_WAIT &&
      pcb->state != LISTEN) {

    LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge\n"));

    tcp_backlog_accepted(pcb);

    if (pcb->refused_data != NULL) {
      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->refused_data\n"));
      pbuf_free(pcb->refused_data);
      pcb->refused_data = NULL;
    }
    if (pcb->unsent != NULL) {
      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: not all data sent\n"));
    }
    if (pcb->unacked != NULL) {
      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->unacked\n"));
    }
#if TCP_QUEUE_OOSEQ
    if (pcb->ooseq != NULL) {
      LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->ooseq\n"));
      tcp_free_ooseq(pcb);
    }
#endif /* TCP_QUEUE_OOSEQ */

    /* Stop the retransmission timer as it will expect data on unacked
       queue if it fires */
    pcb->rtime = -1;

    tcp_segs_free(pcb->unsent);
    tcp_segs_free(pcb->unacked);
    pcb->unacked = pcb->unsent = NULL;
#if TCP_OVERSIZE
    pcb->unsent_oversize = 0;
#endif /* TCP_OVERSIZE */
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x808b
movq %rdi, %rbx
movl 0x48(%rdi), %eax
cmpl $0xa, %eax
ja 0x7fed
movl $0x403, %ecx            # imm = 0x403
btl %eax, %ecx
jb 0x8085
movq 0xc0(%rbx), %rdi
testq %rdi, %rdi
je 0x8009
callq 0x5069
movq $0x0, 0xc0(%rbx)
movq 0xb8(%rbx), %rdi
testq %rdi, %rdi
je 0x8030
movq (%rdi), %r14
callq 0x828a
movq %r14, %rdi
testq %r14, %r14
jne 0x8015
movq $0x0, 0xb8(%rbx)
movw $0xffff, 0x68(%rbx)     # imm = 0xFFFF
movq 0xa8(%rbx), %rdi
testq %rdi, %rdi
je 0x8052
movq (%rdi), %r14
callq 0x828a
movq %r14, %rdi
testq %r14, %r14
jne 0x8042
leaq 0xa8(%rbx), %r14
movq 0xb0(%rbx), %rdi
testq %rdi, %rdi
je 0x8075
movq (%rdi), %r15
callq 0x828a
movq %r15, %rdi
testq %r15, %r15
jne 0x8065
movw $0x0, 0xa0(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
popq %rbx
popq %r14
popq %r15
retq
leaq 0xd23a(%rip), %rdi      # 0x152cc
leaq 0xe0f3(%rip), %rsi      # 0x1618c
leaq 0xdbff(%rip), %rcx      # 0x15c9f
movl $0x851, %edx            # imm = 0x851
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_txnow
void
tcp_txnow(void)
{
  struct tcp_pcb *pcb;

  for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
    if (pcb->flags & TF_NAGLEMEMERR) {
      tcp_output(pcb);
    }
  }
}

// Assembly:
pushq %rbx
movq 0x1570c(%rip), %rbx     # 0x1d908
testq %rbx, %rbx
je 0x8215
testb $-0x80, 0x52(%rbx)
je 0x820f
movq %rbx, %rdi
callq 0xbfab
movq 0x38(%rbx), %rbx
jmp 0x81fc
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_recv_null
err_t
tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
  LWIP_UNUSED_ARG(arg);

  LWIP_ERROR("tcp_recv_null: invalid pcb", pcb != NULL, return ERR_ARG);

  if (p != NULL) {
    tcp_recved(pcb, p->tot_len);
    pbuf_free(p);
  } else if (err == ERR_OK) {
    return tcp_close(pcb);
  }
  return ERR_OK;
}

// Assembly:
pushq %rbx
testq %rsi, %rsi
je 0x825d
movq %rdx, %rbx
testq %rdx, %rdx
je 0x823d
movzwl 0x10(%rbx), %eax
movq %rsi, %rdi
movl %eax, %esi
callq 0x7b48
movq %rbx, %rdi
callq 0x5069
jmp 0x8241
testb %cl, %cl
je 0x8245
xorl %eax, %eax
popq %rbx
retq
cmpl $0x1, 0x48(%rsi)
je 0x824f
orb $0x10, 0x52(%rsi)
movq %rsi, %rdi
movl $0x1, %esi
popq %rbx
jmp 0x6fa8
leaq 0xd068(%rip), %rdi      # 0x152cc
leaq 0xde5e(%rip), %rsi      # 0x160c9
leaq 0xda2d(%rip), %rcx      # 0x15c9f
movl $0x698, %edx            # imm = 0x698
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_seg_free
void
tcp_seg_free(struct tcp_seg *seg)
{
  if (seg != NULL) {
    if (seg->p != NULL) {
      pbuf_free(seg->p);
#if TCP_DEBUG
      seg->p = NULL;
#endif /* TCP_DEBUG */
    }
    memp_free(MEMP_TCP_SEG, seg);
  }
}

// Assembly:
testq %rdi, %rdi
je 0x82b7
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x82a9
callq 0x5069
movq $0x0, 0x8(%rbx)
movl $0x4, %edi
movq %rbx, %rsi
popq %rbx
jmp 0x3d28
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_seg_copy
struct tcp_seg *
tcp_seg_copy(struct tcp_seg *seg)
{
  struct tcp_seg *cseg;

  LWIP_ASSERT("tcp_seg_copy: invalid seg", seg != NULL);

  cseg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG);
  if (cseg == NULL) {
    return NULL;
  }
  SMEMCPY((u8_t *)cseg, (const u8_t *)seg, sizeof(struct tcp_seg));
  pbuf_ref(cseg->p);
  return cseg;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8336
movq %rdi, %r14
movl $0x4, %edi
callq 0x3c9e
testq %rax, %rax
je 0x8329
movq %rax, %rbx
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm0, (%rax)
movups %xmm1, 0x10(%rax)
movq 0x8(%rax), %rdi
callq 0x5434
jmp 0x832b
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xcf8f(%rip), %rdi      # 0x152cc
leaq 0xdd6b(%rip), %rsi      # 0x160af
leaq 0xd954(%rip), %rcx      # 0x15c9f
movl $0x682, %edx            # imm = 0x682
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_kill_state
static void
tcp_kill_state(enum tcp_state state)
{
  struct tcp_pcb *pcb, *inactive;
  u32_t inactivity;

  LWIP_ASSERT("invalid state", (state == CLOSING) || (state == LAST_ACK));

  inactivity = 0;
  inactive = NULL;
  /* Go through the list of active pcbs and get the oldest pcb that is in state
     CLOSING/LAST_ACK. */
  for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
    if (pcb->state == state) {
      if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) {
        inactivity = tcp_ticks - pcb->tmr;
        inactive = pcb;
      }
    }
  }
  if (inactive != NULL) {
    LWIP_DEBUGF(TCP_DEBUG, ("tcp_kill_closing: killing oldest %s PCB %p (%"S32_F")\n",
                            tcp_state_str[state], (void *)inactive, inactivity));
    /* Don't send a RST, since no data is lost. */
    tcp_abandon(inactive, 0);
  }
}

// Assembly:
pushq %rax
movl %edi, %eax
andl $-0x2, %eax
cmpl $0x8, %eax
jne 0x8522
movq 0x1542b(%rip), %rcx     # 0x1d908
xorl %edx, %edx
testq %rcx, %rcx
je 0x850e
movl 0x15432(%rip), %esi     # 0x1d91c
xorl %eax, %eax
cmpl %edi, 0x48(%rcx)
jne 0x8503
movl %esi, %r8d
subl 0x58(%rcx), %r8d
cmpl %edx, %r8d
cmovaeq %rcx, %rax
cmoval %r8d, %edx
movq 0x38(%rcx), %rcx
testq %rcx, %rcx
jne 0x84ec
jmp 0x8510
xorl %eax, %eax
testq %rax, %rax
je 0x8520
movq %rax, %rdi
xorl %esi, %esi
popq %rax
jmp 0x7263
popq %rax
retq
leaq 0xcda3(%rip), %rdi      # 0x152cc
leaq 0xde39(%rip), %rsi      # 0x16369
leaq 0xd768(%rip), %rcx      # 0x15c9f
movl $0x6dd, %edx            # imm = 0x6DD
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_recv
void
tcp_recv(struct tcp_pcb *pcb, tcp_recv_fn recv)
{
  LWIP_ASSERT_CORE_LOCKED();
  if (pcb != NULL) {
    LWIP_ASSERT("invalid socket state for recv callback", pcb->state != LISTEN);
    pcb->recv = recv;
  }
}

// Assembly:
testq %rdi, %rdi
je 0x85fc
cmpl $0x1, 0x48(%rdi)
je 0x85fd
movq %rsi, 0xd8(%rdi)
retq
pushq %rax
leaq 0xccc7(%rip), %rdi      # 0x152cc
leaq 0xdad8(%rip), %rsi      # 0x160e4
leaq 0xd68c(%rip), %rcx      # 0x15c9f
movl $0x7df, %edx            # imm = 0x7DF
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_sent
void
tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent)
{
  LWIP_ASSERT_CORE_LOCKED();
  if (pcb != NULL) {
    LWIP_ASSERT("invalid socket state for sent callback", pcb->state != LISTEN);
    pcb->sent = sent;
  }
}

// Assembly:
testq %rdi, %rdi
je 0x863d
cmpl $0x1, 0x48(%rdi)
je 0x863e
movq %rsi, 0xd0(%rdi)
retq
pushq %rax
leaq 0xcc86(%rip), %rdi      # 0x152cc
leaq 0xdabe(%rip), %rsi      # 0x1610b
leaq 0xd64b(%rip), %rcx      # 0x15c9f
movl $0x7f3, %edx            # imm = 0x7F3
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_err
void
tcp_err(struct tcp_pcb *pcb, tcp_err_fn err)
{
  LWIP_ASSERT_CORE_LOCKED();
  if (pcb != NULL) {
    LWIP_ASSERT("invalid socket state for err callback", pcb->state != LISTEN);
    pcb->errf = err;
  }
}

// Assembly:
testq %rdi, %rdi
je 0x867e
cmpl $0x1, 0x48(%rdi)
je 0x867f
movq %rsi, 0xf0(%rdi)
retq
pushq %rax
leaq 0xcc45(%rip), %rdi      # 0x152cc
leaq 0xdaa4(%rip), %rsi      # 0x16132
leaq 0xd60a(%rip), %rcx      # 0x15c9f
movl $0x80d, %edx            # imm = 0x80D
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_poll
void
tcp_poll(struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("tcp_poll: invalid pcb", pcb != NULL, return);
  LWIP_ASSERT("invalid socket state for poll", pcb->state != LISTEN);

#if LWIP_CALLBACK_API
  pcb->poll = poll;
#else /* LWIP_CALLBACK_API */
  LWIP_UNUSED_ARG(poll);
#endif /* LWIP_CALLBACK_API */
  pcb->pollinterval = interval;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x86d5
cmpl $0x1, 0x48(%rdi)
je 0x86f1
movq %rsi, 0xe8(%rdi)
movb %dl, 0x55(%rdi)
popq %rax
retq
leaq 0xcbf0(%rip), %rdi      # 0x152cc
leaq 0xda75(%rip), %rsi      # 0x16158
leaq 0xd5b5(%rip), %rcx      # 0x15c9f
movl $0x83d, %edx            # imm = 0x83D
jmp 0x870b
leaq 0xcbd4(%rip), %rdi      # 0x152cc
leaq 0xda6f(%rip), %rsi      # 0x1616e
leaq 0xd599(%rip), %rcx      # 0x15c9f
movl $0x83e, %edx            # imm = 0x83E
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_pcbs_sane
s16_t
tcp_pcbs_sane(void)
{
  struct tcp_pcb *pcb;
  for (pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
    LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != CLOSED", pcb->state != CLOSED);
    LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != LISTEN", pcb->state != LISTEN);
    LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT);
  }
  for (pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
    LWIP_ASSERT("tcp_pcbs_sane: tw pcb->state == TIME-WAIT", pcb->state == TIME_WAIT);
  }
  return 1;
}

// Assembly:
pushq %rax
movq 0x151e2(%rip), %rax     # 0x1d908
testq %rax, %rax
je 0x8746
movl 0x48(%rax), %ecx
cmpl $0xa, %ecx
je 0x87b8
cmpl $0x1, %ecx
je 0x8764
testl %ecx, %ecx
je 0x8780
movq 0x38(%rax), %rax
jmp 0x8726
movq 0x151c3(%rip), %rax     # 0x1d910
testq %rax, %rax
je 0x875e
cmpl $0xa, 0x48(%rax)
jne 0x879c
movq 0x38(%rax), %rax
jmp 0x874d
movw $0x1, %ax
popq %rcx
retq
leaq 0xcb61(%rip), %rdi      # 0x152cc
leaq 0xdb25(%rip), %rsi      # 0x16297
leaq 0xd526(%rip), %rcx      # 0x15c9f
movl $0x9da, %edx            # imm = 0x9DA
jmp 0x87d2
leaq 0xcb45(%rip), %rdi      # 0x152cc
leaq 0xdade(%rip), %rsi      # 0x1626c
leaq 0xd50a(%rip), %rcx      # 0x15c9f
movl $0x9d9, %edx            # imm = 0x9D9
jmp 0x87d2
leaq 0xcb29(%rip), %rdi      # 0x152cc
leaq 0xdb46(%rip), %rsi      # 0x162f0
leaq 0xd4ee(%rip), %rcx      # 0x15c9f
movl $0x9de, %edx            # imm = 0x9DE
jmp 0x87d2
leaq 0xcb0d(%rip), %rdi      # 0x152cc
leaq 0xdafc(%rip), %rsi      # 0x162c2
leaq 0xd4d2(%rip), %rcx      # 0x15c9f
movl $0x9db, %edx            # imm = 0x9DB
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_netif_ip_addr_changed
void
tcp_netif_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
{
  struct tcp_pcb_listen *lpcb;

  if (!ip_addr_isany(old_addr)) {
    tcp_netif_ip_addr_changed_pcblist(old_addr, tcp_active_pcbs);
    tcp_netif_ip_addr_changed_pcblist(old_addr, tcp_bound_pcbs);

    if (!ip_addr_isany(new_addr)) {
      /* PCB bound to current local interface address? */
      for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
        /* PCB bound to current local interface address? */
        if (ip_addr_cmp(&lpcb->local_ip, old_addr)) {
          /* The PCB is listening to the old ipaddr and
            * is set to listen to the new one instead */
          ip_addr_copy(lpcb->local_ip, *new_addr);
        }
      }
    }
  }
}

// Assembly:
testq %rdi, %rdi
je 0x8909
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x6, 0x14(%rdi)
movl (%rdi), %eax
jne 0x881e
testl %eax, %eax
jne 0x8826
cmpl $0x0, 0x4(%r14)
jne 0x8826
cmpl $0x0, 0x8(%r14)
jne 0x8826
cmpl $0x0, 0xc(%r14)
jne 0x8826
jmp 0x8902
testl %eax, %eax
je 0x8902
movq 0x150db(%rip), %rsi     # 0x1d908
movq %r14, %rdi
callq 0x890a
movq 0x150c4(%rip), %rsi     # 0x1d900
movq %r14, %rdi
callq 0x890a
testq %rbx, %rbx
je 0x8902
cmpb $0x6, 0x14(%rbx)
movl (%rbx), %eax
jne 0x8870
testl %eax, %eax
jne 0x8878
cmpl $0x0, 0x4(%rbx)
jne 0x8878
cmpl $0x0, 0x8(%rbx)
jne 0x8878
cmpl $0x0, 0xc(%rbx)
jne 0x8878
jmp 0x8902
testl %eax, %eax
je 0x8902
movq 0x15079(%rip), %rax     # 0x1d8f8
testq %rax, %rax
je 0x8902
xorl %ecx, %ecx
movb 0x14(%rax), %dl
cmpb 0x14(%r14), %dl
jne 0x88f9
movl (%rax), %esi
movl (%r14), %edi
cmpb $0x6, %dl
jne 0x88c3
cmpl %edi, %esi
jne 0x88f9
movl 0x4(%rax), %edx
cmpl 0x4(%r14), %edx
jne 0x88f9
movl 0x8(%rax), %edx
cmpl 0x8(%r14), %edx
jne 0x88f9
movl 0xc(%rax), %edx
cmpl 0xc(%r14), %edx
jne 0x88f9
movb 0x10(%rax), %dl
cmpb 0x10(%r14), %dl
je 0x88c7
jmp 0x88f9
cmpl %edi, %esi
jne 0x88f9
movb 0x14(%rbx), %dl
movb %dl, 0x14(%rax)
cmpb $0x6, 0x14(%rbx)
movl (%rbx), %edx
movl %edx, (%rax)
jne 0x88f1
movl 0x4(%rbx), %edx
movl %edx, 0x4(%rax)
movl 0x8(%rbx), %edx
movl %edx, 0x8(%rax)
movl 0xc(%rbx), %edx
movl %edx, 0xc(%rax)
movb 0x10(%rbx), %dl
movb %dl, 0x10(%rax)
jmp 0x88f9
movq %rcx, 0x9(%rax)
movq %rcx, 0x4(%rax)
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x8886
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_netif_ip_addr_changed_pcblist
static void
tcp_netif_ip_addr_changed_pcblist(const ip_addr_t *old_addr, struct tcp_pcb *pcb_list)
{
  struct tcp_pcb *pcb;
  pcb = pcb_list;

  LWIP_ASSERT("tcp_netif_ip_addr_changed_pcblist: invalid old_addr", old_addr != NULL);

  while (pcb != NULL) {
    /* PCB bound to current local interface address? */
    if (ip_addr_cmp(&pcb->local_ip, old_addr)
#if LWIP_AUTOIP
        /* connections to link-local addresses must persist (RFC3927 ch. 1.9) */
        && (!IP_IS_V4_VAL(pcb->local_ip) || !ip4_addr_islinklocal(ip_2_ip4(&pcb->local_ip)))
#endif /* LWIP_AUTOIP */
       ) {
      /* this connection must be aborted */
      struct tcp_pcb *next = pcb->next;
      LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif_set_ipaddr: aborting TCP pcb %p\n", (void *)pcb));
      tcp_abort(pcb);
      pcb = next;
    } else {
      pcb = pcb->next;
    }
  }
}

// Assembly:
testq %rsi, %rsi
je 0x8976
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x14(%rsi), %al
cmpb 0x14(%rbx), %al
jne 0x894a
movl (%rsi), %ecx
movl (%rbx), %edx
cmpb $0x6, %al
jne 0x8955
cmpl %edx, %ecx
jne 0x894a
movl 0x4(%rsi), %eax
cmpl 0x4(%rbx), %eax
jne 0x894a
movl 0x8(%rsi), %eax
cmpl 0x8(%rbx), %eax
jne 0x894a
movl 0xc(%rsi), %eax
cmpl 0xc(%rbx), %eax
jne 0x894a
movb 0x10(%rsi), %al
cmpb 0x10(%rbx), %al
je 0x8959
movq 0x38(%rsi), %rsi
testq %rsi, %rsi
jne 0x8916
jmp 0x896f
cmpl %edx, %ecx
jne 0x894a
movq 0x38(%rsi), %r14
movq %rsi, %rdi
movl $0x1, %esi
callq 0x7263
movq %r14, %rsi
jmp 0x894e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_tcp_get_tcp_addrinfo
err_t
tcp_tcp_get_tcp_addrinfo(struct tcp_pcb *pcb, int local, ip_addr_t *addr, u16_t *port)
{
  if (pcb) {
    if (local) {
      if (addr) {
        *addr = pcb->local_ip;
      }
      if (port) {
        *port = pcb->local_port;
      }
    } else {
      if (addr) {
        *addr = pcb->remote_ip;
      }
      if (port) {
        *port = pcb->remote_port;
      }
    }
    return ERR_OK;
  }
  return ERR_VAL;
}

// Assembly:
testq %rdi, %rdi
je 0x89af
testl %esi, %esi
je 0x89b2
testq %rdx, %rdx
je 0x89a4
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rdx)
movups (%rdi), %xmm0
movups %xmm0, (%rdx)
testq %rcx, %rcx
je 0x89d5
addq $0x4e, %rdi
jmp 0x89cf
movb $-0x6, %al
retq
testq %rdx, %rdx
je 0x89c6
movq 0x28(%rdi), %rax
movq %rax, 0x10(%rdx)
movups 0x18(%rdi), %xmm0
movups %xmm0, (%rdx)
testq %rcx, %rcx
je 0x89d5
addq $0x50, %rdi
movzwl (%rdi), %eax
movw %ax, (%rcx)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_in.c
// Function: tcp_timewait_input
static void
tcp_timewait_input(struct tcp_pcb *pcb)
{
  /* RFC 1337: in TIME_WAIT, ignore RST and ACK FINs + any 'acceptable' segments */
  /* RFC 793 3.9 Event Processing - Segment Arrives:
   * - first check sequence number - we skip that one in TIME_WAIT (always
   *   acceptable since we only send ACKs)
   * - second check the RST bit (... return) */
  if (flags & TCP_RST) {
    return;
  }

  LWIP_ASSERT("tcp_timewait_input: invalid pcb", pcb != NULL);

  /* - fourth, check the SYN bit, */
  if (flags & TCP_SYN) {
    /* If an incoming segment is not acceptable, an acknowledgment
       should be sent in reply */
    if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd)) {
      /* If the SYN is in the window it is an error, send a reset */
      tcp_rst(pcb, ackno, seqno + tcplen, ip_current_dest_addr(),
              ip_current_src_addr(), tcphdr->dest, tcphdr->src);
      return;
    }
  } else if (flags & TCP_FIN) {
    /* - eighth, check the FIN bit: Remain in the TIME-WAIT state.
         Restart the 2 MSL time-wait timeout.*/
    pcb->tmr = tcp_ticks;
  }

  if ((tcplen > 0)) {
    /* Acknowledge data, FIN or out-of-window SYN */
    tcp_ack_now(pcb);
    tcp_output(pcb);
  }
  return;
}

// Assembly:
movzbl 0x145a5(%rip), %eax     # 0x1d94c
testb $0x4, %al
jne 0x93ef
testb $0x2, %al
jne 0x93c1
testb $0x1, %al
je 0x93dc
leaq 0x14562(%rip), %rax     # 0x1d91c
movl (%rax), %eax
movl %eax, 0x58(%rdi)
jmp 0x93dc
movl 0x1457d(%rip), %edx     # 0x1d944
movl 0x5c(%rdi), %eax
cmpl %eax, %edx
js 0x93dc
movzwl 0x60(%rdi), %ecx
addl %ecx, %eax
movl %edx, %ecx
subl %eax, %ecx
testl %ecx, %ecx
jle 0x93f0
cmpw $0x0, 0x1456a(%rip)     # 0x1d94e
je 0x93ef
orb $0x2, 0x52(%rdi)
jmp 0xbfab
retq
pushq %rax
movl 0x14551(%rip), %esi     # 0x1d948
movzwl 0x14550(%rip), %eax     # 0x1d94e
addl %eax, %edx
movq 0x14521(%rip), %rax     # 0x1d928
movzwl 0x2(%rax), %r9d
movzwl (%rax), %eax
movl %eax, (%rsp)
leaq 0x14357(%rip), %r8      # 0x1d770
leaq 0x3c(%r8), %rcx
addq $0x24, %r8
callq 0xc9d6
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_in.c
// Function: tcp_input_delayed_close
static int
tcp_input_delayed_close(struct tcp_pcb *pcb)
{
  LWIP_ASSERT("tcp_input_delayed_close: invalid pcb", pcb != NULL);

  if (recv_flags & TF_CLOSED) {
    /* The connection has been closed and we will deallocate the
        PCB. */
    if (!(pcb->flags & TF_RXCLOSED)) {
      /* Connection closed although the application has only shut down the
          tx side: call the PCB's err callback and indicate the closure to
          ensure the application doesn't continue using the PCB. */
      TCP_EVENT_ERR(pcb->state, pcb->errf, pcb->callback_arg, ERR_CLSD);
    }
    tcp_pcb_remove(&tcp_active_pcbs, pcb);
    tcp_free(pcb);
    return 1;
  }
  return 0;
}

// Assembly:
xorl %eax, %eax
testb $0x10, 0x13ce1(%rip)    # 0x1d978
je 0x9cd7
pushq %rbx
movq %rdi, %rbx
testb $0x10, 0x52(%rdi)
jne 0x9cba
movq 0xf0(%rbx), %rax
testq %rax, %rax
je 0x9cba
movq 0x40(%rbx), %rdi
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
callq *%rax
leaq 0x13c47(%rip), %rdi     # 0x1d908
movq %rbx, %rsi
callq 0x743d
movq %rbx, %rdi
callq 0x685c
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_in.c
// Function: tcp_free_acked_segments
static struct tcp_seg *
tcp_free_acked_segments(struct tcp_pcb *pcb, struct tcp_seg *seg_list, const char *dbg_list_name,
                        struct tcp_seg *dbg_other_seg_list)
{
  struct tcp_seg *next;
  u16_t clen;

  LWIP_UNUSED_ARG(dbg_list_name);
  LWIP_UNUSED_ARG(dbg_other_seg_list);

  while (seg_list != NULL &&
         TCP_SEQ_LEQ(lwip_ntohl(seg_list->tcphdr->seqno) +
                     TCP_TCPLEN(seg_list), ackno)) {
    LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->%s\n",
                                  lwip_ntohl(seg_list->tcphdr->seqno),
                                  lwip_ntohl(seg_list->tcphdr->seqno) + TCP_TCPLEN(seg_list),
                                  dbg_list_name));

    next = seg_list;
    seg_list = seg_list->next;

    clen = pbuf_clen(next->p);
    LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"TCPWNDSIZE_F" ... ",
                                 (tcpwnd_size_t)pcb->snd_queuelen));
    LWIP_ASSERT("pcb->snd_queuelen >= pbuf_clen(next->p)", (pcb->snd_queuelen >= clen));

    pcb->snd_queuelen = (u16_t)(pcb->snd_queuelen - clen);
    recv_acked = (tcpwnd_size_t)(recv_acked + next->len);
    tcp_seg_free(next);

    LWIP_DEBUGF(TCP_QLEN_DEBUG, ("%"TCPWNDSIZE_F" (after freeing %s)\n",
                                 (tcpwnd_size_t)pcb->snd_queuelen,
                                 dbg_list_name));
    if (pcb->snd_queuelen != 0) {
      LWIP_ASSERT("tcp_receive: valid queue length",
                  seg_list != NULL || dbg_other_seg_list != NULL);
    }
  }
  return seg_list;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
testq %rsi, %rsi
je 0xaaab
movq %rdx, %rbx
movq %rdi, %r14
movq %r15, %r12
movq 0x18(%r15), %rax
movl 0x4(%rax), %edi
callq 0x13c57
movl %eax, %ebp
movzwl 0x10(%r15), %r15d
movq 0x18(%r12), %rax
movzwl 0xc(%rax), %edi
callq 0x13c50
andl $0x3, %eax
addl %ebp, %r15d
subl 0x12f07(%rip), %r15d    # 0x1d948
cmpw $0x1, %ax
sbbl $-0x1, %r15d
testl %r15d, %r15d
jg 0xaaa8
movq (%r12), %r15
movq 0x8(%r12), %rdi
callq 0x5425
movzwl 0x9e(%r14), %ecx
cmpw %ax, %cx
jb 0xaab7
subl %eax, %ecx
movw %cx, 0x9e(%r14)
movzwl 0x10(%r12), %eax
addw %ax, 0x12efa(%rip)      # 0x1d97a
movq %r12, %rdi
callq 0x828a
cmpw $0x0, 0x9e(%r14)
je 0xaa9d
testq %rbx, %rbx
jne 0xaa9d
testq %r15, %r15
je 0xaad3
testq %r15, %r15
jne 0xaa10
jmp 0xaaab
movq %r12, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa80e(%rip), %rdi      # 0x152cc
leaq 0xbc73(%rip), %rsi      # 0x16738
leaq 0xb980(%rip), %rcx      # 0x1644c
movl $0x467, %edx            # imm = 0x467
jmp 0xaaed
leaq 0xa7f2(%rip), %rdi      # 0x152cc
leaq 0xbc7f(%rip), %rsi      # 0x16760
leaq 0xb964(%rip), %rcx      # 0x1644c
movl $0x472, %edx            # imm = 0x472
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_in.c
// Function: tcp_oos_insert_segment
static void
tcp_oos_insert_segment(struct tcp_seg *cseg, struct tcp_seg *next)
{
  struct tcp_seg *old_seg;

  LWIP_ASSERT("tcp_oos_insert_segment: invalid cseg", cseg != NULL);

  if (TCPH_FLAGS(cseg->tcphdr) & TCP_FIN) {
    /* received segment overlaps all following segments */
    tcp_segs_free(next);
    next = NULL;
  } else {
    /* delete some following segments
       oos queue may have segments with FIN flag */
    while (next &&
           TCP_SEQ_GEQ((seqno + cseg->len),
                       (next->tcphdr->seqno + next->len))) {
      /* cseg with FIN already processed */
      if (TCPH_FLAGS(next->tcphdr) & TCP_FIN) {
        TCPH_SET_FLAG(cseg->tcphdr, TCP_FIN);
      }
      old_seg = next;
      next = next->next;
      tcp_seg_free(old_seg);
    }
    if (next &&
        TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) {
      /* We need to trim the incoming segment. */
      cseg->len = (u16_t)(next->tcphdr->seqno - seqno);
      pbuf_realloc(cseg->p, cseg->len);
    }
  }
  cseg->next = next;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rdi), %rax
movzwl 0xc(%rax), %edi
callq 0x13c50
testb $0x1, %al
jne 0xab80
testq %r14, %r14
je 0xab88
movl 0x12e1b(%rip), %eax     # 0x1d944
movzwl 0x10(%rbx), %edx
addl %eax, %edx
movq 0x18(%r14), %rsi
movl 0x4(%rsi), %ecx
movzwl 0x10(%r14), %edi
addl %ecx, %edi
cmpl %edi, %edx
js 0xab99
movzwl 0xc(%rsi), %edi
callq 0x13c50
testb $0x1, %al
je 0xab6b
movq 0x18(%rbx), %rax
movzwl 0xc(%rax), %ebp
movl $0x1, %edi
callq 0x13c50
orw %bp, %ax
movq 0x18(%rbx), %rcx
movw %ax, 0xc(%rcx)
movq (%r14), %r15
movq %r14, %rdi
callq 0x828a
movq %r15, %r14
testq %r15, %r15
jne 0xab23
jmp 0xab88
movq %r14, %rdi
callq 0x7586
xorl %r14d, %r14d
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
subl %ecx, %edx
testl %edx, %edx
jle 0xab8b
subl %eax, %ecx
movw %cx, 0x10(%rbx)
movq 0x8(%rbx), %rdi
movzwl %cx, %esi
callq 0x51ac
jmp 0xab8b
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_pbuf_prealloc
static struct pbuf *
tcp_pbuf_prealloc(pbuf_layer layer, u16_t length, u16_t max_length,
                  u16_t *oversize, const struct tcp_pcb *pcb, u8_t apiflags,
                  u8_t first_seg)
{
  struct pbuf *p;
  u16_t alloc = length;

  LWIP_ASSERT("tcp_pbuf_prealloc: invalid oversize", oversize != NULL);
  LWIP_ASSERT("tcp_pbuf_prealloc: invalid pcb", pcb != NULL);

#if LWIP_NETIF_TX_SINGLE_PBUF
  LWIP_UNUSED_ARG(max_length);
  LWIP_UNUSED_ARG(pcb);
  LWIP_UNUSED_ARG(apiflags);
  LWIP_UNUSED_ARG(first_seg);
  alloc = max_length;
#else /* LWIP_NETIF_TX_SINGLE_PBUF */
  if (length < max_length) {
    /* Should we allocate an oversized pbuf, or just the minimum
     * length required? If tcp_write is going to be called again
     * before this segment is transmitted, we want the oversized
     * buffer. If the segment will be transmitted immediately, we can
     * save memory by allocating only length. We use a simple
     * heuristic based on the following information:
     *
     * Did the user set TCP_WRITE_FLAG_MORE?
     *
     * Will the Nagle algorithm defer transmission of this segment?
     */
    if ((apiflags & TCP_WRITE_FLAG_MORE) ||
        (!(pcb->flags & TF_NODELAY) &&
         (!first_seg ||
          pcb->unsent != NULL ||
          pcb->unacked != NULL))) {
      alloc = LWIP_MIN(max_length, LWIP_MEM_ALIGN_SIZE(TCP_OVERSIZE_CALC_LENGTH(length)));
    }
  }
#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
  p = pbuf_alloc(layer, alloc, PBUF_RAM);
  if (p == NULL) {
    return NULL;
  }
  LWIP_ASSERT("need unchained pbuf", p->next == NULL);
  *oversize = p->len - length;
  /* trim p->len to the currently used size */
  p->len = p->tot_len = length;
  return p;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rcx, %rcx
je 0xb86a
movq %rcx, %rbx
movl %esi, %ebp
movl %ebp, %eax
cmpw %dx, %bp
jae 0xb836
testb $0x2, %r9b
jne 0xb824
testb $0x40, 0x52(%r8)
movl %ebp, %eax
jne 0xb836
cmpb $0x0, 0x20(%rsp)
je 0xb824
cmpq $0x0, 0xa8(%r8)
jne 0xb824
cmpq $0x0, 0xb0(%r8)
movl %ebp, %eax
je 0xb836
movzwl %bp, %eax
movzwl %dx, %ecx
addl $0x5b4, %eax            # imm = 0x5B4
cmpl %ecx, %eax
cmovbel %eax, %edx
movl %edx, %eax
movzwl %ax, %esi
movl $0x280, %edx            # imm = 0x280
callq 0x4e57
testq %rax, %rax
je 0xb861
cmpq $0x0, (%rax)
jne 0xb886
movzwl 0x12(%rax), %ecx
subl %ebp, %ecx
movw %cx, (%rbx)
movw %bp, 0x10(%rax)
movw %bp, 0x12(%rax)
jmp 0xb863
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x9a5b(%rip), %rdi      # 0x152cc
leaq 0xb503(%rip), %rsi      # 0x16d7b
leaq 0xaf18(%rip), %rcx      # 0x16797
movl $0xe8, %edx
jmp 0xb8a0
leaq 0x9a3f(%rip), %rdi      # 0x152cc
leaq 0xb50b(%rip), %rsi      # 0x16d9f
leaq 0xaefc(%rip), %rcx      # 0x16797
movl $0x10b, %edx            # imm = 0x10B
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_send_fin
err_t
tcp_send_fin(struct tcp_pcb *pcb)
{
  LWIP_ASSERT("tcp_send_fin: invalid pcb", pcb != NULL);

  /* first, try to add the fin to the last unsent segment */
  if (pcb->unsent != NULL) {
    struct tcp_seg *last_unsent;
    for (last_unsent = pcb->unsent; last_unsent->next != NULL;
         last_unsent = last_unsent->next);

    if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) {
      /* no SYN/FIN/RST flag in the header, we can add the FIN flag */
      TCPH_SET_FLAG(last_unsent->tcphdr, TCP_FIN);
      tcp_set_flags(pcb, TF_FIN);
      return ERR_OK;
    }
  }
  /* no data, no length, flags, copy=1, no optdata */
  return tcp_enqueue_flags(pcb, TCP_FIN);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0xbdee
movq %rdi, %rbx
movq 0xa8(%rdi), %rax
testq %rax, %rax
je 0xbdb5
movq %rax, %r14
movq (%rax), %rax
testq %rax, %rax
jne 0xbd99
movq 0x18(%r14), %rax
movzwl 0xc(%rax), %edi
callq 0x13c50
testb $0x7, %al
je 0xbdc6
movq %rbx, %rdi
movl $0x1, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0xbe1b
movq 0x18(%r14), %rax
movzwl 0xc(%rax), %ebp
movl $0x1, %edi
callq 0x13c50
orw %bp, %ax
movq 0x18(%r14), %rcx
movw %ax, 0xc(%rcx)
orb $0x20, 0x52(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x94d7(%rip), %rdi      # 0x152cc
leaq 0xac7a(%rip), %rsi      # 0x16a76
leaq 0xa994(%rip), %rcx      # 0x16797
movl $0x3eb, %edx            # imm = 0x3EB
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_rexmit_rto_prepare
err_t
tcp_rexmit_rto_prepare(struct tcp_pcb *pcb)
{
  struct tcp_seg *seg;

  LWIP_ASSERT("tcp_rexmit_rto_prepare: invalid pcb", pcb != NULL);

  if (pcb->unacked == NULL) {
    return ERR_VAL;
  }

  /* Move all unacked segments to the head of the unsent queue.
     However, give up if any of the unsent pbufs are still referenced by the
     netif driver due to deferred transmission. No point loading the link further
     if it is struggling to flush its buffered writes. */
  for (seg = pcb->unacked; seg->next != NULL; seg = seg->next) {
    if (tcp_output_segment_busy(seg)) {
      LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_rexmit_rto: segment busy\n"));
      return ERR_VAL;
    }
  }
  if (tcp_output_segment_busy(seg)) {
    LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_rexmit_rto: segment busy\n"));
    return ERR_VAL;
  }
  /* concatenate unsent queue after unacked queue */
  seg->next = pcb->unsent;
#if TCP_OVERSIZE_DBGCHECK
  /* if last unsent changed, we need to update unsent_oversize */
  if (pcb->unsent == NULL) {
    pcb->unsent_oversize = seg->oversize_left;
  }
#endif /* TCP_OVERSIZE_DBGCHECK */
  /* unsent queue is the concatenated queue (of unacked, unsent) */
  pcb->unsent = pcb->unacked;
  /* unacked queue is now empty */
  pcb->unacked = NULL;

  /* Mark RTO in-progress */
  tcp_set_flags(pcb, TF_RTO);
  /* Record the next byte following retransmit */
  pcb->rto_end = lwip_ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg);
  /* Don't take any RTT measurements after retransmitting. */
  pcb->rttest = 0;

  return ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xc757
movq %rdi, %rbx
movq 0xb0(%rdi), %rcx
movb $-0x6, %al
testq %rcx, %rcx
je 0xc74c
movq %rcx, %r14
movq (%r14), %rdx
movq 0x8(%r14), %rsi
movb 0x16(%rsi), %sil
testq %rdx, %rdx
je 0xc6d7
movq %rdx, %r14
cmpb $0x1, %sil
je 0xc6bc
jmp 0xc74c
cmpb $0x1, %sil
jne 0xc74c
movq 0xa8(%rbx), %rax
movq %rax, (%r14)
testq %rax, %rax
jne 0xc6f8
movzwl 0x12(%r14), %eax
movw %ax, 0xa0(%rbx)
movq %rcx, 0xa8(%rbx)
movq $0x0, 0xb0(%rbx)
orb $0x8, 0x53(%rbx)
movq 0x18(%r14), %rax
movl 0x4(%rax), %edi
callq 0x13c57
movl %eax, %ebp
movzwl 0x10(%r14), %r15d
movq 0x18(%r14), %rax
movzwl 0xc(%rax), %edi
callq 0x13c50
andl $0x3, %eax
addl %ebp, %r15d
cmpw $0x1, %ax
sbbl $-0x1, %r15d
movl %r15d, 0x84(%rbx)
movl $0x0, 0x6c(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8b6e(%rip), %rdi      # 0x152cc
leaq 0xa47f(%rip), %rsi      # 0x16be4
leaq 0xa02b(%rip), %rcx      # 0x16797
movl $0x663, %edx            # imm = 0x663
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_rexmit_rto_commit
void
tcp_rexmit_rto_commit(struct tcp_pcb *pcb)
{
  LWIP_ASSERT("tcp_rexmit_rto_commit: invalid pcb", pcb != NULL);

  /* increment number of retransmissions */
  if (pcb->nrtx < 0xFF) {
    ++pcb->nrtx;
  }
  /* Do the actual retransmission */
  tcp_output(pcb);
}

// Assembly:
testq %rdi, %rdi
je 0xc7df
movb 0x7a(%rdi), %al
cmpb $-0x1, %al
je 0xbfab
incb %al
movb %al, 0x7a(%rdi)
jmp 0xbfab
pushq %rax
leaq 0x8ae5(%rip), %rdi      # 0x152cc
leaq 0xa41a(%rip), %rsi      # 0x16c08
leaq 0x9fa2(%rip), %rcx      # 0x16797
movl $0x698, %edx            # imm = 0x698
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050