// File: /workspace/github_c_makefile_star2_O1/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, %rdx
leaq 0x178fc(%rip), %rbp     # 0x1d770
movb $0x1, %bl
cmpb $0x6, 0x50(%rbp)
je 0x5e93
movl 0x3c(%rbp), %edi
movq (%rbp), %rsi
movq %rdx, %rbx
callq 0xe87c
movq %rbx, %rdx
testb %al, %al
sete %bl
movq 0x8(%rdx), %rax
movb (%rax), %cl
andb $-0x10, %cl
xorl %r8d, %r8d
cmpb $0x60, %cl
setne %sil
movq 0x17a43(%rip), %rcx     # 0x1d8f0
testq %rcx, %rcx
je 0x6084
movb %sil, %r8b
leaq (%r8,%r8,2), %rsi
movb 0x6(%rax,%rsi), %r13b
xorl %r15d, %r15d
leaq 0x24(%rbp), %rax
movq %rax, 0x10(%rsp)
xorl %eax, %eax
movq %r15, %r14
movq %rcx, %r15
cmpb %r13b, 0x40(%rcx)
jne 0x601e
movb 0x30(%r15), %cl
testb %cl, %cl
je 0x5eff
movq 0x8(%rbp), %rsi
movb 0xee(%rsi), %sil
incb %sil
cmpb %sil, %cl
jne 0x601e
movb 0x14(%r15), %cl
cmpb $0x2e, %cl
jne 0x5f6b
testb $0x1, 0x41(%r15)
jne 0x5fb2
movq 0x48(%r15), %r8
testq %r8, %r8
je 0x601e
movq 0x8(%rdx), %rax
movq %rax, 0x8(%rsp)
movq 0x50(%r15), %rdi
movq %r15, %rsi
movq 0x10(%rsp), %rcx
movq %rdx, %r12
callq *%r8
movl %eax, %ecx
testb %al, %al
je 0x6002
testq %r14, %r14
je 0x5f64
movq 0x38(%r15), %rax
movq %rax, 0x38(%r14)
movq 0x17997(%rip), %rax     # 0x1d8f0
movq %rax, 0x38(%r15)
movq %r15, 0x1798c(%rip)     # 0x1d8f0
xorl %edx, %edx
jmp 0x6015
cmpb 0x50(%rbp), %cl
jne 0x601e
testb %bl, %bl
je 0x5ff7
movl (%r15), %esi
cmpb $0x6, %cl
jne 0x6037
testl %esi, %esi
jne 0x603f
cmpl $0x0, 0x4(%r15)
jne 0x603f
cmpl $0x0, 0x8(%r15)
jne 0x603f
cmpl $0x0, 0xc(%r15)
jne 0x603f
jmp 0x5f08
movb 0x2c(%r15), %r8b
cmpb 0x38(%rbp), %r8b
jne 0x601e
movl 0x18(%r15), %ecx
movl 0x24(%rbp), %esi
cmpb $0x6, %r8b
jne 0x602d
cmpl %esi, %ecx
jne 0x601e
movl 0x1c(%r15), %ecx
cmpl 0x28(%rbp), %ecx
jne 0x601e
movl 0x20(%r15), %ecx
cmpl 0x2c(%rbp), %ecx
jne 0x601e
movl 0x24(%r15), %ecx
cmpl 0x30(%rbp), %ecx
jne 0x601e
movb 0x28(%r15), %cl
cmpb 0x34(%rbp), %cl
je 0x5f13
jmp 0x601e
cmpl $0x0, (%r15)
jne 0x601e
jmp 0x5f08
movq 0x8(%rsp), %rax
cmpq %rax, 0x8(%r12)
movq %r12, %rdx
jne 0x609c
movl $0x2, %eax
testb %cl, %cl
jne 0x6095
movq 0x38(%r15), %rcx
testq %rcx, %rcx
jne 0x5ed0
jmp 0x6086
cmpl %esi, %ecx
je 0x5f13
jmp 0x601e
testl %esi, %esi
je 0x5f08
movl (%r15), %r8d
movl 0x3c(%rbp), %esi
cmpb $0x6, %cl
jne 0x6079
cmpl %esi, %r8d
jne 0x601e
movl 0x4(%r15), %ecx
cmpl 0x40(%rbp), %ecx
jne 0x601e
movl 0x8(%r15), %ecx
cmpl 0x44(%rbp), %ecx
jne 0x601e
movl 0xc(%r15), %ecx
cmpl 0x48(%rbp), %ecx
jne 0x601e
movb 0x10(%r15), %cl
cmpb 0x4c(%rbp), %cl
je 0x5f08
jmp 0x601e
cmpl %esi, %r8d
je 0x5f08
jmp 0x601e
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %eax
jmp 0x6086
leaq 0xf229(%rip), %rdi      # 0x152cc
leaq 0xfb39(%rip), %rsi      # 0x15be3
leaq 0xfb7b(%rip), %rcx      # 0x15c2c
movl $0xc1, %edx
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050