LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_rexmit
err_t
tcp_rexmit(struct tcp_pcb *pcb)
{
  struct tcp_seg *seg;
  struct tcp_seg **cur_seg;

  LWIP_ASSERT("tcp_rexmit: invalid pcb", pcb != NULL);

  if (pcb->unacked == NULL) {
    return ERR_VAL;
  }

  seg = pcb->unacked;

  /* Give up if the segment is still referenced by the netif driver
     due to deferred transmission. */
  if (tcp_output_segment_busy(seg)) {
    LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_rexmit busy\n"));
    return ERR_VAL;
  }

  /* Move the first unacked segment to the unsent queue */
  /* Keep the unsent queue sorted. */
  pcb->unacked = seg->next;

  cur_seg = &(pcb->unsent);
  while (*cur_seg &&
         TCP_SEQ_LT(lwip_ntohl((*cur_seg)->tcphdr->seqno), lwip_ntohl(seg->tcphdr->seqno))) {
    cur_seg = &((*cur_seg)->next );
  }
  seg->next = *cur_seg;
  *cur_seg = seg;
#if TCP_OVERSIZE
  if (seg->next == NULL) {
    /* the retransmitted segment is last in unsent, so reset unsent_oversize */
    pcb->unsent_oversize = 0;
  }
#endif /* TCP_OVERSIZE */

  if (pcb->nrtx < 0xFF) {
    ++pcb->nrtx;
  }

  /* Don't take any rtt measurements after retransmitting. */
  pcb->rttest = 0;

  /* Do the actual retransmission. */
  MIB2_STATS_INC(mib2.tcpretranssegs);
  /* No need to call tcp_output: we are always called from tcp_input()
     and thus tcp_output directly returns. */
  return ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xc909
movq %rdi, %rbx
movq 0xb0(%rdi), %r14
movb $-0x6, %al
testq %r14, %r14
je 0xc8fe
movq 0x8(%r14), %rcx
cmpb $0x1, 0x16(%rcx)
jne 0xc8fe
movq (%r14), %rax
movq %rax, 0xb0(%rbx)
leaq 0xa8(%rbx), %r15
movq 0xa8(%rbx), %rax
testq %rax, %rax
je 0xc8d1
movq 0x18(%rax), %rax
movl 0x4(%rax), %edi
callq 0x13c57
movl %eax, %ebp
movq 0x18(%r14), %rax
movl 0x4(%rax), %edi
callq 0x13c57
cmpl %eax, %ebp
jns 0xc8d1
movq (%r15), %r15
movq (%r15), %rax
jmp 0xc8a6
movq (%r15), %rax
movq %rax, (%r14)
movq %r14, (%r15)
cmpq $0x0, (%r14)
jne 0xc8e9
movw $0x0, 0xa0(%rbx)
movb 0x7a(%rbx), %al
cmpb $-0x1, %al
je 0xc8f5
incb %al
movb %al, 0x7a(%rbx)
movl $0x0, 0x6c(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x89bc(%rip), %rdi      # 0x152cc
leaq 0xa330(%rip), %rsi      # 0x16c47
leaq 0x9e79(%rip), %rcx      # 0x16797
movl $0x6c1, %edx            # imm = 0x6C1
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_fast
void
tcp_rexmit_fast(struct tcp_pcb *pcb)
{
  LWIP_ASSERT("tcp_rexmit_fast: invalid pcb", pcb != NULL);

  if (pcb->unacked != NULL && !(pcb->flags & TF_INFR)) {
    /* This is fast retransmit. Retransmit the first unacked segment. */
    LWIP_DEBUGF(TCP_FR_DEBUG,
                ("tcp_receive: dupacks %"U16_F" (%"U32_F
                 "), fast retransmit %"U32_F"\n",
                 (u16_t)pcb->dupacks, pcb->lastack,
                 lwip_ntohl(pcb->unacked->tcphdr->seqno)));
    if (tcp_rexmit(pcb) == ERR_OK) {
      /* Set ssthresh to half of the minimum of the current
       * cwnd and the advertised window */
      pcb->ssthresh = LWIP_MIN(pcb->cwnd, pcb->snd_wnd) / 2;

      /* The minimum value for ssthresh should be 2 MSS */
      if (pcb->ssthresh < (2U * pcb->mss)) {
        LWIP_DEBUGF(TCP_FR_DEBUG,
                    ("tcp_receive: The minimum value for ssthresh %"TCPWNDSIZE_F
                     " should be min 2 mss %"U16_F"...\n",
                     pcb->ssthresh, (u16_t)(2 * pcb->mss)));
        pcb->ssthresh = 2 * pcb->mss;
      }

      pcb->cwnd = pcb->ssthresh + 3 * pcb->mss;
      tcp_set_flags(pcb, TF_INFR);

      /* Reset the retransmission timer to prevent immediate rto retransmissions */
      pcb->rtime = 0;
    }
  }
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0xc9a9
movq %rdi, %rbx
cmpq $0x0, 0xb0(%rdi)
je 0xc9a7
testb $0x4, 0x52(%rbx)
jne 0xc9a7
movq %rbx, %rdi
callq 0xc863
testb %al, %al
jne 0xc9a7
movl 0x80(%rbx), %eax
movl 0x98(%rbx), %ecx
cmpw %cx, %ax
cmovbl %eax, %ecx
movzwl %cx, %edx
shrl %edx
movw %dx, 0x82(%rbx)
movzwl 0x6a(%rbx), %eax
movl %eax, %ecx
addl %eax, %ecx
cmpl %edx, %ecx
jbe 0xc98c
movw %cx, 0x82(%rbx)
leal (%rax,%rax,2), %eax
addw 0x82(%rbx), %ax
movw %ax, 0x80(%rbx)
orb $0x4, 0x52(%rbx)
movw $0x0, 0x68(%rbx)
popq %rbx
retq
leaq 0x891c(%rip), %rdi      # 0x152cc
leaq 0xa2a8(%rip), %rsi      # 0x16c5f
leaq 0x9dd9(%rip), %rcx      # 0x16797
movl $0x6f9, %edx            # imm = 0x6F9
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_rst
void
tcp_rst(const struct tcp_pcb *pcb, u32_t seqno, u32_t ackno,
        const ip_addr_t *local_ip, const ip_addr_t *remote_ip,
        u16_t local_port, u16_t remote_port)
{
  struct pbuf *p;
  u16_t wnd;
  u8_t optlen;

  LWIP_ASSERT("tcp_rst: invalid local_ip", local_ip != NULL);
  LWIP_ASSERT("tcp_rst: invalid remote_ip", remote_ip != NULL);

  optlen = LWIP_TCP_OPT_LENGTH_SEGMENT(0, pcb);

#if LWIP_WND_SCALE
  wnd = PP_HTONS(((TCP_WND >> TCP_RCV_SCALE) & 0xFFFF));
#else
  wnd = PP_HTONS(TCP_WND);
#endif

  p = tcp_output_alloc_header_common(ackno, optlen, 0, lwip_htonl(seqno), local_port,
    remote_port, TCP_RST | TCP_ACK, wnd);
  if (p == NULL) {
    LWIP_DEBUGF(TCP_DEBUG, ("tcp_rst: could not allocate memory for pbuf\n"));
    return;
  }
  tcp_output_fill_options(pcb, p, 0, optlen);

  MIB2_STATS_INC(mib2.tcpoutrsts);

  tcp_output_control_segment(pcb, p, local_ip, remote_ip);
  LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %"U32_F" ackno %"U32_F".\n", seqno, ackno));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rcx, %rcx
je 0xca5e
movq %r8, %rbx
testq %r8, %r8
je 0xca7a
movl %r9d, %ebp
movq %rcx, %r14
movl %edx, %r12d
movq %rdi, %r15
movzwl 0x40(%rsp), %r13d
movl %esi, %edi
callq 0x13c57
movl $0x80, (%rsp)
movzwl %bp, %ecx
movzwl %r13w, %r8d
movl %r12d, %edi
xorl %esi, %esi
movl %eax, %edx
movl $0x14, %r9d
callq 0xcaa7
testq %rax, %rax
je 0xca4f
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcb7e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8867(%rip), %rdi      # 0x152cc
leaq 0xa210(%rip), %rsi      # 0x16c7c
leaq 0x9d24(%rip), %rcx      # 0x16797
movl $0x7c4, %edx            # imm = 0x7C4
jmp 0xca94
leaq 0x884b(%rip), %rdi      # 0x152cc
leaq 0xa20e(%rip), %rsi      # 0x16c96
leaq 0x9d08(%rip), %rcx      # 0x16797
movl $0x7c5, %edx            # imm = 0x7C5
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_output_alloc_header_common
static struct pbuf *
tcp_output_alloc_header_common(u32_t ackno, u16_t optlen, u16_t datalen,
                        u32_t seqno_be /* already in network byte order */,
                        u16_t src_port, u16_t dst_port, u8_t flags, u16_t wnd)
{
  struct tcp_hdr *tcphdr;
  struct pbuf *p;

  p = pbuf_alloc(PBUF_IP, TCP_HLEN + optlen + datalen, PBUF_RAM);
  if (p != NULL) {
    LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr",
                (p->len >= TCP_HLEN + optlen));
    tcphdr = (struct tcp_hdr *)p->payload;
    tcphdr->src = lwip_htons(src_port);
    tcphdr->dest = lwip_htons(dst_port);
    tcphdr->seqno = seqno_be;
    tcphdr->ackno = lwip_htonl(ackno);
    TCPH_HDRLEN_FLAGS_SET(tcphdr, (5 + optlen / 4), flags);
    tcphdr->wnd = lwip_htons(wnd);
    tcphdr->chksum = 0;
    tcphdr->urgp = 0;
  }
  return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebp
movl %r8d, %r12d
movl %ecx, %r13d
movl %edx, %r15d
movl %edi, %r14d
addl $0x14, %esi
movzwl %si, %esi
movl $0x36, %edi
movl $0x280, %edx            # imm = 0x280
callq 0x4e57
movq %rax, %rbx
testq %rax, %rax
je 0xcb3f
movl %ebp, 0x4(%rsp)
cmpw $0x13, 0x12(%rbx)
jbe 0xcb51
movq 0x8(%rbx), %rbp
movzwl %r13w, %edi
callq 0x13c50
movw %ax, (%rbp)
movzwl %r12w, %edi
callq 0x13c50
movw %ax, 0x2(%rbp)
movl %r15d, 0x4(%rbp)
movl %r14d, %edi
callq 0x13c57
movl %eax, 0x8(%rbp)
movzbl 0x4(%rsp), %edi
orl $0x5000, %edi           # imm = 0x5000
callq 0x13c50
movw %ax, 0xc(%rbp)
movzwl 0x40(%rsp), %edi
callq 0x13c50
movw %ax, 0xe(%rbp)
movl $0x0, 0x10(%rbp)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8774(%rip), %rdi      # 0x152cc
leaq 0xa315(%rip), %rsi      # 0x16e74
leaq 0x9c31(%rip), %rcx      # 0x16797
movl $0x724, %edx            # imm = 0x724
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_output_control_segment
static err_t
tcp_output_control_segment(const struct tcp_pcb *pcb, struct pbuf *p,
                           const ip_addr_t *src, const ip_addr_t *dst)
{
  err_t err;
  struct netif *netif;

  LWIP_ASSERT("tcp_output_control_segment: invalid pbuf", p != NULL);

  netif = tcp_route(pcb, src, dst);
  if (netif == NULL) {
    err = ERR_RTE;
  } else {
    u8_t ttl, tos;
#if CHECKSUM_GEN_TCP
    IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_TCP) {
      struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
      tcphdr->chksum = ip_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len,
                                        src, dst);
    }
#endif
    if (pcb != NULL) {
      NETIF_SET_HINTS(netif, LWIP_CONST_CAST(struct netif_hint*, &(pcb->netif_hints)));
      ttl = pcb->ttl;
      tos = pcb->tos;
    } else {
      /* Send output with hardcoded TTL/HL since we have no access to the pcb */
      ttl = TCP_TTL;
      tos = 0;
    }
    TCP_STATS_INC(tcp.xmit);
    err = ip_output_if(p, src, dst, ttl, tos, IP_PROTO_TCP, netif);
    NETIF_RESET_HINTS(netif);
  }
  pbuf_free(p);
  return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r13
movq %rdx, %rsi
movq %rcx, %rdx
callq 0xc662
testq %rax, %rax
je 0xcbd6
movq %rax, %r12
movq 0x8(%rbx), %rbp
movzwl 0x10(%rbx), %edx
movq %rbx, %rdi
movl $0x6, %esi
movq %r15, %rcx
movq %r14, %r8
callq 0x13ff6
movw %ax, 0x10(%rbp)
testq %r13, %r13
je 0xcbdb
movb 0x32(%r13), %al
movb 0x33(%r13), %cl
jmp 0xcbdf
movb $-0x4, %bpl
jmp 0xcc2d
movb $0x40, %cl
xorl %eax, %eax
testq %r14, %r14
je 0xcc0c
cmpb $0x6, 0x14(%r14)
jne 0xcc0c
movq %r12, (%rsp)
movzbl %cl, %ecx
movzbl %al, %r8d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x6, %r9d
callq 0x103a0
jmp 0xcc2b
movq %r12, (%rsp)
movzbl %cl, %ecx
movzbl %al, %r8d
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
movl $0x6, %r9d
callq 0xe5cf
movl %eax, %ebp
movq %rbx, %rdi
callq 0x5069
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_output_alloc_header
static struct pbuf *
tcp_output_alloc_header(struct tcp_pcb *pcb, u16_t optlen, u16_t datalen,
                        u32_t seqno_be /* already in network byte order */)
{
  struct pbuf *p;

  LWIP_ASSERT("tcp_output_alloc_header: invalid pcb", pcb != NULL);

  p = tcp_output_alloc_header_common(pcb->rcv_nxt, optlen, datalen,
    seqno_be, pcb->local_port, pcb->remote_port, TCP_ACK,
    TCPWND_MIN16(RCV_WND_SCALE(pcb, pcb->rcv_ann_wnd)));
  if (p != NULL) {
    /* If we're sending a packet, update the announced right window edge */
    pcb->rcv_ann_right_edge = pcb->rcv_nxt + pcb->rcv_ann_wnd;
  }
  return p;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x5c(%rdi), %edi
movzwl 0x4e(%rbx), %ecx
movzwl 0x50(%rbx), %r8d
movzwl 0x62(%rbx), %eax
movl %eax, (%rsp)
movl $0x10, %r9d
callq 0xcaa7
testq %rax, %rax
je 0xcc7b
movzwl 0x62(%rbx), %ecx
addl 0x5c(%rbx), %ecx
movl %ecx, 0x64(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_keepalive
err_t
tcp_keepalive(struct tcp_pcb *pcb)
{
  err_t err;
  struct pbuf *p;
  u8_t optlen = LWIP_TCP_OPT_LENGTH_SEGMENT(0, pcb);

  LWIP_ASSERT("tcp_keepalive: invalid pcb", pcb != NULL);

  LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: sending KEEPALIVE probe to "));
  ip_addr_debug_print_val(TCP_DEBUG, pcb->remote_ip);
  LWIP_DEBUGF(TCP_DEBUG, ("\n"));

  LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: tcp_ticks %"U32_F"   pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n",
                          tcp_ticks, pcb->tmr, (u16_t)pcb->keep_cnt_sent));

  p = tcp_output_alloc_header(pcb, optlen, 0, lwip_htonl(pcb->snd_nxt - 1));
  if (p == NULL) {
    LWIP_DEBUGF(TCP_DEBUG,
                ("tcp_keepalive: could not allocate memory for pbuf\n"));
    return ERR_MEM;
  }
  tcp_output_fill_options(pcb, p, 0, optlen);
  err = tcp_output_control_segment(pcb, p, &pcb->local_ip, &pcb->remote_ip);

  LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: seqno %"U32_F" ackno %"U32_F" err %d.\n",
                          pcb->snd_nxt - 1, pcb->rcv_nxt, (int)err));
  return err;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0xccbf
movq %rdi, %rbx
movl 0x88(%rdi), %edi
decl %edi
callq 0x13c57
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0xcc46
testq %rax, %rax
je 0xccbb
leaq 0x18(%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
movq %rbx, %rdx
popq %rbx
jmp 0xcb7e
movb $-0x1, %al
popq %rbx
retq
leaq 0x8606(%rip), %rdi      # 0x152cc
leaq 0xa004(%rip), %rsi      # 0x16cd1
leaq 0x9ac3(%rip), %rcx      # 0x16797
movl $0x824, %edx            # imm = 0x824
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/timeouts.c
// Function: tcp_timer_needed
void
tcp_timer_needed(void)
{
  LWIP_ASSERT_CORE_LOCKED();

  /* timer is off but needed again? */
  if (!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
    /* enable and start timer */
    tcpip_tcp_timer_active = 1;
    sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
  }
}

// Assembly:
cmpb $0x0, 0x10b61(%rip)     # 0x1d988
jne 0xce68
leaq 0x10ad8(%rip), %rax     # 0x1d908
leaq 0x10ad9(%rip), %rcx     # 0x1d910
movq (%rcx), %rcx
orq (%rax), %rcx
je 0xce68
pushq %rax
movb $0x1, 0x10b41(%rip)     # 0x1d988
callq 0x13c14
leal 0xfa(%rax), %edi
leaq 0x78(%rip), %rsi        # 0xced1
leaq 0xa06d(%rip), %rcx      # 0x16ecd
xorl %edx, %edx
popq %rax
jmp 0xcf91
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/timeouts.c
// Function: tcpip_tcp_timer
static void
tcpip_tcp_timer(void *arg)
{
  LWIP_UNUSED_ARG(arg);

  /* call TCP timer handler */
  tcp_tmr();
  /* timer still needed? */
  if (tcp_active_pcbs || tcp_tw_pcbs) {
    /* restart timer */
    sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
  } else {
    /* disable timer */
    tcpip_tcp_timer_active = 0;
  }
}

// Assembly:
pushq %rax
callq 0x689d
leaq 0x10a2a(%rip), %rax     # 0x1d908
leaq 0x10a2b(%rip), %rcx     # 0x1d910
movq (%rcx), %rcx
orq (%rax), %rcx
je 0xcf0e
callq 0x13c14
leal 0xfa(%rax), %edi
leaq -0x2e(%rip), %rsi       # 0xced1
leaq 0x9fc7(%rip), %rcx      # 0x16ecd
xorl %edx, %edx
popq %rax
jmp 0xcf91
movb $0x0, 0x10a73(%rip)     # 0x1d988
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/udp.c
// Function: udp_send
err_t
udp_send(struct udp_pcb *pcb, struct pbuf *p)
{
  LWIP_ERROR("udp_send: invalid pcb", pcb != NULL, return ERR_ARG);
  LWIP_ERROR("udp_send: invalid pbuf", p != NULL, return ERR_ARG);

  if (IP_IS_ANY_TYPE_VAL(pcb->remote_ip)) {
    return ERR_VAL;
  }

#if TUN2SOCKS
  /* tun2socks should never use udp_send(), use udp_sendto() directly instead */
  return ERR_OK;
#else
  /* send to the packet using remote ip and port stored in the pcb */
  return udp_sendto(pcb, p, &pcb->remote_ip, pcb->remote_port);
#endif /* TUN2SOCKS */
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0xd373
testq %rsi, %rsi
je 0xd38f
xorl %ecx, %ecx
cmpb $0x2e, 0x2c(%rdi)
movl $0xfa, %eax
cmovnel %ecx, %eax
popq %rcx
retq
leaq 0x7f52(%rip), %rdi      # 0x152cc
leaq 0x9c6d(%rip), %rsi      # 0x16fee
leaq 0x9c18(%rip), %rcx      # 0x16fa0
movl $0x1e6, %edx            # imm = 0x1E6
jmp 0xd3a9
leaq 0x7f36(%rip), %rdi      # 0x152cc
leaq 0x9c67(%rip), %rsi      # 0x17004
leaq 0x9bfc(%rip), %rcx      # 0x16fa0
movl $0x1e7, %edx            # imm = 0x1E7
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/udp.c
// Function: udp_send_chksum
err_t
udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
                u8_t have_chksum, u16_t chksum)
{
  LWIP_ERROR("udp_send_chksum: invalid pcb", pcb != NULL, return ERR_ARG);
  LWIP_ERROR("udp_send_chksum: invalid pbuf", p != NULL, return ERR_ARG);

  if (IP_IS_ANY_TYPE_VAL(pcb->remote_ip)) {
    return ERR_VAL;
  }

#if TUN2SOCKS
  /* tun2socks should never use udp_send(), use udp_sendto_chksum() directly instead */
  return ERR_OK;
#else
  /* send to the packet using remote ip and port stored in the pcb */
  return udp_sendto_chksum(pcb, p, &pcb->remote_ip, pcb->remote_port,
                           have_chksum, chksum);
#endif /* TUN2SOCKS */
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0xd3d7
testq %rsi, %rsi
je 0xd3f3
xorl %ecx, %ecx
cmpb $0x2e, 0x2c(%rdi)
movl $0xfa, %eax
cmovnel %ecx, %eax
popq %rcx
retq
leaq 0x7eee(%rip), %rdi      # 0x152cc
leaq 0x9c36(%rip), %rsi      # 0x1701b
leaq 0x9bb4(%rip), %rcx      # 0x16fa0
movl $0x1fe, %edx            # imm = 0x1FE
jmp 0xd40d
leaq 0x7ed2(%rip), %rdi      # 0x152cc
leaq 0x9c37(%rip), %rsi      # 0x17038
leaq 0x9b98(%rip), %rcx      # 0x16fa0
movl $0x1ff, %edx            # imm = 0x1FF
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/udp.c
// Function: udp_recv
void
udp_recv(struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("udp_recv: invalid pcb", pcb != NULL, return);

  /* remember recv() callback and user data */
  pcb->recv = recv;
  pcb->recv_arg = recv_arg;
}

// Assembly:
testq %rdi, %rdi
je 0xde52
movq %rsi, 0x48(%rdi)
movq %rdx, 0x50(%rdi)
retq
pushq %rax
leaq 0x7472(%rip), %rdi      # 0x152cc
leaq 0x93ec(%rip), %rsi      # 0x1724d
leaq 0x9138(%rip), %rcx      # 0x16fa0
movl $0x4f8, %edx            # imm = 0x4F8
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/udp.c
// Function: udp_remove
void
udp_remove(struct udp_pcb *pcb)
{
  struct udp_pcb *pcb2;

  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("udp_remove: invalid pcb", pcb != NULL, return);

  mib2_udp_unbind(pcb);
  /* pcb to be removed is first in list? */
  if (udp_pcbs == pcb) {
    /* make list start at 2nd pcb */
    udp_pcbs = udp_pcbs->next;
    /* pcb not 1st in list */
  } else {
    for (pcb2 = udp_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {
      /* find pcb in udp_pcbs list */
      if (pcb2->next != NULL && pcb2->next == pcb) {
        /* remove pcb from list */
        pcb2->next = pcb->next;
        break;
      }
    }
  }
  memp_free(MEMP_UDP_PCB, pcb);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0xdec8
movq %rdi, %rsi
movq 0xfb10(%rip), %rcx      # 0x1d9a0
cmpq %rdi, %rcx
je 0xdeaf
testq %rcx, %rcx
je 0xdebd
movq %rcx, %rax
movq 0x38(%rcx), %rcx
cmpq %rsi, %rcx
jne 0xde95
addq $0x38, %rax
movq %rsi, %rcx
jmp 0xdeb6
leaq 0xfaea(%rip), %rax      # 0x1d9a0
movq 0x38(%rcx), %rcx
movq %rcx, (%rax)
movl $0x1, %edi
popq %rax
jmp 0x3d28
leaq 0x73fd(%rip), %rdi      # 0x152cc
leaq 0x938d(%rip), %rsi      # 0x17263
leaq 0x90c3(%rip), %rcx      # 0x16fa0
movl $0x50f, %edx            # imm = 0x50F
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/udp.c
// Function: udp_new_ip_type
struct udp_pcb *
udp_new_ip_type(u8_t type)
{
  struct udp_pcb *pcb;

  LWIP_ASSERT_CORE_LOCKED();

  pcb = udp_new();
#if LWIP_IPV4 && LWIP_IPV6
  if (pcb != NULL) {
    IP_SET_TYPE_VAL(pcb->local_ip,  type);
    IP_SET_TYPE_VAL(pcb->remote_ip, type);
  }
#else
  LWIP_UNUSED_ARG(type);
#endif /* LWIP_IPV4 && LWIP_IPV6 */
  return pcb;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
movl $0x1, %edi
callq 0x3c9e
testq %rax, %rax
je 0xdf63
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, (%rax)
movq $0x0, 0x50(%rax)
movb $0x40, 0x33(%rax)
movb %bl, 0x14(%rax)
movb %bl, 0x2c(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/udp.c
// Function: udp_netif_ip_addr_changed
void udp_netif_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
{
  struct udp_pcb *upcb;

  if (!ip_addr_isany(old_addr) && !ip_addr_isany(new_addr)) {
    for (upcb = udp_pcbs; upcb != NULL; upcb = upcb->next) {
      /* PCB bound to current local interface address? */
      if (ip_addr_cmp(&upcb->local_ip, old_addr)) {
        /* The PCB is bound to the old ipaddr and
         * is set to bound to the new one instead */
        ip_addr_copy(upcb->local_ip, *new_addr);
      }
    }
  }
}

// Assembly:
testq %rdi, %rdi
je 0xe05a
cmpb $0x6, 0x14(%rdi)
movl (%rdi), %eax
jne 0xdf94
testl %eax, %eax
jne 0xdf8a
cmpl $0x0, 0x4(%rdi)
jne 0xdf8a
cmpl $0x0, 0x8(%rdi)
je 0xe05b
testq %rsi, %rsi
jne 0xdfa7
jmp 0xe05a
testl %eax, %eax
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0xe05a
cmpb $0x6, 0x14(%rsi)
movl (%rsi), %eax
jne 0xdfca
testl %eax, %eax
jne 0xdfd2
cmpl $0x0, 0x4(%rsi)
jne 0xdfd2
cmpl $0x0, 0x8(%rsi)
jne 0xdfd2
cmpl $0x0, 0xc(%rsi)
jne 0xdfd2
jmp 0xe05a
testl %eax, %eax
je 0xe05a
movq 0xf9c7(%rip), %rax      # 0x1d9a0
testq %rax, %rax
je 0xe05a
xorl %ecx, %ecx
movb 0x14(%rax), %dl
cmpb 0x14(%rdi), %dl
jne 0xe051
movl (%rax), %r8d
movl (%rdi), %r9d
cmpb $0x6, %dl
jne 0xe01a
cmpl %r9d, %r8d
jne 0xe051
movl 0x4(%rax), %edx
cmpl 0x4(%rdi), %edx
jne 0xe051
movl 0x8(%rax), %edx
cmpl 0x8(%rdi), %edx
jne 0xe051
movl 0xc(%rax), %edx
cmpl 0xc(%rdi), %edx
jne 0xe051
movb 0x10(%rax), %dl
cmpb 0x10(%rdi), %dl
je 0xe01f
jmp 0xe051
cmpl %r9d, %r8d
jne 0xe051
movb 0x14(%rsi), %dl
movb %dl, 0x14(%rax)
cmpb $0x6, 0x14(%rsi)
movl (%rsi), %edx
movl %edx, (%rax)
jne 0xe049
movl 0x4(%rsi), %edx
movl %edx, 0x4(%rax)
movl 0x8(%rsi), %edx
movl %edx, 0x8(%rax)
movl 0xc(%rsi), %edx
movl %edx, 0xc(%rax)
movb 0x10(%rsi), %dl
movb %dl, 0x10(%rax)
jmp 0xe051
movq %rcx, 0x9(%rax)
movq %rcx, 0x4(%rax)
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0xdfe0
retq
testq %rsi, %rsi
je 0xe05a
cmpl $0x0, 0xc(%rdi)
jne 0xdfa7
jmp 0xe05a
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4.c
// Function: ip4_output
err_t
ip4_output(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
           u8_t ttl, u8_t tos, u8_t proto)
{
  struct netif *netif;

  LWIP_IP_CHECK_PBUF_REF_COUNT_FOR_TX(p);

  if ((netif = ip4_route_src(src, dest)) == NULL) {
    LWIP_DEBUGF(IP_DEBUG, ("ip4_output: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n",
                           ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest), ip4_addr4_16(dest)));
    IP_STATS_INC(ip.rterr);
    return ERR_RTE;
  }

  return ip4_output_if(p, src, dest, ttl, tos, proto, netif);
}

// Assembly:
pushq %rax
cmpb $0x1, 0x16(%rdi)
jne 0xe84c
leaq 0xf0c1(%rip), %rax      # 0x1d8d8
movq (%rax), %rax
testq %rax, %rax
je 0xe848
testq %rdx, %rdx
je 0xe832
testq %rsi, %rsi
je 0xe82e
cmpl $0x0, (%rsi)
jne 0xe832
leaq 0x8(%rax), %rsi
movq %rax, (%rsp)
movzbl %cl, %ecx
movzbl %r8b, %r8d
movzbl %r9b, %r9d
callq 0xe5fa
jmp 0xe84a
movb $-0x4, %al
popq %rcx
retq
leaq 0x6a79(%rip), %rdi      # 0x152cc
leaq 0x8ad4(%rip), %rsi      # 0x1732e
leaq 0x8ad9(%rip), %rcx      # 0x1733a
movl $0x416, %edx            # imm = 0x416
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_addr.c
// Function: ip4_addr_netmask_valid
u8_t
ip4_addr_netmask_valid(u32_t netmask)
{
  u32_t mask;
  u32_t nm_hostorder = lwip_htonl(netmask);

  /* first, check for the first zero */
  for (mask = 1UL << 31 ; mask != 0; mask >>= 1) {
    if ((nm_hostorder & mask) == 0) {
      break;
    }
  }
  /* then check that there is no one */
  for (; mask != 0; mask >>= 1) {
    if ((nm_hostorder & mask) != 0) {
      /* there is a one after the first zero -> invalid */
      return 0;
    }
  }
  /* no one after the first zero -> valid */
  return 1;
}

// Assembly:
pushq %rax
callq 0x13c57
movl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, %edx
testl %ecx, %ecx
je 0xe8c7
movl %edx, %esi
andl %eax, %esi
movl %edx, %ecx
shrl %ecx
testl %esi, %esi
jne 0xe8b5
movb $0x1, %cl
testl %edx, %edx
je 0xe8e0
testl %eax, %edx
jne 0xe8de
movl %edx, %esi
shrl %esi
cmpl $0x2, %edx
movl %esi, %edx
jae 0xe8cd
jmp 0xe8e0
xorl %ecx, %ecx
movl %ecx, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_addr.c
// Function: ip4addr_ntoa_r
char *
ip4addr_ntoa_r(const ip4_addr_t *addr, char *buf, int buflen)
{
  u32_t s_addr;
  char inv[3];
  char *rp;
  u8_t *ap;
  u8_t rem;
  u8_t n;
  u8_t i;
  int len = 0;

  s_addr = ip4_addr_get_u32(addr);

  rp = buf;
  ap = (u8_t *)&s_addr;
  for (n = 0; n < 4; n++) {
    i = 0;
    do {
      rem = *ap % (u8_t)10;
      *ap /= (u8_t)10;
      inv[i++] = (char)('0' + rem);
    } while (*ap);
    while (i--) {
      if (len++ >= buflen) {
        return NULL;
      }
      *rp++ = inv[i];
    }
    if (len++ >= buflen) {
      return NULL;
    }
    *rp++ = '.';
    ap++;
  }
  *--rp = 0;
  return buf;
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movl (%rdi), %ecx
movl %ecx, -0x8(%rsp)
xorl %ecx, %ecx
xorl %esi, %esi
movq %rax, %rdi
movb -0x8(%rsp,%rcx), %r9b
xorl %r8d, %r8d
movzbl %r9b, %r10d
imull $0xcd, %r10d, %r9d
shrl $0xb, %r9d
leal (%r9,%r9), %r11d
leal (%r11,%r11,4), %r11d
movl %r10d, %ebx
subb %r11b, %bl
orb $0x30, %bl
movzbl %r8b, %r11d
incb %r8b
movb %bl, -0x3(%rsp,%r11)
cmpb $0x9, %r10b
ja 0xeb3d
movb %r9b, -0x8(%rsp,%rcx)
subb $0x1, %r8b
jae 0xeb7f
movq %rdi, %r8
jmp 0xeba7
movzbl %r8b, %r9d
cmpl %edx, %esi
movl %edx, %r10d
cmovgl %esi, %r10d
movq %rdi, %r8
cmpl %esi, %r10d
je 0xebcc
incl %esi
movb -0x3(%rsp,%r9), %dil
movb %dil, (%r8)
incq %r8
addq $-0x1, %r9
jb 0xeb8f
cmpl %edx, %esi
jge 0xebcc
incl %esi
leaq 0x1(%r8), %rdi
movb $0x2e, (%r8)
leaq 0x1(%rcx), %r9
cmpq $0x3, %rcx
movq %r9, %rcx
jne 0xeb35
movb $0x0, (%r8)
jmp 0xebce
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_frag.c
// Function: ip_reass_tmr
void
ip_reass_tmr(void)
{
  struct ip_reassdata *r, *prev = NULL;

  r = reassdatagrams;
  while (r != NULL) {
    /* Decrement the timer. Once it reaches 0,
     * clean up the incomplete fragment assembly */
    if (r->timer > 0) {
      r->timer--;
      LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_tmr: timer dec %"U16_F"\n", (u16_t)r->timer));
      prev = r;
      r = r->next;
    } else {
      /* reassembly timed out */
      struct ip_reassdata *tmp;
      LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_tmr: timer timed out\n"));
      tmp = r;
      /* get the next pointer before freeing */
      r = r->next;
      /* free the helper struct and all enqueued pbufs */
      ip_reass_free_complete_datagram(tmp, prev);
    }
  }
}

// Assembly:
movq 0xede9(%rip), %rdi      # 0x1d9c0
testq %rdi, %rdi
je 0xec10
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
movb 0x27(%rdi), %al
testb %al, %al
je 0xebf6
decb %al
movb %al, 0x27(%rdi)
movq (%rdi), %r14
movq %rdi, %rbx
jmp 0xec01
movq (%rdi), %r14
movq %rbx, %rsi
callq 0xec11
movq %r14, %rdi
testq %r14, %r14
jne 0xebe2
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/ipv4/ip4_frag.c
// Function: ip_reass_remove_oldest_datagram
static int
ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed)
{
  /* @todo Can't we simply remove the last datagram in the
   *       linked list behind reassdatagrams?
   */
  struct ip_reassdata *r, *oldest, *prev, *oldest_prev;
  int pbufs_freed = 0, pbufs_freed_current;
  int other_datagrams;

  /* Free datagrams until being allowed to enqueue 'pbufs_needed' pbufs,
   * but don't free the datagram that 'fraghdr' belongs to! */
  do {
    oldest = NULL;
    prev = NULL;
    oldest_prev = NULL;
    other_datagrams = 0;
    r = reassdatagrams;
    while (r != NULL) {
      if (!IP_ADDRESSES_AND_ID_MATCH(&r->iphdr, fraghdr)) {
        /* Not the same datagram as fraghdr */
        other_datagrams++;
        if (oldest == NULL) {
          oldest = r;
          oldest_prev = prev;
        } else if (r->timer <= oldest->timer) {
          /* older than the previous oldest */
          oldest = r;
          oldest_prev = prev;
        }
      }
      if (r->next != NULL) {
        prev = r;
      }
      r = r->next;
    }
    if (oldest != NULL) {
      pbufs_freed_current = ip_reass_free_complete_datagram(oldest, oldest_prev);
      pbufs_freed += pbufs_freed_current;
    }
  } while ((pbufs_freed < pbufs_needed) && (other_datagrams > 1));
  return pbufs_freed;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %ebp, %ebp
movq 0xe6d3(%rip), %rax      # 0x1d9c0
xorl %r15d, %r15d
testq %rax, %rax
je 0xf353
movl 0xc(%r14), %ecx
xorl %esi, %esi
xorl %edx, %edx
xorl %edi, %edi
cmpl %ecx, 0x1c(%rax)
jne 0xf31a
movl 0x20(%rax), %r8d
cmpl 0x10(%r14), %r8d
jne 0xf31a
movzwl 0x14(%rax), %r8d
cmpw 0x4(%r14), %r8w
je 0xf33a
incl %r15d
testq %rdi, %rdi
je 0xf334
movb 0x27(%rax), %r8b
cmpb 0x27(%rdi), %r8b
cmovbeq %rax, %rdi
cmovbeq %rdx, %rsi
jmp 0xf33a
movq %rax, %rdi
movq %rdx, %rsi
movq (%rax), %r8
testq %r8, %r8
cmovneq %rax, %rdx
movq %r8, %rax
jne 0xf2ff
cmpl $0x2, %r15d
setge %r15b
jmp 0xf357
xorl %edi, %edi
xorl %esi, %esi
testq %rdi, %rdi
je 0xf363
callq 0xec11
addl %eax, %ebp
cmpl %ebx, %ebp
setl %al
testb %r15b, %al
jne 0xf2e6
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_frag.c
// Function: ip_reass_dequeue_datagram
static void
ip_reass_dequeue_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev)
{
  /* dequeue the reass struct  */
  if (reassdatagrams == ipr) {
    /* it was the first in the list */
    reassdatagrams = ipr->next;
  } else {
    /* it wasn't the first, so it must have a valid 'prev' */
    LWIP_ASSERT("sanity check linked list", prev != NULL);
    prev->next = ipr->next;
  }

  /* now we can free the ip_reassdata struct */
  memp_free(MEMP_REASSDATA, ipr);
}

// Assembly:
movq %rdi, %rax
cmpq %rdi, 0xe638(%rip)      # 0x1d9c0
je 0xf3bd
testq %rsi, %rsi
jne 0xf3c4
pushq %rax
leaq 0x5f35(%rip), %rdi      # 0x152cc
leaq 0x81e2(%rip), %rsi      # 0x17580
leaq 0x806c(%rip), %rcx      # 0x17411
movl $0x145, %edx            # imm = 0x145
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
leaq 0xe5fc(%rip), %rsi      # 0x1d9c0
movq (%rax), %rcx
movq %rcx, (%rsi)
movl $0x5, %edi
movq %rax, %rsi
jmp 0x3d28
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_frag.c
// Function: ipfrag_free_pbuf_custom
static void
ipfrag_free_pbuf_custom(struct pbuf *p)
{
  struct pbuf_custom_ref *pcr = (struct pbuf_custom_ref *)p;
  LWIP_ASSERT("pcr != NULL", pcr != NULL);
  LWIP_ASSERT("pcr == p", (void *)pcr == (void *)p);
  if (pcr->original != NULL) {
    pbuf_free(pcr->original);
  }
  ip_frag_free_pbuf_custom_ref(pcr);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0xf6fe
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0xf6f0
callq 0x5069
movl $0x6, %edi
movq %rbx, %rsi
popq %rbx
jmp 0x3d28
leaq 0x5bc7(%rip), %rdi      # 0x152cc
leaq 0x7e8d(%rip), %rsi      # 0x17599
leaq 0x7cfe(%rip), %rcx      # 0x17411
movl $0x2ce, %edx            # imm = 0x2CE
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/icmp6.c
// Function: icmp6_send_response
static void
icmp6_send_response(struct pbuf *p, u8_t code, u32_t data, u8_t type)
{
  const struct ip6_addr *reply_src, *reply_dest;
  struct netif *netif = ip_current_netif();

  LWIP_ASSERT("icmpv6 packet not a direct response", netif != NULL);
  reply_dest = ip6_current_src_addr();

  /* Select an address to use as source. */
  reply_src = ip_2_ip6(ip6_select_source_address(netif, reply_dest));
  if (reply_src == NULL) {
    ICMP6_STATS_INC(icmp6.rterr);
    return;
  }
  icmp6_send_response_with_addrs_and_netif(p, code, data, type, reply_src, reply_dest, netif);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xdf12(%rip), %r14      # 0x1d770
movq (%r14), %r13
testq %r13, %r13
je 0xf8af
movl %ecx, %ebp
movl %edx, %ebx
movl %esi, %r12d
movq %rdi, %r15
addq $0x24, %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0xfaef
testq %rax, %rax
je 0xf8a0
movq %r13, (%rsp)
movzbl %r12b, %esi
movzbl %bpl, %ecx
movq %r15, %rdi
movl %ebx, %edx
movq %rax, %r8
movq %r14, %r9
callq 0xf9af
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5a16(%rip), %rdi      # 0x152cc
leaq 0x7ce8(%rip), %rsi      # 0x175a5
leaq 0x7d05(%rip), %rcx      # 0x175c9
movl $0x13a, %edx            # imm = 0x13A
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/ipv6/icmp6.c
// Function: icmp6_time_exceeded_with_addrs
static void
icmp6_send_response_with_addrs(struct pbuf *p, u8_t code, u32_t data, u8_t type,
    const ip6_addr_t *src_addr, const ip6_addr_t *dest_addr)
{
  const struct ip6_addr *reply_src, *reply_dest;
  struct netif *netif;

  /* Get the destination address and netif for this ICMP message. */
  LWIP_ASSERT("must provide both source and destination", src_addr != NULL);
  LWIP_ASSERT("must provide both source and destination", dest_addr != NULL);

  /* Special case, as ip6_current_xxx is either NULL, or points
     to a different packet than the one that expired. */
  IP6_ADDR_ZONECHECK(src_addr);
  IP6_ADDR_ZONECHECK(dest_addr);
  /* Swap source and destination for the reply. */
  reply_dest = src_addr;
  reply_src = dest_addr;
  netif = ip6_route(reply_src, reply_dest);
  if (netif == NULL) {
    ICMP6_STATS_INC(icmp6.rterr);
    return;
  }
  icmp6_send_response_with_addrs_and_netif(p, code, data, type, reply_src,
    reply_dest, netif);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0xf94e
movq %rcx, %r14
testq %rcx, %rcx
je 0xf96a
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
movq %r14, %rdi
movq %rdx, %rsi
callq 0xfae4
testq %rax, %rax
je 0xf943
movq %rax, (%rsp)
movzbl %bpl, %esi
movq %r15, %rdi
xorl %edx, %edx
movl $0x3, %ecx
movq %r14, %r8
movq %rbx, %r9
callq 0xf9af
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5977(%rip), %rdi      # 0x152cc
leaq 0x7cbb(%rip), %rsi      # 0x17617
leaq 0x7c66(%rip), %rcx      # 0x175c9
movl $0x161, %edx            # imm = 0x161
jmp 0xf984
leaq 0x595b(%rip), %rdi      # 0x152cc
leaq 0x7c9f(%rip), %rsi      # 0x17617
leaq 0x7c4a(%rip), %rcx      # 0x175c9
movl $0x162, %edx            # imm = 0x162
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/ipv6/icmp6.c
// Function: icmp6_send_response_with_addrs_and_netif
static void
icmp6_send_response_with_addrs_and_netif(struct pbuf *p, u8_t code, u32_t data, u8_t type,
    const ip6_addr_t *reply_src, const ip6_addr_t *reply_dest, struct netif *netif)
{
  struct pbuf *q;
  struct icmp6_hdr *icmp6hdr;

  /* ICMPv6 header + IPv6 header + data */
  q = pbuf_alloc(PBUF_IP, sizeof(struct icmp6_hdr) + IP6_HLEN + LWIP_ICMP6_DATASIZE,
                 PBUF_RAM);
  if (q == NULL) {
    LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded: failed to allocate pbuf for ICMPv6 packet.\n"));
    ICMP6_STATS_INC(icmp6.memerr);
    return;
  }
  LWIP_ASSERT("check that first pbuf can hold icmp 6message",
             (q->len >= (sizeof(struct icmp6_hdr) + IP6_HLEN + LWIP_ICMP6_DATASIZE)));

  icmp6hdr = (struct icmp6_hdr *)q->payload;
  icmp6hdr->type = type;
  icmp6hdr->code = code;
  icmp6hdr->data = lwip_htonl(data);

  /* copy fields from original packet */
  SMEMCPY((u8_t *)q->payload + sizeof(struct icmp6_hdr), (u8_t *)p->payload,
          IP6_HLEN + LWIP_ICMP6_DATASIZE);

  /* calculate checksum */
  icmp6hdr->chksum = 0;
#if CHECKSUM_GEN_ICMP6
  IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_ICMP6) {
    icmp6hdr->chksum = ip6_chksum_pseudo(q, IP6_NEXTH_ICMP6, q->tot_len,
      reply_src, reply_dest);
  }
#endif /* CHECKSUM_GEN_ICMP6 */

  ICMP6_STATS_INC(icmp6.xmit);
  ip6_output_if(q, reply_src, reply_dest, LWIP_ICMP6_HL, 0, IP6_NEXTH_ICMP6, netif);
  pbuf_free(q);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r14
movq %r8, 0x20(%rsp)
movl %ecx, %r13d
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r12
movq 0x60(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x36, %edi
movl $0x38, %esi
movl $0x280, %edx            # imm = 0x280
callq 0x4e57
testq %rax, %rax
je 0xfaa8
movq %rax, %r15
movq %r14, 0x10(%rsp)
cmpw $0x37, 0x12(%rax)
jbe 0xfab7
movq 0x8(%r15), %r14
movb %r13b, (%r14)
movb %bl, 0x1(%r14)
movl %ebp, %edi
callq 0x13c57
movl %eax, 0x4(%r14)
movq 0x8(%r15), %rax
movq 0x8(%r12), %rcx
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x28(%rax)
movups %xmm1, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movw $0x0, 0x2(%r14)
movzwl 0x10(%r15), %edx
movq %r15, %rdi
movl $0x3a, %esi
movq 0x20(%rsp), %r12
movq %r12, %rcx
movq 0x10(%rsp), %rbx
movq %rbx, %r8
callq 0x13f92
movw %ax, 0x2(%r14)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movl $0xff, %ecx
xorl %r8d, %r8d
movl $0x3a, %r9d
callq 0x103a0
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5069
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x580e(%rip), %rdi      # 0x152cc
leaq 0x7b25(%rip), %rsi      # 0x175ea
leaq 0x7afd(%rip), %rcx      # 0x175c9
movl $0x190, %edx            # imm = 0x190
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/ipv6/ip6.c
// Function: ip6_output_if
err_t
ip6_output_if(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
             u8_t hl, u8_t tc,
             u8_t nexth, struct netif *netif)
{
  const ip6_addr_t *src_used = src;
  if (dest != LWIP_IP_HDRINCL) {
    if (src != NULL && ip6_addr_isany(src)) {
      src_used = ip_2_ip6(ip6_select_source_address(netif, dest));
      if ((src_used == NULL) || ip6_addr_isany(src_used)) {
        /* No appropriate source address was found for this packet. */
        LWIP_DEBUGF(IP6_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip6_output: No suitable source address for packet.\n"));
        IP6_STATS_INC(ip6.rterr);
        return ERR_RTE;
      }
    }
  }
  return ip6_output_if_src(p, src_used, dest, hl, tc, nexth, netif);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %ebp
movl %r8d, %r14d
movl %ecx, %r12d
movq %rdx, %rbx
movq %rdi, %r15
testq %rdx, %rdx
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x103de
cmpl $0x0, (%rsi)
jne 0x103de
cmpl $0x0, 0x4(%rsi)
jne 0x103de
cmpl $0x0, 0x8(%rsi)
jne 0x103de
cmpl $0x0, 0xc(%rsi)
je 0x103fd
movzbl %r12b, %ecx
movzbl %r14b, %r8d
movzbl %bpl, %r9d
movq %r15, %rdi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10434
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0xfaef
testq %rax, %rax
je 0x10429
movq %rax, %rsi
cmpl $0x0, (%rax)
jne 0x103de
cmpl $0x0, 0x4(%rsi)
jne 0x103de
cmpl $0x0, 0x8(%rsi)
jne 0x103de
cmpl $0x0, 0xc(%rsi)
jne 0x103de
movb $-0x4, %al
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/ip6_frag.c
// Function: ip6_reass_remove_oldest_datagram
static void
ip6_reass_remove_oldest_datagram(struct ip6_reassdata *ipr, int pbufs_needed)
{
  struct ip6_reassdata *r, *oldest;

  /* Free datagrams until being allowed to enqueue 'pbufs_needed' pbufs,
   * but don't free the current datagram! */
  do {
    r = oldest = reassdatagrams;
    while (r != NULL) {
      if (r != ipr) {
        if (r->timer <= oldest->timer) {
          /* older than the previous oldest */
          oldest = r;
        }
      }
      r = r->next;
    }
    if (oldest == ipr) {
      /* nothing to free, ipr is the only element on the list */
      return;
    }
    if (oldest != NULL) {
      ip6_reass_free_complete_datagram(oldest);
    }
  } while (((ip6_reass_pbufcount + pbufs_needed) > IP_REASS_MAX_PBUFS) && (reassdatagrams != NULL));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movq 0xc526(%rip), %rdi      # 0x1d9f8
testq %rdi, %rdi
je 0x114f1
movq %rdi, %rax
cmpq %r14, %rax
je 0x114e9
movb 0x4f(%rax), %cl
cmpb 0x4f(%rdi), %cl
cmovbeq %rax, %rdi
movq (%rax), %rax
testq %rax, %rax
jne 0x114da
cmpq %r14, %rdi
je 0x11518
testq %rdi, %rdi
je 0x11500
callq 0x10c64
movzwl 0xc4f9(%rip), %eax      # 0x1da00
addl %ebx, %eax
cmpl $0xb, %eax
jl 0x11518
cmpq $0x0, 0xc4e2(%rip)      # 0x1d9f8
jne 0x114cb
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/ipv6/ip6_frag.c
// Function: ip6_frag_free_pbuf_custom
static void
ip6_frag_free_pbuf_custom(struct pbuf *p)
{
  struct pbuf_custom_ref *pcr = (struct pbuf_custom_ref*)p;
  LWIP_ASSERT("pcr != NULL", pcr != NULL);
  LWIP_ASSERT("pcr == p", (void*)pcr == (void*)p);
  if (pcr->original != NULL) {
    pbuf_free(pcr->original);
  }
  ip6_frag_free_pbuf_custom_ref(pcr);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x117ea
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x117dc
callq 0x5069
movl $0x6, %edi
movq %rbx, %rsi
popq %rbx
jmp 0x3d28
leaq 0x3adb(%rip), %rdi      # 0x152cc
leaq 0x5da1(%rip), %rsi      # 0x17599
leaq 0x5ef9(%rip), %rcx      # 0x176f8
movl $0x2ba, %edx            # imm = 0x2BA
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_duplicate_addr_detected
static void
nd6_duplicate_addr_detected(struct netif *netif, s8_t addr_idx)
{

  /* Mark the address as duplicate, but leave its lifetimes alone. If this was
   * a manually assigned address, it will remain in existence as duplicate, and
   * as such be unusable for any practical purposes until manual intervention.
   * If this was an autogenerated address, the address will follow normal
   * expiration rules, and thus disappear once its valid lifetime expires. */
  netif_ip6_addr_set_state(netif, addr_idx, IP6_ADDR_DUPLICATED);

#if LWIP_IPV6_AUTOCONFIG
  /* If the affected address was the link-local address that we use to generate
   * all other addresses, then we should not continue to use those derived
   * addresses either, so mark them as duplicate as well. For autoconfig-only
   * setups, this will make the interface effectively unusable, approaching the
   * intention of RFC 4862 Sec. 5.4.5. @todo implement the full requirements */
  if (addr_idx == 0) {
    s8_t i;
    for (i = 1; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
      if (!ip6_addr_isinvalid(netif_ip6_addr_state(netif, i)) &&
          !netif_ip6_addr_isstatic(netif, i)) {
        netif_ip6_addr_set_state(netif, i, IP6_ADDR_DUPLICATED);
      }
    }
  }
#endif /* LWIP_IPV6_AUTOCONFIG */
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movl $0x40, %edx
callq 0x4949
testb %bpl, %bpl
jne 0x123f2
movq $-0x2, %r14
testq %rbx, %rbx
je 0x123ed
cmpb $0x0, 0x9b(%rbx,%r14)
je 0x123ed
cmpl $0x0, 0xa8(%rbx,%r14,4)
je 0x123ed
leal 0x3(%r14), %eax
movsbl %al, %esi
movq %rbx, %rdi
movl $0x40, %edx
callq 0x4949
incq %r14
jne 0x123be
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_send_q
static void
nd6_send_q(s8_t i)
{
  struct ip6_hdr *ip6hdr;
  ip6_addr_t dest;
#if LWIP_ND6_QUEUEING
  struct nd6_q_entry *q;
#endif /* LWIP_ND6_QUEUEING */

  if ((i < 0) || (i >= LWIP_ND6_NUM_NEIGHBORS)) {
    return;
  }

#if LWIP_ND6_QUEUEING
  while (neighbor_cache[i].q != NULL) {
    /* remember first in queue */
    q = neighbor_cache[i].q;
    /* pop first item off the queue */
    neighbor_cache[i].q = q->next;
    /* Get ipv6 header. */
    ip6hdr = (struct ip6_hdr *)(q->p->payload);
    /* Create an aligned copy. */
    ip6_addr_copy_from_packed(dest, ip6hdr->dest);
    /* Restore the zone, if applicable. */
    ip6_addr_assign_zone(&dest, IP6_UNKNOWN, neighbor_cache[i].netif);
    /* send the queued IPv6 packet */
    (neighbor_cache[i].netif)->output_ip6(neighbor_cache[i].netif, q->p, &dest);
    /* free the queued IP packet */
    pbuf_free(q->p);
    /* now queue entry can be freed */
    memp_free(MEMP_ND6_QUEUE, q);
  }
#else /* LWIP_ND6_QUEUEING */
  if (neighbor_cache[i].q != NULL) {
    /* Get ipv6 header. */
    ip6hdr = (struct ip6_hdr *)(neighbor_cache[i].q->payload);
    /* Create an aligned copy. */
    ip6_addr_copy_from_packed(dest, ip6hdr->dest);
    /* Restore the zone, if applicable. */
    ip6_addr_assign_zone(&dest, IP6_UNKNOWN, neighbor_cache[i].netif);
    /* send the queued IPv6 packet */
    (neighbor_cache[i].netif)->output_ip6(neighbor_cache[i].netif, neighbor_cache[i].q, &dest);
    /* free the queued IP packet */
    pbuf_free(neighbor_cache[i].q);
    neighbor_cache[i].q = NULL;
  }
#endif /* LWIP_ND6_QUEUEING */
}

// Assembly:
cmpb $0x9, %dil
ja 0x12512
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movzbl %dil, %eax
imulq $0x38, %rax, %rax
leaq 0xb5b6(%rip), %r15      # 0x1da10
movq 0x28(%rax,%r15), %rbx
testq %rbx, %rbx
je 0x12509
addq %rax, %r15
leaq 0xc(%rsp), %r14
movq (%rbx), %rax
movq %rax, 0x28(%r15)
movq 0x8(%rbx), %rsi
movq 0x8(%rsi), %rcx
movl 0x18(%rcx), %eax
movl %eax, 0xc(%rsp)
movl 0x1c(%rcx), %edx
movl %edx, 0x10(%rsp)
movl 0x20(%rcx), %edx
movl %edx, 0x14(%rsp)
movl 0x24(%rcx), %ecx
movl %ecx, 0x18(%rsp)
movb $0x0, 0x1c(%rsp)
movl %eax, %ecx
andl $0xc0ff, %ecx           # imm = 0xC0FF
cmpl $0x80fe, %ecx           # imm = 0x80FE
je 0x124c3
andl $0x8fff, %eax           # imm = 0x8FFF
cmpl $0x2ff, %eax            # imm = 0x2FF
je 0x124c3
cmpl $0x1ff, %eax            # imm = 0x1FF
jne 0x12505
movq 0x18(%r15), %rax
movb 0xee(%rax), %al
incb %al
movb %al, 0x1c(%rsp)
movq 0x18(%r15), %rdi
movq %r14, %rdx
callq *0xd0(%rdi)
movq 0x8(%rbx), %rdi
callq 0x5069
movl $0x8, %edi
movq %rbx, %rsi
callq 0x3d28
movq 0x28(%r15), %rbx
testq %rbx, %rbx
jne 0x12470
jmp 0x12509
xorl %eax, %eax
jmp 0x124cf
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq