// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_send_ns
static void
nd6_send_ns(struct netif *netif, const ip6_addr_t *target_addr, u8_t flags)
{
  struct ns_header *ns_hdr;
  struct pbuf *p;
  const ip6_addr_t *src_addr;
  u16_t lladdr_opt_len;

  LWIP_ASSERT("target address is required", target_addr != NULL);

  if (!(flags & ND6_SEND_FLAG_ANY_SRC) &&
      ip6_addr_isvalid(netif_ip6_addr_state(netif,0))) {
    /* Use link-local address as source address. */
    src_addr = netif_ip6_addr(netif, 0);
    /* calculate option length (in 8-byte-blocks) */
    lladdr_opt_len = ((netif->hwaddr_len + 2) + 7) >> 3;
  } else {
    src_addr = IP6_ADDR_ANY6;
    /* Option "MUST NOT be included when the source IP address is the unspecified address." */
    lladdr_opt_len = 0;
  }

  /* Allocate a packet. */
  p = pbuf_alloc(PBUF_IP, sizeof(struct ns_header) + (lladdr_opt_len << 3), PBUF_RAM);
  if (p == NULL) {
    ND6_STATS_INC(nd6.memerr);
    return;
  }

  /* Set fields. */
  ns_hdr = (struct ns_header *)p->payload;

  ns_hdr->type = ICMP6_TYPE_NS;
  ns_hdr->code = 0;
  ns_hdr->chksum = 0;
  ns_hdr->reserved = 0;
  ip6_addr_copy_to_packed(ns_hdr->target_address, *target_addr);

  if (lladdr_opt_len != 0) {
    struct lladdr_option *lladdr_opt = (struct lladdr_option *)((u8_t*)p->payload + sizeof(struct ns_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);
  }

  /* Generate the solicited node address for the target address. */
  if (flags & ND6_SEND_FLAG_MULTICAST_DEST) {
    ip6_addr_set_solicitednode(&multicast_address, target_addr->addr[3]);
    ip6_addr_assign_zone(&multicast_address, IP6_MULTICAST, netif);
    target_addr = &multicast_address;
  }

#if CHECKSUM_GEN_ICMP6
  IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_ICMP6) {
    ns_hdr->chksum = ip6_chksum_pseudo(p, IP6_NEXTH_ICMP6, p->len, src_addr,
      target_addr);
  }
#endif /* CHECKSUM_GEN_ICMP6 */

  /* Send the packet out. */
  ND6_STATS_INC(nd6.xmit);
  ip6_output_if(p, (src_addr == IP6_ADDR_ANY6) ? NULL : src_addr, target_addr,
      ND6_HOPLIM, 0, IP6_NEXTH_ICMP6, netif);
  pbuf_free(p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x234fd
jmp 0x234ce
leaq 0x3df7(%rip), %rdi      # 0x272cc
leaq 0x67b5(%rip), %rsi      # 0x29c91
movl $0x4a4, %edx            # imm = 0x4A4
leaq 0x675f(%rip), %rcx      # 0x29c47
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x234ff
movzbl -0x11(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x23544
movq -0x8(%rbp), %rax
movzbl 0x98(%rax), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x23544
movq -0x8(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movzbl 0xea(%rax), %eax
addl $0x2, %eax
addl $0x7, %eax
sarl $0x3, %eax
movw %ax, -0x32(%rbp)
jmp 0x23555
leaq 0x650d(%rip), %rax      # 0x29a58
movq %rax, -0x30(%rbp)
movw $0x0, -0x32(%rbp)
movzwl -0x32(%rbp), %eax
shll $0x3, %eax
cltq
addq $0x18, %rax
movl $0x36, %edi
movl $0x280, %edx            # imm = 0x280
movzwl %ax, %esi
callq 0x6e20
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x23584
jmp 0x23775
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb $-0x79, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x20(%rbp), %rax
movw $0x0, 0x2(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x14(%rax)
movzwl -0x32(%rbp), %eax
cmpl $0x0, %eax
je 0x2363d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x18, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movb $0x1, (%rax)
movw -0x32(%rbp), %ax
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x40(%rbp), %rdi
addq $0x2, %rdi
movq -0x8(%rbp), %rsi
addq $0xe4, %rsi
movq -0x8(%rbp), %rax
movzbl 0xea(%rax), %eax
movl %eax, %edx
callq 0x2180
movzbl -0x11(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x236f4
jmp 0x2364f
movl $0x2ff, 0xc8fb(%rip)    # imm = 0x2FF
movl $0x0, 0xc8f5(%rip)      # 0x2ff58
movl $0x1000000, 0xc8ef(%rip) # imm = 0x1000000
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
orq $0xff, %rax
movl %eax, 0xc8e0(%rip)      # 0x2ff60
movb $0x0, 0xc8dd(%rip)      # 0x2ff64
movl 0xc8c7(%rip), %eax      # 0x2ff54
andq $0xc0ff, %rax           # imm = 0xC0FF
cmpq $0x80fe, %rax           # imm = 0x80FE
je 0x236c3
movl 0xc8b3(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x1ff, %rax            # imm = 0x1FF
je 0x236c3
movl 0xc89f(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x2ff, %rax            # imm = 0x2FF
jne 0x236d9
movq -0x8(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movzbl %al, %eax
movl %eax, -0x44(%rbp)
jmp 0x236e0
xorl %eax, %eax
movl %eax, -0x44(%rbp)
jmp 0x236e0
movl -0x44(%rbp), %eax
movb %al, 0xc87b(%rip)       # 0x2ff64
leaq 0xc864(%rip), %rax      # 0x2ff54
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movw 0x12(%rax), %ax
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %r8
movl $0x3a, %esi
movzwl %ax, %edx
callq 0x25900
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x6329(%rip), %rax      # 0x29a58
cmpq %rax, -0x30(%rbp)
jne 0x2373d
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x23745
movq -0x30(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movl $0xff, %ecx
xorl %r8d, %r8d
movl $0x3a, %r9d
movq %rax, (%rsp)
callq 0x1d560
movq -0x28(%rbp), %rdi
callq 0x7260
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)