// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_send_na
static void
nd6_send_na(struct netif *netif, const ip6_addr_t *target_addr, u8_t flags)
{
  struct na_header *na_hdr;
  struct lladdr_option *lladdr_opt;
  struct pbuf *p;
  const ip6_addr_t *src_addr;
  const ip6_addr_t *dest_addr;
  u16_t lladdr_opt_len;

  LWIP_ASSERT("target address is required", target_addr != NULL);

  /* Use link-local address as source address. */
  /* src_addr = netif_ip6_addr(netif, 0); */
  /* Use target address as source address. */
  src_addr = target_addr;

  /* Allocate a packet. */
  lladdr_opt_len = ((netif->hwaddr_len + 2) >> 3) + (((netif->hwaddr_len + 2) & 0x07) ? 1 : 0);
  p = pbuf_alloc(PBUF_IP, sizeof(struct na_header) + (lladdr_opt_len << 3), PBUF_RAM);
  if (p == NULL) {
    ND6_STATS_INC(nd6.memerr);
    return;
  }

  /* Set fields. */
  na_hdr = (struct na_header *)p->payload;
  lladdr_opt = (struct lladdr_option *)((u8_t*)p->payload + sizeof(struct na_header));

  na_hdr->type = ICMP6_TYPE_NA;
  na_hdr->code = 0;
  na_hdr->chksum = 0;
  na_hdr->flags = flags & 0xf0;
  na_hdr->reserved[0] = 0;
  na_hdr->reserved[1] = 0;
  na_hdr->reserved[2] = 0;
  ip6_addr_copy_to_packed(na_hdr->target_address, *target_addr);

  lladdr_opt->type = ND6_OPTION_TYPE_TARGET_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);
    dest_addr = &multicast_address;
  } else if (flags & ND6_SEND_FLAG_ALLNODES_DEST) {
    ip6_addr_set_allnodes_linklocal(&multicast_address);
    ip6_addr_assign_zone(&multicast_address, IP6_MULTICAST, netif);
    dest_addr = &multicast_address;
  } else {
    dest_addr = ip6_current_src_addr();
  }

#if CHECKSUM_GEN_ICMP6
  IF__NETIF_CHECKSUM_ENABLED(netif, NETIF_CHECKSUM_GEN_ICMP6) {
    na_hdr->chksum = ip6_chksum_pseudo(p, IP6_NEXTH_ICMP6, p->len, src_addr,
      dest_addr);
  }
#endif /* CHECKSUM_GEN_ICMP6 */

  /* Send the packet out. */
  ND6_STATS_INC(nd6.xmit);
  ip6_output_if(p, src_addr, dest_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 0x2135d
jmp 0x2132e
leaq 0x5f97(%rip), %rdi      # 0x272cc
leaq 0x8955(%rip), %rsi      # 0x29c91
movl $0x4ef, %edx            # imm = 0x4EF
leaq 0x88ff(%rip), %rcx      # 0x29c47
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x2135f
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movzbl 0xea(%rax), %eax
addl $0x2, %eax
sarl $0x3, %eax
movq -0x8(%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, -0x42(%rbp)
movzwl -0x42(%rbp), %eax
shll $0x3, %eax
cltq
addq $0x18, %rax
movl $0x36, %edi
movl $0x280, %edx            # imm = 0x280
movzwl %ax, %esi
callq 0x6e20
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x213cb
jmp 0x21673
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x18, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movb $-0x78, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x20(%rbp), %rax
movw $0x0, 0x2(%rax)
movzbl -0x11(%rbp), %eax
andl $0xf0, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x4(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x5(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x6(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x7(%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)
movq -0x28(%rbp), %rax
movb $0x2, (%rax)
movw -0x42(%rbp), %ax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x28(%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 0x21556
jmp 0x214ac
movl $0x2ff, 0xea9e(%rip)    # imm = 0x2FF
movl $0x0, 0xea98(%rip)      # 0x2ff58
movl $0x1000000, 0xea92(%rip) # imm = 0x1000000
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
orq $0xff, %rax
movl %eax, 0xea83(%rip)      # 0x2ff60
movb $0x0, 0xea80(%rip)      # 0x2ff64
movl 0xea6a(%rip), %eax      # 0x2ff54
andq $0xc0ff, %rax           # imm = 0xC0FF
cmpq $0x80fe, %rax           # imm = 0x80FE
je 0x21520
movl 0xea56(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x1ff, %rax            # imm = 0x1FF
je 0x21520
movl 0xea42(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x2ff, %rax            # imm = 0x2FF
jne 0x21536
movq -0x8(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movzbl %al, %eax
movl %eax, -0x48(%rbp)
jmp 0x2153d
xorl %eax, %eax
movl %eax, -0x48(%rbp)
jmp 0x2153d
movl -0x48(%rbp), %eax
movb %al, 0xea1e(%rip)       # 0x2ff64
leaq 0xea07(%rip), %rax      # 0x2ff54
movq %rax, -0x40(%rbp)
jmp 0x21617
movzbl -0x11(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x21606
jmp 0x21568
movl $0x2ff, 0xe9e2(%rip)    # imm = 0x2FF
movl $0x0, 0xe9dc(%rip)      # 0x2ff58
movl $0x0, 0xe9d6(%rip)      # 0x2ff5c
movl $0x1000000, 0xe9d0(%rip) # imm = 0x1000000
movb $0x0, 0xe9cd(%rip)      # 0x2ff64
movl 0xe9b7(%rip), %eax      # 0x2ff54
andq $0xc0ff, %rax           # imm = 0xC0FF
cmpq $0x80fe, %rax           # imm = 0x80FE
je 0x215d3
movl 0xe9a3(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x1ff, %rax            # imm = 0x1FF
je 0x215d3
movl 0xe98f(%rip), %eax      # 0x2ff54
andq $0x8fff, %rax           # imm = 0x8FFF
cmpq $0x2ff, %rax            # imm = 0x2FF
jne 0x215e9
movq -0x8(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movzbl %al, %eax
movl %eax, -0x4c(%rbp)
jmp 0x215f0
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x215f0
movl -0x4c(%rbp), %eax
movb %al, 0xe96b(%rip)       # 0x2ff64
leaq 0xe954(%rip), %rax      # 0x2ff54
movq %rax, -0x40(%rbp)
jmp 0x21615
leaq 0xe163(%rip), %rax      # 0x2f770
addq $0x24, %rax
movq %rax, -0x40(%rbp)
jmp 0x21617
movq -0x30(%rbp), %rdi
movq -0x30(%rbp), %rax
movw 0x12(%rax), %ax
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %r8
movl $0x3a, %esi
movzwl %ax, %edx
callq 0x25900
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x2(%rax)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x8(%rbp), %rax
movl $0xff, %ecx
xorl %r8d, %r8d
movl $0x3a, %r9d
movq %rax, (%rsp)
callq 0x1d560
movq -0x30(%rbp), %rdi
callq 0x7260
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)