// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_send_rs
static err_t
nd6_send_rs(struct netif *netif)
{
  struct rs_header *rs_hdr;
  struct lladdr_option *lladdr_opt;
  struct pbuf *p;
  const ip6_addr_t *src_addr;
  err_t err;
  u16_t lladdr_opt_len = 0;

  /* Link-local source address, or unspecified address? */
  if (ip6_addr_isvalid(netif_ip6_addr_state(netif, 0))) {
    src_addr = netif_ip6_addr(netif, 0);
  } else {
    src_addr = IP6_ADDR_ANY6;
  }

  /* Generate the all routers target address. */
  ip6_addr_set_allrouters_linklocal(&multicast_address);
  ip6_addr_assign_zone(&multicast_address, IP6_MULTICAST, netif);

  /* Allocate a packet. */
  if (src_addr != IP6_ADDR_ANY6) {
    lladdr_opt_len = ((netif->hwaddr_len + 2) >> 3) + (((netif->hwaddr_len + 2) & 0x07) ? 1 : 0);
  }
  p = pbuf_alloc(PBUF_IP, sizeof(struct rs_header) + (lladdr_opt_len << 3), PBUF_RAM);
  if (p == NULL) {
    ND6_STATS_INC(nd6.memerr);
    return ERR_BUF;
  }

  /* Set fields. */
  rs_hdr = (struct rs_header *)p->payload;

  rs_hdr->type = ICMP6_TYPE_RS;
  rs_hdr->code = 0;
  rs_hdr->chksum = 0;
  rs_hdr->reserved = 0;

  if (src_addr != IP6_ADDR_ANY6) {
    /* Include our hw address. */
    lladdr_opt = (struct lladdr_option *)((u8_t*)p->payload + sizeof(struct rs_header));
    lladdr_opt->type = ND6_OPTION_TYPE_SOURCE_LLADDR;
    lladdr_opt->length = (u8_t)lladdr_opt_len;
    SMEMCPY(lladdr_opt->addr, netif->hwaddr, netif->hwaddr_len);
  }

#if CHECKSUM_GEN_ICMP6
  IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_ICMP6) {
    rs_hdr->chksum = ip6_chksum_pseudo(p, IP6_NEXTH_ICMP6, p->len, src_addr,
      &multicast_address);
  }
#endif /* CHECKSUM_GEN_ICMP6 */

  /* Send the packet out. */
  ND6_STATS_INC(nd6.xmit);

  err = ip6_output_if(p, (src_addr == IP6_ADDR_ANY6) ? NULL : src_addr, &multicast_address,
      ND6_HOPLIM, 0, IP6_NEXTH_ICMP6, netif);
  pbuf_free(p);

  return err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x10, 0x98(%rdi)
leaq 0x50(%rdi), %r14
leaq 0x4e78(%rip), %rax      # 0x176b0
cmoveq %rax, %r14
movaps 0x4fed(%rip), %xmm0     # 0x17830
movups %xmm0, 0xb6fa(%rip)     # 0x1df44
movb $0x0, 0xb703(%rip)      # 0x1df54
movb 0xee(%rdi), %cl
incb %cl
movb %cl, 0xb6f5(%rip)       # 0x1df54
cmpq %rax, %r14
je 0x12881
movzbl 0xea(%rbx), %eax
addl $0x2, %eax
movl %eax, %r12d
shrl $0x3, %r12d
andl $0x7, %eax
cmpl $0x1, %eax
sbbl $-0x1, %r12d
jmp 0x12884
xorl %r12d, %r12d
leal 0x8(,%r12,8), %eax
movzwl %ax, %esi
movl $0x36, %edi
movl $0x280, %edx            # imm = 0x280
callq 0x4e57
testq %rax, %rax
je 0x128df
movq %rax, %r15
movq 0x8(%rax), %rbp
movq $0x85, (%rbp)
cmpq 0xa72f(%rip), %r14      # 0x1cfe8
je 0x128e3
movb $0x1, 0x8(%rbp)
movb %r12b, 0x9(%rbp)
leaq 0xa(%rbp), %rdi
leaq 0xe4(%rbx), %rsi
movzbl 0xea(%rbx), %edx
callq 0x2180
movq %r14, %r12
jmp 0x128e6
movb $-0x2, %al
jmp 0x12935
xorl %r12d, %r12d
movzwl 0x12(%r15), %edx
leaq 0xb652(%rip), %r13      # 0x1df44
movq %r15, %rdi
movl $0x3a, %esi
movq %r14, %rcx
movq %r13, %r8
callq 0x13f92
movw %ax, 0x2(%rbp)
movq %rbx, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0xff, %ecx
xorl %r8d, %r8d
movl $0x3a, %r9d
callq 0x103a0
movl %eax, %ebx
movq %r15, %rdi
callq 0x5069
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq