// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_poll
void
netif_poll(struct netif *netif)
{
  /* If we have a loopif, SNMP counters are adjusted for it,
   * if not they are adjusted for 'netif'. */
#if MIB2_STATS
#if LWIP_HAVE_LOOPIF
  struct netif *stats_if = &loop_netif;
#else /* LWIP_HAVE_LOOPIF */
  struct netif *stats_if = netif;
#endif /* LWIP_HAVE_LOOPIF */
#endif /* MIB2_STATS */
  SYS_ARCH_DECL_PROTECT(lev);

  LWIP_ASSERT("netif_poll: invalid netif", netif != NULL);

  /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */
  SYS_ARCH_PROTECT(lev);
  while (netif->loop_first != NULL) {
    struct pbuf *in, *in_end;
#if LWIP_LOOPBACK_MAX_PBUFS
    u8_t clen = 1;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */

    in = in_end = netif->loop_first;
    while (in_end->len != in_end->tot_len) {
      LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL);
      in_end = in_end->next;
#if LWIP_LOOPBACK_MAX_PBUFS
      clen++;
#endif /* LWIP_LOOPBACK_MAX_PBUFS */
    }
#if LWIP_LOOPBACK_MAX_PBUFS
    /* adjust the number of pbufs on queue */
    LWIP_ASSERT("netif->loop_cnt_current underflow",
                ((netif->loop_cnt_current - clen) < netif->loop_cnt_current));
    netif->loop_cnt_current = (u16_t)(netif->loop_cnt_current - clen);
#endif /* LWIP_LOOPBACK_MAX_PBUFS */

    /* 'in_end' now points to the last pbuf from 'in' */
    if (in_end == netif->loop_last) {
      /* this was the last pbuf in the list */
      netif->loop_first = netif->loop_last = NULL;
    } else {
      /* pop the pbuf off the list */
      netif->loop_first = in_end->next;
      LWIP_ASSERT("should not be null since first != last!", netif->loop_first != NULL);
    }
    /* De-queue the pbuf from its successors on the 'loop_' list. */
    in_end->next = NULL;
    SYS_ARCH_UNPROTECT(lev);

    in->if_idx = netif_get_index(netif);

    LINK_STATS_INC(link.recv);
    MIB2_STATS_NETIF_ADD(stats_if, ifinoctets, in->tot_len);
    MIB2_STATS_NETIF_INC(stats_if, ifinucastpkts);
    /* loopback packets are always IP packets! */
    if (ip_input(in, netif) != ERR_OK) {
      pbuf_free(in);
    }
    SYS_ARCH_PROTECT(lev);
  }
  SYS_ARCH_UNPROTECT(lev);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x5e74
jmp 0x5e45
leaq 0x21480(%rip), %rdi     # 0x272cc
leaq 0x21836(%rip), %rsi     # 0x27689
movl $0x4bb, %edx            # imm = 0x4BB
leaq 0x2162e(%rip), %rcx     # 0x2748d
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x5e76
jmp 0x5e78
movq -0x8(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
je 0x5fc8
movq -0x8(%rbp), %rax
movq 0xf8(%rax), %rax
movq %rax, -0x18(%rbp)
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x12(%rax), %eax
movq -0x18(%rbp), %rcx
movzwl 0x10(%rcx), %ecx
cmpl %ecx, %eax
je 0x5efd
jmp 0x5eb3
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x5eee
jmp 0x5ebf
leaq 0x21406(%rip), %rdi     # 0x272cc
leaq 0x217d6(%rip), %rsi     # 0x276a3
movl $0x4c7, %edx            # imm = 0x4C7
leaq 0x215b4(%rip), %rcx     # 0x2748d
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x5ef0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x5e9d
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x100(%rcx), %rax
jne 0x5f2e
movq -0x8(%rbp), %rax
movq $0x0, 0x100(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0xf8(%rax)
jmp 0x5f83
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xf8(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0xf8(%rax)
jne 0x5f7f
jmp 0x5f50
leaq 0x21375(%rip), %rdi     # 0x272cc
leaq 0x21772(%rip), %rsi     # 0x276d0
movl $0x4db, %edx            # imm = 0x4DB
leaq 0x21523(%rip), %rcx     # 0x2748d
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x5f81
jmp 0x5f83
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x17(%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x45c0
movsbl %al, %eax
cmpl $0x0, %eax
je 0x5fc3
movq -0x10(%rbp), %rdi
callq 0x7260
jmp 0x5e78
addq $0x20, %rsp
popq %rbp
retq
nop