// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movw $0x0, -0x34(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x98(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x21a73
movq -0x10(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x30(%rbp)
jmp 0x21a7e
leaq 0x7fde(%rip), %rax      # 0x29a58
movq %rax, -0x30(%rbp)
jmp 0x21a80
movl $0x2ff, 0xe4ca(%rip)    # imm = 0x2FF
movl $0x0, 0xe4c4(%rip)      # 0x2ff58
movl $0x0, 0xe4be(%rip)      # 0x2ff5c
movl $0x2000000, 0xe4b8(%rip) # imm = 0x2000000
movb $0x0, 0xe4b5(%rip)      # 0x2ff64
movl 0xe49f(%rip), %eax      # 0x2ff54
andq $0xc0ff, %rax           # imm = 0xC0FF
cmpq $0x80fe, %rax           # imm = 0x80FE
je 0x21aeb
movl 0xe48b(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x1ff, %rax            # imm = 0x1FF
je 0x21aeb
movl 0xe477(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x2ff, %rax            # imm = 0x2FF
jne 0x21b01
movq -0x10(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movzbl %al, %eax
movl %eax, -0x38(%rbp)
jmp 0x21b08
xorl %eax, %eax
movl %eax, -0x38(%rbp)
jmp 0x21b08
movl -0x38(%rbp), %eax
movb %al, 0xe453(%rip)       # 0x2ff64
leaq 0x7f40(%rip), %rax      # 0x29a58
cmpq %rax, -0x30(%rbp)
je 0x21b53
movq -0x10(%rbp), %rax
movzbl 0xea(%rax), %eax
addl $0x2, %eax
sarl $0x3, %eax
movq -0x10(%rbp), %rcx
movzbl 0xea(%rcx), %esi
addl $0x2, %esi
andl $0x7, %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movw %ax, -0x34(%rbp)
movzwl -0x34(%rbp), %eax
shll $0x3, %eax
cltq
addq $0x8, %rax
movl $0x36, %edi
movl $0x280, %edx            # imm = 0x280
movzwl %ax, %esi
callq 0x6e20
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x21b86
movb $-0x2, -0x1(%rbp)
jmp 0x21c9c
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb $-0x7b, (%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x18(%rbp), %rax
movw $0x0, 0x2(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
leaq 0x7e9b(%rip), %rax      # 0x29a58
cmpq %rax, -0x30(%rbp)
je 0x21c0c
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb $0x1, (%rax)
movw -0x34(%rbp), %ax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x20(%rbp), %rdi
addq $0x2, %rdi
movq -0x10(%rbp), %rsi
addq $0xe4, %rsi
movq -0x10(%rbp), %rax
movzbl 0xea(%rax), %eax
movl %eax, %edx
callq 0x2180
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movw 0x12(%rax), %ax
movq -0x30(%rbp), %rcx
movl $0x3a, %esi
leaq 0xe32c(%rip), %r8       # 0x2ff54
movzwl %ax, %edx
callq 0x25900
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
leaq 0x7e0e(%rip), %rax      # 0x29a58
cmpq %rax, -0x30(%rbp)
jne 0x21c58
xorl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x21c60
movq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x10(%rbp), %rax
leaq 0xe2e1(%rip), %rdx      # 0x2ff54
movl $0xff, %ecx
xorl %r8d, %r8d
movl $0x3a, %r9d
movq %rax, (%rsp)
callq 0x1d560
movb %al, -0x31(%rbp)
movq -0x28(%rbp), %rdi
callq 0x7260
movb -0x31(%rbp), %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)