// File: /workspace/github_c_makefile_star2_O2/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_create_ip6_linklocal_address
void
netif_create_ip6_linklocal_address(struct netif *netif, u8_t from_mac_48bit)
{
  u8_t i, addr_index;

  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ASSERT("netif_create_ip6_linklocal_address: invalid netif", netif != NULL);

  /* Link-local prefix. */
  ip_2_ip6(&netif->ip6_addr[0])->addr[0] = PP_HTONL(0xfe800000ul);
  ip_2_ip6(&netif->ip6_addr[0])->addr[1] = 0;

  /* Generate interface ID. */
  if (from_mac_48bit) {
    /* Assume hwaddr is a 48-bit IEEE 802 MAC. Convert to EUI-64 address. Complement Group bit. */
    ip_2_ip6(&netif->ip6_addr[0])->addr[2] = lwip_htonl((((u32_t)(netif->hwaddr[0] ^ 0x02)) << 24) |
        ((u32_t)(netif->hwaddr[1]) << 16) |
        ((u32_t)(netif->hwaddr[2]) << 8) |
        (0xff));
    ip_2_ip6(&netif->ip6_addr[0])->addr[3] = lwip_htonl((u32_t)(0xfeul << 24) |
        ((u32_t)(netif->hwaddr[3]) << 16) |
        ((u32_t)(netif->hwaddr[4]) << 8) |
        (netif->hwaddr[5]));
  } else {
    /* Use hwaddr directly as interface ID. */
    ip_2_ip6(&netif->ip6_addr[0])->addr[2] = 0;
    ip_2_ip6(&netif->ip6_addr[0])->addr[3] = 0;

    addr_index = 3;
    for (i = 0; (i < 8) && (i < netif->hwaddr_len); i++) {
      if (i == 4) {
        addr_index--;
      }
      ip_2_ip6(&netif->ip6_addr[0])->addr[addr_index] |= lwip_htonl(((u32_t)(netif->hwaddr[netif->hwaddr_len - i - 1])) << (8 * (i & 0x03)));
    }
  }

  /* Set a link-local zone. Even though the zone is implied by the owning
   * netif, setting the zone anyway has two important conceptual advantages:
   * 1) it avoids the need for a ton of exceptions in internal code, allowing
   *    e.g. ip6_addr_cmp() to be used on local addresses;
   * 2) the properly zoned address is visible externally, e.g. when any outside
   *    code enumerates available addresses or uses one to bind a socket.
   * Any external code unaware of address scoping is likely to just ignore the
   * zone field, so this should not create any compatibility problems. */
  ip6_addr_assign_zone(ip_2_ip6(&netif->ip6_addr[0]), IP6_UNICAST, netif);

  /* Set address state. */
#if LWIP_IPV6_DUP_DETECT_ATTEMPTS
  /* Will perform duplicate address detection (DAD). */
  netif_ip6_addr_set_state(netif, 0, IP6_ADDR_TENTATIVE);
#else
  /* Consider address valid. */
  netif_ip6_addr_set_state(netif, 0, IP6_ADDR_PREFERRED);
#endif /* LWIP_IPV6_AUTOCONFIG */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x49fc
movq %rdi, %rbx
movq $0x80fe, 0x50(%rdi)     # imm = 0x80FE
testb %sil, %sil
je 0x49a0
movl 0xe4(%rbx), %eax
xorl $0x2, %eax
shll $0x18, %eax
movzbl 0xe5(%rbx), %ecx
shll $0x10, %ecx
orl %eax, %ecx
movzbl 0xe6(%rbx), %eax
shll $0x8, %eax
leal (%rax,%rcx), %edi
addl $0xff, %edi
callq 0x12ed7
movl %eax, 0x58(%rbx)
movzbl 0xe7(%rbx), %eax
shll $0x10, %eax
movzbl 0xe8(%rbx), %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzbl 0xe9(%rbx), %eax
leal (%rax,%rcx), %edi
addl $0xfe000000, %edi       # imm = 0xFE000000
callq 0x12ed7
movl %eax, 0x5c(%rbx)
movl $0xc0ff, %eax           # imm = 0xC0FF
andl 0x50(%rbx), %eax
cmpl $0x80fe, %eax           # imm = 0x80FE
jne 0x4986
movb 0xee(%rbx), %al
incb %al
jmp 0x4988
xorl %eax, %eax
movb %al, 0x60(%rbx)
pushq $0x8
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x479d
andq $0x0, 0x58(%rbx)
movb $0x3, %bpl
pushq $-0x1
popq %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpl $0x8, %r12d
je 0x496d
movzbl 0xea(%rbx), %eax
cmpl %eax, %r12d
jae 0x496d
cmpl $0x4, %r12d
sete %cl
subb %cl, %bpl
addl %r14d, %eax
cltq
movzbl 0xe4(%rbx,%rax), %edi
movl %r15d, %ecx
andb $0x18, %cl
shll %cl, %edi
callq 0x12ed7
movzbl %bpl, %ecx
orl %eax, 0x50(%rbx,%rcx,4)
incl %r12d
decl %r14d
addl $0x8, %r15d
jmp 0x49b2
leaq 0xf8c9(%rip), %rdi      # 0x142cc
leaq 0xfd4d(%rip), %rsi      # 0x14757
leaq 0xfa29(%rip), %rcx      # 0x1443a
movl $0x5df, %edx            # imm = 0x5DF
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050