// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x674a
jmp 0x671b
leaq 0x20baa(%rip), %rdi     # 0x272cc
leaq 0x21081(%rip), %rsi     # 0x277aa
movl $0x5df, %edx            # imm = 0x5DF
leaq 0x20d58(%rip), %rcx     # 0x2748d
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x674c
movq -0x8(%rbp), %rax
movl $0x80fe, 0x50(%rax)     # imm = 0x80FE
movq -0x8(%rbp), %rax
movl $0x0, 0x54(%rax)
cmpb $0x0, -0x9(%rbp)
je 0x67f5
movq -0x8(%rbp), %rax
movzbl 0xe4(%rax), %edi
xorl $0x2, %edi
shll $0x18, %edi
movq -0x8(%rbp), %rax
movzbl 0xe5(%rax), %eax
shll $0x10, %eax
orl %eax, %edi
movq -0x8(%rbp), %rax
movzbl 0xe6(%rax), %eax
shll $0x8, %eax
orl %eax, %edi
orl $0xff, %edi
callq 0x251f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x58(%rax)
movq -0x8(%rbp), %rax
movzbl 0xe7(%rax), %edi
shll $0x10, %edi
orl $0xfe000000, %edi       # imm = 0xFE000000
movq -0x8(%rbp), %rax
movzbl 0xe8(%rax), %eax
shll $0x8, %eax
orl %eax, %edi
movq -0x8(%rbp), %rax
movzbl 0xe9(%rax), %eax
orl %eax, %edi
callq 0x251f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x5c(%rax)
jmp 0x68a7
movq -0x8(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x5c(%rax)
movb $0x3, -0xb(%rbp)
movb $0x0, -0xa(%rbp)
movzbl -0xa(%rbp), %ecx
xorl %eax, %eax
cmpl $0x8, %ecx
movb %al, -0xc(%rbp)
jge 0x6838
movzbl -0xa(%rbp), %eax
movq -0x8(%rbp), %rcx
movzbl 0xea(%rcx), %ecx
cmpl %ecx, %eax
setl %al
movb %al, -0xc(%rbp)
movb -0xc(%rbp), %al
testb $0x1, %al
jne 0x6841
jmp 0x68a5
movzbl -0xa(%rbp), %eax
cmpl $0x4, %eax
jne 0x6852
movb -0xb(%rbp), %al
addb $-0x1, %al
movb %al, -0xb(%rbp)
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movzbl 0xea(%rcx), %ecx
movzbl -0xa(%rbp), %edx
subl %edx, %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movzbl 0xe4(%rax,%rcx), %edi
movzbl -0xa(%rbp), %ecx
andl $0x3, %ecx
shll $0x3, %ecx
shll %cl, %edi
callq 0x251f0
movl %eax, %edx
movq -0x8(%rbp), %rax
movzbl -0xb(%rbp), %ecx
orl 0x50(%rax,%rcx,4), %edx
movl %edx, 0x50(%rax,%rcx,4)
movb -0xa(%rbp), %al
addb $0x1, %al
movb %al, -0xa(%rbp)
jmp 0x6813
jmp 0x68a7
movq -0x8(%rbp), %rax
movl 0x50(%rax), %eax
andq $0xc0ff, %rax           # imm = 0xC0FF
cmpq $0x80fe, %rax           # imm = 0x80FE
jne 0x68d2
movq -0x8(%rbp), %rax
movzbl 0xee(%rax), %eax
addl $0x1, %eax
movzbl %al, %eax
movl %eax, -0x10(%rbp)
jmp 0x68d9
xorl %eax, %eax
movl %eax, -0x10(%rbp)
jmp 0x68d9
movl -0x10(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x60(%rax)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x6420
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)