LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x14704
jmp 0x146d5
leaq 0x12bf0(%rip), %rdi     # 0x272cc
leaq 0x145e8(%rip), %rsi     # 0x28ccb
movl $0x3eb, %edx            # imm = 0x3EB
leaq 0x142e3(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x14706
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0x147b3
movq -0x10(%rbp), %rax
movq 0xa8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x14740
jmp 0x14733
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x14727
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movzwl 0xc(%rax), %edi
callq 0x251c0
movzwl %ax, %eax
andl $0x3f, %eax
movzbl %al, %eax
andl $0x7, %eax
cmpl $0x0, %eax
jne 0x147b1
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movzwl 0xc(%rax), %eax
movl %eax, -0x1c(%rbp)
movl $0x1, %edi
callq 0x251c0
movw %ax, %cx
movl -0x1c(%rbp), %eax
movzwl %cx, %ecx
orl %ecx, %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movw %cx, 0xc(%rax)
movq -0x10(%rbp), %rax
movzwl 0x52(%rax), %eax
orl $0x20, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x52(%rax)
movb $0x0, -0x1(%rbp)
jmp 0x147c4
jmp 0x147b3
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x147d0
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_route
static struct netif *
tcp_route(const struct tcp_pcb *pcb, const ip_addr_t *src, const ip_addr_t *dst)
{
  LWIP_UNUSED_ARG(src); /* in case IPv4-only and source-based routing is disabled */

  if ((pcb != NULL) && (pcb->netif_idx != NETIF_NO_INDEX)) {
    return netif_get_by_index(pcb->netif_idx);
  } else {
    return ip_route(src, dst);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1556b
movq -0x10(%rbp), %rax
movzbl 0x30(%rax), %eax
cmpl $0x0, %eax
je 0x1556b
movq -0x10(%rbp), %rax
movzbl 0x30(%rax), %edi
callq 0x6cf0
movq %rax, -0x8(%rbp)
jmp 0x155a7
cmpq $0x0, -0x20(%rbp)
je 0x15592
movq -0x20(%rbp), %rax
movzbl 0x14(%rax), %eax
cmpl $0x6, %eax
jne 0x15592
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1c270
movq %rax, -0x28(%rbp)
jmp 0x1559f
movq -0x20(%rbp), %rdi
callq 0x196c0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_output_segment_busy
static int
tcp_output_segment_busy(const struct tcp_seg *seg)
{
  LWIP_ASSERT("tcp_output_segment_busy: invalid seg", seg != NULL);

  /* We only need to check the first pbuf here:
     If a pbuf is queued for transmission, a driver calls pbuf_ref(),
     which only changes the ref count of the first pbuf */
  if (seg->p->ref != 1) {
    /* other reference found */
    return 1;
  }
  /* no other references found */
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x15d24
jmp 0x15cf5
leaq 0x115d0(%rip), %rdi     # 0x272cc
leaq 0x13478(%rip), %rsi     # 0x2917b
movl $0x59a, %edx            # imm = 0x59A
leaq 0x12cc3(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x15d26
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x16(%rax), %eax
cmpl $0x1, %eax
je 0x15d40
movl $0x1, -0x4(%rbp)
jmp 0x15d47
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x15d94
jmp 0x15d65
leaq 0x11560(%rip), %rdi     # 0x272cc
leaq 0x13102(%rip), %rsi     # 0x28e75
movl $0x698, %edx            # imm = 0x698
leaq 0x12c53(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x15d96
movq -0x8(%rbp), %rax
movzbl 0x7a(%rax), %eax
cmpl $0xff, %eax
jge 0x15db2
movq -0x8(%rbp), %rax
movb 0x7a(%rax), %cl
addb $0x1, %cl
movb %cl, 0x7a(%rax)
movq -0x8(%rbp), %rdi
callq 0x14b70
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x15ff4
jmp 0x15fc5
leaq 0x11300(%rip), %rdi     # 0x272cc
leaq 0x12ef9(%rip), %rsi     # 0x28ecc
movl $0x6f9, %edx            # imm = 0x6F9
leaq 0x129f3(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x15ff6
movq -0x8(%rbp), %rax
cmpq $0x0, 0xb0(%rax)
je 0x16103
movq -0x8(%rbp), %rax
movzwl 0x52(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x16103
jmp 0x1601e
jmp 0x16020
movq -0x8(%rbp), %rdi
callq 0x15e40
movsbl %al, %eax
cmpl $0x0, %eax
jne 0x16101
movq -0x8(%rbp), %rax
movzwl 0x80(%rax), %eax
movq -0x8(%rbp), %rcx
movzwl 0x98(%rcx), %ecx
cmpl %ecx, %eax
jge 0x1605f
movq -0x8(%rbp), %rax
movzwl 0x80(%rax), %eax
movl %eax, -0xc(%rbp)
jmp 0x1606d
movq -0x8(%rbp), %rax
movzwl 0x98(%rax), %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x82(%rax)
movq -0x8(%rbp), %rax
movzwl 0x82(%rax), %eax
movq -0x8(%rbp), %rcx
movzwl 0x6a(%rcx), %ecx
shll %ecx
cmpl %ecx, %eax
jae 0x160bb
jmp 0x160a1
jmp 0x160a3
movq -0x8(%rbp), %rax
movzwl 0x6a(%rax), %eax
shll %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x82(%rax)
movq -0x8(%rbp), %rax
movzwl 0x82(%rax), %eax
movq -0x8(%rbp), %rcx
movzwl 0x6a(%rcx), %ecx
imull $0x3, %ecx, %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x80(%rax)
movq -0x8(%rbp), %rax
movzwl 0x52(%rax), %eax
orl $0x4, %eax
movw %ax, %cx
movq -0x8(%rbp), %rax
movw %cx, 0x52(%rax)
movq -0x8(%rbp), %rax
movw $0x0, 0x68(%rax)
jmp 0x16103
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movw %r9w, %ax
movw 0x10(%rbp), %r9w
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movw %ax, -0x22(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1616f
jmp 0x16140
leaq 0x11185(%rip), %rdi     # 0x272cc
leaq 0x12d9b(%rip), %rsi     # 0x28ee9
movl $0x7c4, %edx            # imm = 0x7C4
leaq 0x12878(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x16171
jmp 0x16173
cmpq $0x0, -0x20(%rbp)
jne 0x161ab
jmp 0x1617c
leaq 0x11149(%rip), %rdi     # 0x272cc
leaq 0x12d79(%rip), %rsi     # 0x28f03
movl $0x7c5, %edx            # imm = 0x7C5
leaq 0x1283c(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x161ad
movb $0x0, -0x33(%rbp)
movw $0x80, -0x32(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x3c(%rbp)
movzbl -0x33(%rbp), %eax
movw %ax, -0x36(%rbp)
movl -0xc(%rbp), %edi
callq 0x251f0
movl -0x3c(%rbp), %edi
movw -0x36(%rbp), %si
movl %eax, %ecx
movw -0x22(%rbp), %r8w
movw 0x10(%rbp), %ax
xorl %edx, %edx
movzwl %si, %esi
movzwl %r8w, %r8d
movzwl %ax, %r9d
movl $0x14, (%rsp)
movzwl -0x32(%rbp), %eax
movl %eax, 0x8(%rsp)
callq 0x16250
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x16211
jmp 0x1620d
jmp 0x1620f
jmp 0x1623b
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %edx, %edx
movzbl -0x33(%rbp), %ecx
callq 0x163d0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x16500
jmp 0x1623b
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl %r8d, -0x30(%rbp)
movl %ecx, %eax
movl -0x30(%rbp), %ecx
movl %eax, -0x2c(%rbp)
movl %edx, %eax
movl -0x2c(%rbp), %edx
movl %eax, -0x28(%rbp)
movl %esi, %eax
movl -0x28(%rbp), %esi
movl %eax, -0x24(%rbp)
movl %edi, %r8d
movl -0x24(%rbp), %edi
movw %r9w, %ax
movw 0x18(%rbp), %r9w
movb 0x10(%rbp), %r9b
movl %r8d, -0x4(%rbp)
movw %di, -0x6(%rbp)
movw %si, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movw %cx, -0xe(%rbp)
movw %ax, -0x10(%rbp)
movzwl -0x6(%rbp), %eax
addl $0x14, %eax
movzwl -0x8(%rbp), %ecx
addl %ecx, %eax
movl $0x36, %edi
movl $0x280, %edx            # imm = 0x280
movzwl %ax, %esi
callq 0x6e20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x163b8
jmp 0x162ce
movq -0x20(%rbp), %rax
movzwl 0x12(%rax), %eax
movzwl -0x6(%rbp), %ecx
addl $0x14, %ecx
cmpl %ecx, %eax
jge 0x16312
jmp 0x162e3
leaq 0x10fe2(%rip), %rdi     # 0x272cc
leaq 0x12eaf(%rip), %rsi     # 0x291a0
movl $0x724, %edx            # imm = 0x724
leaq 0x126d5(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x16314
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movzwl -0xe(%rbp), %edi
callq 0x251c0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, (%rax)
movzwl -0x10(%rbp), %edi
callq 0x251c0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x2(%rax)
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0x4(%rbp), %edi
callq 0x251f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movzwl -0x6(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
addl $0x5, %eax
shll $0xc, %eax
movzwl %ax, %eax
movzbl 0x10(%rbp), %ecx
orl %ecx, %eax
movzwl %ax, %edi
callq 0x251c0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xc(%rax)
movzwl 0x18(%rbp), %edi
callq 0x251c0
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0xe(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x10(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x12(%rax)
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp_out.c
// Function: tcp_output_fill_options
static void
tcp_output_fill_options(const struct tcp_pcb *pcb, struct pbuf *p, u8_t optflags, u8_t num_sacks)
{
  struct tcp_hdr *tcphdr;
  u32_t *opts;
  u16_t sacks_len = 0;

  LWIP_ASSERT("tcp_output_fill_options: invalid pbuf", p != NULL);

  tcphdr = (struct tcp_hdr *)p->payload;
  opts = (u32_t *)(void *)(tcphdr + 1);

  /* NB. MSS and window scale options are only sent on SYNs, so ignore them here */

#if LWIP_TCP_TIMESTAMPS
  if (optflags & TF_SEG_OPTS_TS) {
    tcp_build_timestamp_option(pcb, opts);
    opts += 3;
  }
#endif

#if LWIP_TCP_SACK_OUT
  if (pcb && (num_sacks > 0)) {
    tcp_build_sack_option(pcb, opts, num_sacks);
    /* 1 word for SACKs header (including 2xNOP), and 2 words for each SACK */
    sacks_len = 1 + num_sacks * 2;
    opts += sacks_len;
  }
#else
  LWIP_UNUSED_ARG(num_sacks);
#endif

#ifdef LWIP_HOOK_TCP_OUT_ADD_TCPOPTS
  opts = LWIP_HOOK_TCP_OUT_ADD_TCPOPTS(p, tcphdr, pcb, opts);
#endif

  LWIP_UNUSED_ARG(pcb);
  LWIP_UNUSED_ARG(sacks_len);
  LWIP_ASSERT("options not filled", (u8_t *)opts == ((u8_t *)(tcphdr + 1)) + sacks_len * 4 + LWIP_TCP_OPT_LENGTH_SEGMENT(optflags, pcb));
  LWIP_UNUSED_ARG(optflags); /* for LWIP_NOASSERT */
  LWIP_UNUSED_ARG(opts); /* for LWIP_NOASSERT */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %cl, %al
movb %dl, %cl
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %cl, -0x11(%rbp)
movb %al, -0x12(%rbp)
movw $0x0, -0x2a(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x16428
jmp 0x163f9
leaq 0x10ecc(%rip), %rdi     # 0x272cc
leaq 0x12dc7(%rip), %rsi     # 0x291ce
movl $0x756, %edx            # imm = 0x756
leaq 0x125bf(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x1642a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x14, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
addq $0x14, %rcx
movzwl -0x2a(%rbp), %edx
shll $0x2, %edx
movslq %edx, %rdx
addq %rdx, %rcx
movzbl -0x11(%rbp), %edi
andl $0x1, %edi
xorl %edx, %edx
movl $0x4, %esi
cmpl $0x0, %edi
cmovnel %esi, %edx
movslq %edx, %rdx
addq %rdx, %rcx
movzbl -0x11(%rbp), %esi
andl $0x2, %esi
xorl %edx, %edx
cmpl $0x0, %esi
cmovnel %edx, %edx
movslq %edx, %rdx
addq %rdx, %rcx
movzbl -0x11(%rbp), %esi
andl $0x8, %esi
xorl %edx, %edx
cmpl $0x0, %esi
cmovnel %edx, %edx
movslq %edx, %rdx
addq %rdx, %rcx
movzbl -0x11(%rbp), %esi
andl $0x10, %esi
xorl %edx, %edx
cmpl $0x0, %esi
cmovnel %edx, %edx
movslq %edx, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
je 0x164ea
jmp 0x164bb
leaq 0x10e0a(%rip), %rdi     # 0x272cc
leaq 0x12c7d(%rip), %rsi     # 0x29146
movl $0x775, %edx            # imm = 0x775
leaq 0x124fd(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x164ec
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %dx, %ax
movw %si, %dx
movq %rdi, -0x8(%rbp)
movw %dx, -0xa(%rbp)
movw %ax, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x166c5
jmp 0x16696
leaq 0x10c2f(%rip), %rdi     # 0x272cc
leaq 0x12b79(%rip), %rsi     # 0x2921d
movl $0x742, %edx            # imm = 0x742
leaq 0x12322(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x166c7
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %edi
movw -0xa(%rbp), %si
movw -0xc(%rbp), %dx
movl -0x10(%rbp), %ecx
movq -0x8(%rbp), %rax
movw 0x4e(%rax), %r8w
movq -0x8(%rbp), %rax
movw 0x50(%rax), %r9w
movq -0x8(%rbp), %rax
movzwl %si, %esi
movzwl %dx, %edx
movzwl %r8w, %r8d
movzwl %r9w, %r9d
movl $0x10, (%rsp)
movzwl 0x62(%rax), %eax
movl %eax, 0x8(%rsp)
callq 0x16250
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x16734
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %ecx
movq -0x8(%rbp), %rax
movzwl 0x62(%rax), %eax
addl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movb $0x0, -0x21(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x16788
jmp 0x16759
leaq 0x10b6c(%rip), %rdi     # 0x272cc
leaq 0x127d7(%rip), %rsi     # 0x28f3e
movl $0x824, %edx            # imm = 0x824
leaq 0x1225f(%rip), %rcx     # 0x289d2
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x1678a
jmp 0x1678c
jmp 0x1678e
jmp 0x16790
movq -0x10(%rbp), %rax
movzbl 0x2c(%rax), %eax
cmpl $0x6, %eax
jne 0x167a3
jmp 0x1679f
jmp 0x167a1
jmp 0x167a9
jmp 0x167a5
jmp 0x167a7
jmp 0x167a9
jmp 0x167ab
jmp 0x167ad
jmp 0x167af
jmp 0x167b1
jmp 0x167b3
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movzbl -0x21(%rbp), %eax
movw %ax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl 0x88(%rax), %edi
subl $0x1, %edi
callq 0x251f0
movq -0x30(%rbp), %rdi
movl %eax, %ecx
movw -0x24(%rbp), %ax
xorl %edx, %edx
movzwl %ax, %esi
callq 0x16670
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x167fe
jmp 0x167f6
jmp 0x167f8
movb $-0x1, -0x1(%rbp)
jmp 0x16835
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
movzbl -0x21(%rbp), %ecx
callq 0x163d0
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x10(%rbp), %rcx
addq $0x18, %rcx
callq 0x16500
movb %al, -0x11(%rbp)
jmp 0x1682f
movb -0x11(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
callq 0xa690
leaq 0x18d90(%rip), %rax     # 0x2f908
cmpq $0x0, (%rax)
jne 0x16b8b
leaq 0x18d8b(%rip), %rax     # 0x2f910
cmpq $0x0, (%rax)
je 0x16ba9
movl $0xfa, %edi
leaq -0x37(%rip), %rsi       # 0x16b60
xorl %eax, %eax
movl %eax, %edx
leaq 0x126cb(%rip), %rcx     # 0x2926d
callq 0x16ae0
jmp 0x16bb3
movl $0x0, 0x18ddd(%rip)     # 0x2f990
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/timeouts.c
// Function: lwip_cyclic_timer
void
lwip_cyclic_timer(void *arg)
{
  u32_t now;
  u32_t next_timeout_time;
  const struct lwip_cyclic_timer *cyclic = (const struct lwip_cyclic_timer *)arg;

#if LWIP_DEBUG_TIMERNAMES
  LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: %s()\n", cyclic->handler_name));
#endif
  cyclic->handler();

  now = sys_now();
  next_timeout_time = (u32_t)(current_timeout_due_time + cyclic->interval_ms);  /* overflow handled by TIME_LESS_THAN macro */ 
  if (TIME_LESS_THAN(next_timeout_time, now)) {
    /* timer would immediately expire again -> "overload" -> restart without any correction */
#if LWIP_DEBUG_TIMERNAMES
    sys_timeout_abs((u32_t)(now + cyclic->interval_ms), lwip_cyclic_timer, arg, cyclic->handler_name);
#else
    sys_timeout_abs((u32_t)(now + cyclic->interval_ms), lwip_cyclic_timer, arg);
#endif

  } else {
    /* correct cyclic interval with handler execution delay and sys_check_timeouts jitter */
#if LWIP_DEBUG_TIMERNAMES
    sys_timeout_abs(next_timeout_time, lwip_cyclic_timer, arg, cyclic->handler_name);
#else
    sys_timeout_abs(next_timeout_time, lwip_cyclic_timer, arg);
#endif
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x16c36
movq -0x18(%rbp), %rax
callq *0x8(%rax)
callq 0x25180
movl %eax, -0xc(%rbp)
movl 0x18d55(%rip), %eax     # 0x2f9a0
movq -0x18(%rbp), %rcx
addl (%rcx), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
subl -0xc(%rbp), %eax
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jbe 0x16c69
movb $0x1, %al
testb $0x1, %al
jne 0x16c71
jmp 0x16c94
xorl %eax, %eax
testb $0x1, %al
jne 0x16c71
jmp 0x16c94
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rax
addl (%rax), %edi
movq -0x8(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
leaq -0x6d(%rip), %rsi       # 0x16c20
callq 0x16cc0
jmp 0x16caf
movl -0x10(%rbp), %edi
movq -0x8(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
leaq -0x8a(%rip), %rsi       # 0x16c20
callq 0x16cc0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/timeouts.c
// Function: sys_untimeout
void
sys_untimeout(sys_timeout_handler handler, void *arg)
{
  struct sys_timeo *prev_t, *t;

  LWIP_ASSERT_CORE_LOCKED();

  if (next_timeout == NULL) {
    return;
  }

  for (t = next_timeout, prev_t = NULL; t != NULL; prev_t = t, t = t->next) {
    if ((t->h == handler) && (t->arg == arg)) {
      /* We have a match */
      /* Unlink from previous in list */
      if (prev_t == NULL) {
        next_timeout = t->next;
      } else {
        prev_t->next = t->next;
      }
      memp_free(MEMP_SYS_TIMEOUT, t);
      return;
    }
  }
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, 0x18b40(%rip)     # 0x2f998
jne 0x16e5f
jmp 0x16ee3
movq 0x18b32(%rip), %rax     # 0x2f998
movq %rax, -0x20(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x16ee1
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x16eca
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0x16eca
cmpq $0x0, -0x18(%rbp)
jne 0x16eac
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x18aee(%rip)     # 0x2f998
jmp 0x16eba
movq -0x20(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rsi
movl $0x7, %edi
callq 0x4a80
jmp 0x16ee3
jmp 0x16ecc
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x16e72
jmp 0x16ee3
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/timeouts.c
// Function: sys_check_timeouts
void
sys_check_timeouts(void)
{
  u32_t now;

  LWIP_ASSERT_CORE_LOCKED();

  /* Process only timers expired at the start of the function. */
  now = sys_now();

  do {
    struct sys_timeo *tmptimeout;
    sys_timeout_handler handler;
    void *arg;

    PBUF_CHECK_FREE_OOSEQ();

    tmptimeout = next_timeout;
    if (tmptimeout == NULL) {
      return;
    }

    if (TIME_LESS_THAN(now, tmptimeout->time)) {
      return;
    }

    /* Timeout has expired */
    next_timeout = tmptimeout->next;
    handler = tmptimeout->h;
    arg = tmptimeout->arg;
    current_timeout_due_time = tmptimeout->time;
#if LWIP_DEBUG_TIMERNAMES
    if (handler != NULL) {
      LWIP_DEBUGF(TIMERS_DEBUG, ("sct calling h=%s t=%"U32_F" arg=%p\n",
                                 tmptimeout->handler_name, sys_now() - tmptimeout->time, arg));
    }
#endif /* LWIP_DEBUG_TIMERNAMES */
    memp_free(MEMP_SYS_TIMEOUT, tmptimeout);
    if (handler != NULL) {
      handler(arg);
    }
    LWIP_TCPIP_THREAD_ALIVE();

    /* Repeat until all expired timers have been called */
  } while (1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
callq 0x25180
movl %eax, -0x4(%rbp)
jmp 0x16f02
leaq 0x189df(%rip), %rax     # 0x2f8e8
movb (%rax), %al
cmpb $0x0, %al
je 0x16f14
callq 0x6dc0
jmp 0x16f16
movq 0x18a7b(%rip), %rax     # 0x2f998
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x16f2d
jmp 0x16fbd
movl -0x4(%rbp), %eax
movq -0x10(%rbp), %rcx
subl 0x8(%rcx), %eax
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jbe 0x16f46
movb $0x1, %al
testb $0x1, %al
jne 0x16f4e
jmp 0x16f50
xorl %eax, %eax
testb $0x1, %al
jne 0x16f4e
jmp 0x16f50
jmp 0x16fbd
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x18a3a(%rip)     # 0x2f998
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, 0x18a1d(%rip)     # 0x2f9a0
cmpq $0x0, -0x18(%rbp)
je 0x16f90
jmp 0x16f8c
jmp 0x16f8e
jmp 0x16f90
movq -0x10(%rbp), %rsi
movl $0x7, %edi
callq 0x4a80
cmpq $0x0, -0x18(%rbp)
je 0x16faf
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rdi
callq *%rax
jmp 0x16fb1
movb $0x1, %al
testb $0x1, %al
jne 0x16f00
jmp 0x16fbd
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/timeouts.c
// Function: sys_restart_timeouts
void
sys_restart_timeouts(void)
{
  u32_t now;
  u32_t base;
  struct sys_timeo *t;

  if (next_timeout == NULL) {
    return;
  }

  now = sys_now();
  base = next_timeout->time;

  for (t = next_timeout; t != NULL; t = t->next) {
    t->time = (t->time - base) + now;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpq $0x0, 0x189b8(%rip)     # 0x2f998
jne 0x16fe4
jmp 0x1702c
callq 0x25180
movl %eax, -0x4(%rbp)
movq 0x189a5(%rip), %rax     # 0x2f998
movl 0x8(%rax), %eax
movl %eax, -0x8(%rbp)
movq 0x18998(%rip), %rax     # 0x2f998
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1702c
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
subl -0x8(%rbp), %ecx
addl -0x4(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x17004
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/timeouts.c
// Function: sys_timeouts_sleeptime
u32_t
sys_timeouts_sleeptime(void)
{
  u32_t now;

  LWIP_ASSERT_CORE_LOCKED();

  if (next_timeout == NULL) {
    return SYS_TIMEOUTS_SLEEPTIME_INFINITE;
  }
  now = sys_now();
  if (TIME_LESS_THAN(next_timeout->time, now)) {
    return 0;
  } else {
    u32_t ret = (u32_t)(next_timeout->time - now);
    LWIP_ASSERT("invalid sleeptime", ret <= LWIP_MAX_TIMEOUT);
    return ret;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpq $0x0, 0x18948(%rip)     # 0x2f998
jne 0x1705e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x170e5
callq 0x25180
movl %eax, -0x8(%rbp)
movq 0x1892b(%rip), %rax     # 0x2f998
movl 0x8(%rax), %eax
subl -0x8(%rbp), %eax
cmpl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jbe 0x17082
movb $0x1, %al
testb $0x1, %al
jne 0x1708a
jmp 0x17093
xorl %eax, %eax
testb $0x1, %al
jne 0x1708a
jmp 0x17093
movl $0x0, -0x4(%rbp)
jmp 0x170e5
movq 0x188fe(%rip), %rax     # 0x2f998
movl 0x8(%rax), %eax
subl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
cmpl $0x7fffffff, -0xc(%rbp) # imm = 0x7FFFFFFF
jbe 0x170dd
jmp 0x170ae
leaq 0x10217(%rip), %rdi     # 0x272cc
leaq 0x12228(%rip), %rsi     # 0x292e4
movl $0x1b8, %edx            # imm = 0x1B8
leaq 0x121fd(%rip), %rcx     # 0x292c5
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x170df
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/udp.c
// Function: udp_debug_print
void
udp_debug_print(struct udp_hdr *udphdr)
{
  LWIP_DEBUGF(UDP_DEBUG, ("UDP header:\n"));
  LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n"));
  LWIP_DEBUGF(UDP_DEBUG, ("|     %5"U16_F"     |     %5"U16_F"     | (src port, dest port)\n",
                          lwip_ntohs(udphdr->src), lwip_ntohs(udphdr->dest)));
  LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n"));
  LWIP_DEBUGF(UDP_DEBUG, ("|     %5"U16_F"     |     0x%04"X16_F"    | (len, chksum)\n",
                          lwip_ntohs(udphdr->len), lwip_ntohs(udphdr->chksum)));
  LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n"));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
jmp 0x1749a
jmp 0x1749c
jmp 0x1749e
jmp 0x174a0
jmp 0x174a2
jmp 0x174a4
jmp 0x174a6
jmp 0x174a8
jmp 0x174aa
jmp 0x174ac
jmp 0x174ae
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x174f8
jmp 0x174c9
leaq 0xfdfc(%rip), %rdi      # 0x272cc
leaq 0x11ec7(%rip), %rsi     # 0x2939e
movl $0x1e6, %edx            # imm = 0x1E6
leaq 0x11e6d(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x174fa
jmp 0x174fc
cmpq $0x0, -0x18(%rbp)
jne 0x17534
jmp 0x17505
leaq 0xfdc0(%rip), %rdi      # 0x272cc
leaq 0x11ea1(%rip), %rsi     # 0x293b4
movl $0x1e7, %edx            # imm = 0x1E7
leaq 0x11e31(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x17536
movq -0x10(%rbp), %rax
movzbl 0x2c(%rax), %eax
cmpl $0x2e, %eax
jne 0x17549
movb $-0x6, -0x1(%rbp)
jmp 0x1754d
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %cx, %ax
movb %dl, %cl
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %cl, -0x19(%rbp)
movw %ax, -0x1c(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x175b4
jmp 0x17585
leaq 0xfd40(%rip), %rdi      # 0x272cc
leaq 0x11e38(%rip), %rsi     # 0x293cb
movl $0x1fe, %edx            # imm = 0x1FE
leaq 0x11db1(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x175b6
jmp 0x175b8
cmpq $0x0, -0x18(%rbp)
jne 0x175f0
jmp 0x175c1
leaq 0xfd04(%rip), %rdi      # 0x272cc
leaq 0x11e19(%rip), %rsi     # 0x293e8
movl $0x1ff, %edx            # imm = 0x1FF
leaq 0x11d75(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x175f2
movq -0x10(%rbp), %rax
movzbl 0x2c(%rax), %eax
cmpl $0x2e, %eax
jne 0x17605
movb $-0x6, -0x1(%rbp)
jmp 0x17609
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/udp.c
// Function: udp_new_port
static u16_t
udp_new_port(void)
{
  u16_t n = 0;
  struct udp_pcb *pcb;

again:
  if (udp_port++ == UDP_LOCAL_PORT_RANGE_END) {
    udp_port = UDP_LOCAL_PORT_RANGE_START;
  }
  /* Check all PCBs. */
  for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
    if (pcb->local_port == udp_port) {
      if (++n > (UDP_LOCAL_PORT_RANGE_END - UDP_LOCAL_PORT_RANGE_START)) {
        return 0;
      }
      goto again;
    }
  }
  return udp_port;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw $0x0, -0x4(%rbp)
movw 0x16b8f(%rip), %ax      # 0x2f150
movw %ax, %cx
addw $0x1, %cx
movw %cx, 0x16b81(%rip)      # 0x2f150
movzwl %ax, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0x185e2
movw $0xc000, 0x16b6e(%rip)  # imm = 0xC000
movq 0x173bf(%rip), %rax     # 0x2f9a8
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x18637
movq -0x10(%rbp), %rax
movzwl 0x42(%rax), %eax
movzwl 0x16b4d(%rip), %ecx     # 0x2f150
cmpl %ecx, %eax
jne 0x18627
movw -0x4(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x4(%rbp)
movzwl %ax, %eax
cmpl $0x3fff, %eax           # imm = 0x3FFF
jle 0x18625
movw $0x0, -0x2(%rbp)
jmp 0x18642
jmp 0x185ba
jmp 0x18629
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x185ed
movw 0x16b12(%rip), %ax      # 0x2f150
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/udp.c
// Function: udp_bind_netif
void
udp_bind_netif(struct udp_pcb *pcb, const struct netif *netif)
{
  LWIP_ASSERT_CORE_LOCKED();

  if (netif != NULL) {
    pcb->netif_idx = netif_get_index(netif);
  } else {
    pcb->netif_idx = NETIF_NO_INDEX;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1867c
movq -0x10(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x30(%rax)
jmp 0x18684
movq -0x8(%rbp), %rax
movb $0x0, 0x30(%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x18d14
jmp 0x18ce5
leaq 0xe5e0(%rip), %rdi      # 0x272cc
leaq 0x10920(%rip), %rsi     # 0x29613
movl $0x50f, %edx            # imm = 0x50F
leaq 0x10651(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x18d16
movq 0x16c8b(%rip), %rax     # 0x2f9a8
cmpq -0x8(%rbp), %rax
jne 0x18d37
movq 0x16c7e(%rip), %rax     # 0x2f9a8
movq 0x38(%rax), %rax
movq %rax, 0x16c73(%rip)     # 0x2f9a8
jmp 0x18d86
movq 0x16c6a(%rip), %rax     # 0x2f9a8
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x18d84
movq -0x10(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x18d74
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x18d74
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0x18d84
jmp 0x18d76
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x18d42
jmp 0x18d86
movq -0x8(%rbp), %rsi
movl $0x1, %edi
callq 0x4a80
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
callq 0x18da0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x18e18
jmp 0x18e00
movb -0x1(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x14(%rax)
jmp 0x18e0c
movb -0x1(%rbp), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x2c(%rax)
jmp 0x18e18
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %r8d, -0x48(%rbp)
movl %ecx, %eax
movl -0x48(%rbp), %ecx
movl %eax, -0x44(%rbp)
movq %rdx, %rax
movl -0x44(%rbp), %edx
movq %rax, -0x40(%rbp)
movq %rsi, %rax
movq -0x40(%rbp), %rsi
movq %rax, -0x38(%rbp)
movq %rdi, %r8
movq -0x38(%rbp), %rdi
movb %r9b, %al
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movb %dl, -0x21(%rbp)
movb %cl, -0x22(%rbp)
movb %al, -0x23(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x16(%rax), %eax
cmpl $0x1, %eax
je 0x1a0e6
jmp 0x1a0b7
leaq 0xd20e(%rip), %rdi      # 0x272cc
leaq 0xf619(%rip), %rsi      # 0x296de
movl $0x416, %edx            # imm = 0x416
leaq 0xf619(%rip), %rcx      # 0x296ea
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x1a0e8
movq -0x20(%rbp), %rdi
callq 0x196c0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x1a105
jmp 0x1a0fd
jmp 0x1a0ff
movb $-0x4, -0x1(%rbp)
jmp 0x1a137
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movb -0x21(%rbp), %cl
movb -0x22(%rbp), %r8b
movb -0x23(%rbp), %r9b
movq -0x30(%rbp), %rax
movzbl %cl, %ecx
movzbl %r8b, %r8d
movzbl %r9b, %r9d
movq %rax, (%rsp)
callq 0x19c10
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x50, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv4/ip4_addr.c
// Function: ip4_addr_isbroadcast_u32
u8_t
ip4_addr_isbroadcast_u32(u32_t addr, const struct netif *netif)
{
  ip4_addr_t ipaddr;
  ip4_addr_set_u32(&ipaddr, addr);

  /* all ones (broadcast) or all zeroes (old skool broadcast) */
  if ((~addr == IPADDR_ANY) ||
      (addr == IPADDR_ANY)) {
    return 1;
    /* no broadcast support on this network interface? */
  } else if ((netif->flags & NETIF_FLAG_BROADCAST) == 0) {
    /* the given address cannot be a broadcast address
     * nor can we check against any broadcast addresses */
    return 0;
    /* address matches network interface address exactly? => no broadcast */
  } else if (addr == ip4_addr_get_u32(netif_ip4_addr(netif))) {
    return 0;
    /*  on the same (sub) network... */
  } else if (ip4_addr_netcmp(&ipaddr, netif_ip4_addr(netif), netif_ip4_netmask(netif))
             /* ...and host identifier bits are all ones? =>... */
             && ((addr & ~ip4_addr_get_u32(netif_ip4_netmask(netif))) ==
                 (IPADDR_BROADCAST & ~ip4_addr_get_u32(netif_ip4_netmask(netif))))) {
    /* => network broadcast address */
    return 1;
  } else {
    return 0;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x8(%rbp), %eax
xorl $-0x1, %eax
cmpl $0x0, %eax
je 0x1a162
cmpl $0x0, -0x8(%rbp)
jne 0x1a168
movb $0x1, -0x1(%rbp)
jmp 0x1a1dc
movq -0x10(%rbp), %rax
movzbl 0xeb(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x1a181
movb $0x0, -0x1(%rbp)
jmp 0x1a1dc
movl -0x8(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x1a193
movb $0x0, -0x1(%rbp)
jmp 0x1a1dc
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
andl 0x20(%rcx), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
movq -0x10(%rbp), %rdx
andl 0x20(%rdx), %ecx
cmpl %ecx, %eax
jne 0x1a1d8
movl -0x8(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x20(%rcx), %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
movq -0x10(%rbp), %rcx
movl 0x20(%rcx), %ecx
xorl $-0x1, %ecx
andl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x1a1d8
movb $0x1, -0x1(%rbp)
jmp 0x1a1dc
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %edi
callq 0x251f0
movl %eax, -0x10(%rbp)
movl $0x80000000, -0xc(%rbp) # imm = 0x80000000
cmpl $0x0, -0xc(%rbp)
je 0x1a22c
movl -0x10(%rbp), %eax
andl -0xc(%rbp), %eax
cmpl $0x0, %eax
jne 0x1a220
jmp 0x1a22c
jmp 0x1a222
movl -0xc(%rbp), %eax
shrl %eax
movl %eax, -0xc(%rbp)
jmp 0x1a20d
jmp 0x1a22e
cmpl $0x0, -0xc(%rbp)
je 0x1a251
movl -0x10(%rbp), %eax
andl -0xc(%rbp), %eax
cmpl $0x0, %eax
je 0x1a245
movb $0x0, -0x1(%rbp)
jmp 0x1a255
jmp 0x1a247
movl -0xc(%rbp), %eax
shrl %eax
movl %eax, -0xc(%rbp)
jmp 0x1a22e
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x10, %rsp
popq %rbp
retq
nop