// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x17bd0(%rip), %r12     # 0x1d770
movb $0x1, 0xf(%rsp)
cmpb $0x6, 0x50(%r12)
je 0x5bc2
movl 0x3c(%r12), %edi
movq (%r12), %rsi
callq 0xdfc4
testb %al, %al
sete 0xf(%rsp)
movq 0x8(%rbx), %r13
movb (%r13), %al
andb $-0x10, %al
xorl %ecx, %ecx
cmpb $0x60, %al
setne %cl
leaq (%rcx,%rcx,2), %rax
movb 0x6(%r13,%rax), %r15b
leaq 0x17d0d(%rip), %rcx     # 0x1d8f0
xorl %eax, %eax
leaq 0x24(%r12), %rdx
movq %rdx, 0x10(%rsp)
xorl %r14d, %r14d
movq %r14, %rbp
movq (%rcx), %r14
testq %r14, %r14
je 0x5d9b
cmpb %r15b, 0x40(%r14)
jne 0x5d70
movb 0x30(%r14), %cl
testb %cl, %cl
je 0x5c28
movq 0x8(%r12), %rdx
movb 0xee(%rdx), %dl
incb %dl
cmpb %dl, %cl
jne 0x5d70
movb 0x14(%r14), %dl
cmpb $0x2e, %dl
jne 0x5c75
testb $0x1, 0x41(%r14)
jne 0x5cf9
movq 0x48(%r14), %r8
testq %r8, %r8
je 0x5d70
movq 0x50(%r14), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
callq *%r8
testb %al, %al
jne 0x5d79
pushq $0x2
popq %rax
cmpq %r13, 0x8(%rbx)
je 0x5d70
jmp 0x5daa
cmpb 0x50(%r12), %dl
jne 0x5d70
cmpb $0x0, 0xf(%rsp)
je 0x5d48
movl (%r14), %ecx
cmpb $0x6, %dl
jne 0x5d5d
testl %ecx, %ecx
jne 0x5cb0
cmpl $0x0, 0x4(%r14)
jne 0x5cb0
cmpl $0x0, 0x8(%r14)
jne 0x5cb0
cmpl $0x0, 0xc(%r14)
je 0x5c31
cmpl 0x3c(%r12), %ecx
jne 0x5d70
movl 0x4(%r14), %ecx
cmpl 0x40(%r12), %ecx
jne 0x5d70
movl 0x8(%r14), %ecx
cmpl 0x44(%r12), %ecx
jne 0x5d70
movl 0xc(%r14), %ecx
cmpl 0x48(%r12), %ecx
jne 0x5d70
movb 0x10(%r14), %cl
cmpb 0x4c(%r12), %cl
je 0x5c31
jmp 0x5d70
movb 0x2c(%r14), %dl
cmpb 0x38(%r12), %dl
jne 0x5d70
movl 0x18(%r14), %ecx
movl 0x24(%r12), %esi
cmpb $0x6, %dl
jne 0x5d53
cmpl %esi, %ecx
jne 0x5d70
movl 0x1c(%r14), %ecx
cmpl 0x28(%r12), %ecx
jne 0x5d70
movl 0x20(%r14), %ecx
cmpl 0x2c(%r12), %ecx
jne 0x5d70
movl 0x24(%r14), %ecx
cmpl 0x30(%r12), %ecx
jne 0x5d70
movb 0x28(%r14), %cl
cmpb 0x34(%r12), %cl
je 0x5c3c
jmp 0x5d70
cmpl $0x0, (%r14)
jne 0x5d70
jmp 0x5c31
cmpl %esi, %ecx
je 0x5c3c
jmp 0x5d70
testl %ecx, %ecx
je 0x5c31
cmpl 0x3c(%r12), %ecx
je 0x5c31
leaq 0x38(%r14), %rcx
jmp 0x5bf2
pushq $0x1
popq %rax
testq %rbp, %rbp
je 0x5d9b
movq 0x38(%r14), %rcx
movq %rcx, 0x38(%rbp)
movq 0x17b60(%rip), %rcx     # 0x1d8f0
movq %rcx, 0x38(%r14)
movq %r14, 0x17b55(%rip)     # 0x1d8f0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe51b(%rip), %rdi      # 0x142cc
leaq 0xee2b(%rip), %rsi      # 0x14be3
leaq 0xee6d(%rip), %rcx      # 0x14c2c
movl $0xc1, %edx
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050