// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_input
raw_input_state_t
raw_input(struct pbuf *p, struct netif *inp)
{
  struct raw_pcb *pcb, *prev;
  s16_t proto;
  raw_input_state_t ret = RAW_INPUT_NONE;
  u8_t broadcast = ip_addr_isbroadcast(ip_current_dest_addr(), ip_current_netif());

  LWIP_UNUSED_ARG(inp);

#if LWIP_IPV6
#if LWIP_IPV4
  if (IP_HDR_GET_VERSION(p->payload) == 6)
#endif /* LWIP_IPV4 */
  {
    struct ip6_hdr *ip6hdr = (struct ip6_hdr *)p->payload;
    proto = IP6H_NEXTH(ip6hdr);
  }
#if LWIP_IPV4
  else
#endif /* LWIP_IPV4 */
#endif /* LWIP_IPV6 */
#if LWIP_IPV4
  {
    proto = IPH_PROTO((struct ip_hdr *)p->payload);
  }
#endif /* LWIP_IPV4 */

  prev = NULL;
  pcb = raw_pcbs;
  /* loop through all raw pcbs until the packet is eaten by one */
  /* this allows multiple pcbs to match against the packet by design */
  while (pcb != NULL) {
    if ((pcb->protocol == proto) && raw_input_local_match(pcb, broadcast) &&
        (((pcb->flags & RAW_FLAGS_CONNECTED) == 0) ||
         ip_addr_cmp(&pcb->remote_ip, ip_current_src_addr()))) {
      /* receive callback function available? */
      if (pcb->recv != NULL) {
        u8_t eaten;
#ifndef LWIP_NOASSERT
        void *old_payload = p->payload;
#endif
        ret = RAW_INPUT_DELIVERED;
        /* the receive callback function did not eat the packet? */
        eaten = pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr());
        if (eaten != 0) {
          /* receive function ate the packet */
          p = NULL;
          if (prev != NULL) {
            /* move the pcb to the front of raw_pcbs so that is
               found faster next time */
            prev->next = pcb->next;
            pcb->next = raw_pcbs;
            raw_pcbs = pcb;
          }
          return RAW_INPUT_EATEN;
        } else {
          /* sanity-check that the receive callback did not alter the pbuf */
          LWIP_ASSERT("raw pcb recv callback altered pbuf payload pointer without eating packet",
                      p->payload == old_payload);
        }
      }
      /* no receive callback function was set for this raw PCB */
    }
    /* drop the packet */
    prev = pcb;
    pcb = pcb->next;
  }
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x30(%rbp)
leaq 0x26742(%rip), %rax     # 0x2f770
movzbl 0x50(%rax), %eax
cmpl $0x6, %eax
jne 0x903e
xorl %eax, %eax
movl %eax, -0x54(%rbp)
jmp 0x905d
leaq 0x2672b(%rip), %rax     # 0x2f770
movl 0x3c(%rax), %edi
leaq 0x26721(%rip), %rax     # 0x2f770
movq (%rax), %rsi
callq 0x1a140
movzbl %al, %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movb %al, -0x31(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
sarl $0x4, %eax
cmpl $0x6, %eax
jne 0x9090
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movzbl 0x6(%rax), %eax
movw %ax, -0x2a(%rbp)
jmp 0x90a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzbl 0x9(%rax), %eax
movw %ax, -0x2a(%rbp)
movq $0x0, -0x28(%rbp)
movq 0x26841(%rip), %rax     # 0x2f8f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x92b8
movq -0x20(%rbp), %rax
movzbl 0x40(%rax), %eax
movswl -0x2a(%rbp), %ecx
cmpl %ecx, %eax
jne 0x929f
movq -0x20(%rbp), %rdi
movzbl -0x31(%rbp), %esi
callq 0x92d0
movzbl %al, %eax
cmpl $0x0, %eax
je 0x929f
movq -0x20(%rbp), %rax
movzbl 0x41(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x91c1
movq -0x20(%rbp), %rax
movzbl 0x2c(%rax), %eax
leaq 0x26662(%rip), %rcx     # 0x2f770
movzbl 0x38(%rcx), %ecx
cmpl %ecx, %eax
je 0x9125
xorl %eax, %eax
testb $0x1, %al
jne 0x91c1
jmp 0x929f
movq -0x20(%rbp), %rax
movzbl 0x2c(%rax), %eax
cmpl $0x6, %eax
jne 0x91aa
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
leaq 0x26630(%rip), %rcx     # 0x2f770
cmpl 0x24(%rcx), %eax
jne 0x929f
movq -0x20(%rbp), %rax
movl 0x1c(%rax), %eax
leaq 0x26619(%rip), %rcx     # 0x2f770
cmpl 0x28(%rcx), %eax
jne 0x929f
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
leaq 0x26602(%rip), %rcx     # 0x2f770
cmpl 0x2c(%rcx), %eax
jne 0x929f
movq -0x20(%rbp), %rax
movl 0x24(%rax), %eax
leaq 0x265eb(%rip), %rcx     # 0x2f770
cmpl 0x30(%rcx), %eax
jne 0x929f
movq -0x20(%rbp), %rax
movzbl 0x28(%rax), %eax
leaq 0x265d3(%rip), %rcx     # 0x2f770
movzbl 0x34(%rcx), %ecx
cmpl %ecx, %eax
je 0x91c1
jmp 0x929f
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
leaq 0x265b8(%rip), %rcx     # 0x2f770
cmpl 0x24(%rcx), %eax
jne 0x929f
movq -0x20(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x929d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x2, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x50(%rcx), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x2656e(%rip), %rcx     # 0x2f770
addq $0x24, %rcx
callq *%rax
movb %al, -0x41(%rbp)
movzbl -0x41(%rbp), %eax
cmpl $0x0, %eax
je 0x9256
movq $0x0, -0x10(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x924d
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x38(%rax)
movq 0x266b6(%rip), %rcx     # 0x2f8f0
movq -0x20(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x20(%rbp), %rax
movq %rax, 0x266a3(%rip)     # 0x2f8f0
movl $0x1, -0x4(%rbp)
jmp 0x92be
jmp 0x9258
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x50(%rbp), %rax
je 0x9297
jmp 0x9268
leaq 0x1e05d(%rip), %rdi     # 0x272cc
leaq 0x1ea39(%rip), %rsi     # 0x27caf
movl $0xc1, %edx
leaq 0x1ea76(%rip), %rcx     # 0x27cf8
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x9299
jmp 0x929b
jmp 0x929d
jmp 0x929f
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x90b3
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)