LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_get_ip6_addr_match
s8_t
netif_get_ip6_addr_match(struct netif *netif, const ip6_addr_t *ip6addr)
{
  s8_t i;

  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ASSERT("netif_get_ip6_addr_match: invalid netif", netif != NULL);
  LWIP_ASSERT("netif_get_ip6_addr_match: invalid ip6addr", ip6addr != NULL);

#if LWIP_IPV6_SCOPES
  if (ip6_addr_has_zone(ip6addr) && !ip6_addr_test_zone(ip6addr, netif)) {
    return -1; /* wrong zone, no match */
  }
#endif /* LWIP_IPV6_SCOPES */

  for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
    if (!ip6_addr_isinvalid(netif_ip6_addr_state(netif, i)) &&
        ip6_addr_cmp_zoneless(netif_ip6_addr(netif, i), ip6addr)) {
      return i;
    }
  }
  return -1;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x4a5c
testq %rsi, %rsi
je 0x4a78
movb 0x10(%rsi), %cl
testb %cl, %cl
je 0x4a0d
movb 0xee(%rdi), %dl
incb %dl
movb $-0x1, %al
cmpb %dl, %cl
jne 0x4a5a
movq $-0x48, %rcx
xorl %eax, %eax
cmpb $0x0, 0x98(%rdi,%rax)
je 0x4a4f
movl 0x98(%rdi,%rcx), %edx
cmpl (%rsi), %edx
jne 0x4a4f
movl 0x9c(%rdi,%rcx), %edx
cmpl 0x4(%rsi), %edx
jne 0x4a4f
movl 0xa0(%rdi,%rcx), %edx
cmpl 0x8(%rsi), %edx
jne 0x4a4f
movl 0xa4(%rdi,%rcx), %edx
cmpl 0xc(%rsi), %edx
je 0x4a5a
incq %rax
addq $0x18, %rcx
jne 0x4a16
movb $-0x1, %al
popq %rcx
retq
leaq 0x10869(%rip), %rdi     # 0x152cc
leaq 0x10c9b(%rip), %rsi     # 0x15705
leaq 0x109c9(%rip), %rcx     # 0x1543a
movl $0x5be, %edx            # imm = 0x5BE
jmp 0x4a92
leaq 0x1084d(%rip), %rdi     # 0x152cc
leaq 0x10ca7(%rip), %rsi     # 0x1572d
leaq 0x109ad(%rip), %rcx     # 0x1543a
movl $0x5bf, %edx            # imm = 0x5BF
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_add_ip6_address
err_t
netif_add_ip6_address(struct netif *netif, const ip6_addr_t *ip6addr, s8_t *chosen_idx)
{
  s8_t i;

  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ASSERT("netif_add_ip6_address: invalid netif", netif != NULL);
  LWIP_ASSERT("netif_add_ip6_address: invalid ip6addr", ip6addr != NULL);

  i = netif_get_ip6_addr_match(netif, ip6addr);
  if (i >= 0) {
    /* Address already added */
    if (chosen_idx != NULL) {
      *chosen_idx = i;
    }
    return ERR_OK;
  }

  /* Find a free slot. The first one is reserved for link-local addresses. */
  for (i = ip6_addr_islinklocal(ip6addr) ? 0 : 1; i < LWIP_IPV6_NUM_ADDRESSES; i++) {
    if (ip6_addr_isinvalid(netif_ip6_addr_state(netif, i))) {
      ip_addr_copy_from_ip6(netif->ip6_addr[i], *ip6addr);
      ip6_addr_assign_zone(ip_2_ip6(&netif->ip6_addr[i]), IP6_UNICAST, netif);
      netif_ip6_addr_set_state(netif, i, IP6_ADDR_TENTATIVE);
      if (chosen_idx != NULL) {
        *chosen_idx = i;
      }
      return ERR_OK;
    }
  }

  if (chosen_idx != NULL) {
    *chosen_idx = -1;
  }
  return ERR_VAL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4ce8
movq %rsi, %r12
testq %rsi, %rsi
je 0x4d04
movq %rdx, %rbx
movq %rdi, %r15
movq %r12, %rsi
callq 0x49e9
testb %al, %al
js 0x4c3f
movl %eax, %r14d
jmp 0x4cd2
movl (%r12), %edx
movl %edx, %ecx
andl $0xc0ff, %ecx           # imm = 0xC0FF
xorl %r14d, %r14d
cmpl $0x80fe, %ecx           # imm = 0x80FE
setne %r14b
leaq (%r14,%r14,2), %rax
leaq (%r15,%rax,8), %rax
addq $0x64, %rax
cmpb $0x0, 0x98(%r15,%r14)
je 0x4c83
incq %r14
addq $0x18, %rax
cmpb $0x3, %r14b
jne 0x4c64
movb $-0x1, %r14b
movb $-0x6, %al
jmp 0x4cd4
movl %edx, -0x14(%rax)
movl 0x4(%r12), %edx
movl %edx, -0x10(%rax)
movl 0x8(%r12), %edx
movl %edx, -0xc(%rax)
movl 0xc(%r12), %edx
movl %edx, -0x8(%rax)
movb 0x10(%r12), %dl
movb %dl, -0x4(%rax)
movb $0x6, (%rax)
cmpl $0x80fe, %ecx           # imm = 0x80FE
jne 0x4cbc
movb 0xee(%r15), %cl
incb %cl
jmp 0x4cbe
xorl %ecx, %ecx
movb %cl, -0x4(%rax)
movsbl %r14b, %esi
movq %r15, %rdi
movl $0x8, %edx
callq 0x4949
xorl %eax, %eax
testq %rbx, %rbx
je 0x4cdc
movb %r14b, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x105dd(%rip), %rdi     # 0x152cc
leaq 0x10a93(%rip), %rsi     # 0x15789
leaq 0x1073d(%rip), %rcx     # 0x1543a
movl $0x623, %edx            # imm = 0x623
jmp 0x4d1e
leaq 0x105c1(%rip), %rdi     # 0x152cc
leaq 0x10a9c(%rip), %rsi     # 0x157ae
leaq 0x10721(%rip), %rcx     # 0x1543a
movl $0x624, %edx            # imm = 0x624
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_find
struct netif *
netif_find(const char *name)
{
  struct netif *netif;
  u8_t num;

  LWIP_ASSERT_CORE_LOCKED();

  if (name == NULL) {
    return NULL;
  }

  num = (u8_t)atoi(&name[2]);

  NETIF_FOREACH(netif) {
    if (num == netif->num &&
        name[0] == netif->name[0] &&
        name[1] == netif->name[1]) {
      LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1]));
      return netif;
    }
  }
  LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1]));
  return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4d92
movq 0x18b7e(%rip), %rbx     # 0x1d8d8
testq %rbx, %rbx
je 0x4d92
movq %rdi, %r14
addq $0x2, %rdi
callq 0x21f0
cmpb %al, 0xee(%rbx)
jne 0x4d8a
movb (%r14), %cl
cmpb 0xec(%rbx), %cl
jne 0x4d8a
movb 0x1(%r14), %cl
cmpb 0xed(%rbx), %cl
je 0x4d94
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x4d6b
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/netif.c
// Function: netif_index_to_name
char *
netif_index_to_name(u8_t idx, char *name)
{
  struct netif *netif = netif_get_by_index(idx);

  if (netif != NULL) {
    name[0] = netif->name[0];
    name[1] = netif->name[1];
    lwip_itoa(&name[2], NETIF_NAMESIZE - 2, netif_index_to_num(idx));
    return name;
  }
  return NULL;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
testl %edi, %edi
je 0x4dc5
leaq 0x18b2a(%rip), %rax     # 0x1d8d8
movq (%rax), %rax
testq %rax, %rax
je 0x4dc5
movb 0xee(%rax), %cl
incb %cl
cmpb %dil, %cl
jne 0x4dae
jmp 0x4dc7
xorl %eax, %eax
testq %rax, %rax
je 0x4df6
movb 0xec(%rax), %cl
movb %cl, (%rbx)
movb 0xed(%rax), %al
movb %al, 0x1(%rbx)
leaq 0x2(%rbx), %rax
movzbl %dil, %edx
decl %edx
movl $0x4, %esi
movq %rax, %rdi
callq 0x13d70
jmp 0x4df8
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_alloc_reference
struct pbuf *
pbuf_alloc_reference(void *payload, u16_t length, pbuf_type type)
{
  struct pbuf *p;
  LWIP_ASSERT("invalid pbuf_type", (type == PBUF_REF) || (type == PBUF_ROM));
  /* only allocate memory for the pbuf structure */
  p = (struct pbuf *)memp_malloc(MEMP_PBUF);
  if (p == NULL) {
    LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
                ("pbuf_alloc_reference: Could not allocate MEMP_PBUF for PBUF_%s.\n",
                 (type == PBUF_ROM) ? "ROM" : "REF"));
    return NULL;
  }
  pbuf_init_alloced_pbuf(p, payload, length, length, type, 0);
  return p;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %eax
andl $-0x41, %eax
cmpl $0x1, %eax
jne 0x503c
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl $0xa, %edi
callq 0x3c9e
testq %rax, %rax
je 0x5035
movq $0x0, (%rax)
movq %r14, 0x8(%rax)
movw %bp, 0x10(%rax)
movw %bp, 0x12(%rax)
movb %bl, 0x14(%rax)
movw $0x100, 0x15(%rax)      # imm = 0x100
movb $0x0, 0x17(%rax)
jmp 0x5037
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x10289(%rip), %rdi     # 0x152cc
leaq 0x10849(%rip), %rsi     # 0x15893
leaq 0x107d8(%rip), %rcx     # 0x15829
movl $0x14a, %edx            # imm = 0x14A
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_remove_header
u8_t
pbuf_remove_header(struct pbuf *p, size_t header_size_decrement)
{
  void *payload;
  u16_t increment_magnitude;

  LWIP_ASSERT("p != NULL", p != NULL);
  if ((p == NULL) || (header_size_decrement > 0xFFFF)) {
    return 1;
  }
  if (header_size_decrement == 0) {
    return 0;
  }

  increment_magnitude = (u16_t)header_size_decrement;
  /* Check that we aren't going to move off the end of the pbuf */
  LWIP_ERROR("increment_magnitude <= p->len", (increment_magnitude <= p->len), return 1;);

  /* remember current payload pointer */
  payload = p->payload;
  LWIP_UNUSED_ARG(payload); /* only used in LWIP_DEBUGF below */

  /* increase payload pointer (guarded by length check above) */
  p->payload = (u8_t *)p->payload + header_size_decrement;
  /* modify pbuf length fields */
  p->len = (u16_t)(p->len - increment_magnitude);
  p->tot_len = (u16_t)(p->tot_len - increment_magnitude);

  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_remove_header: old %p new %p (%"U16_F")\n",
              (void *)payload, (void *)p->payload, increment_magnitude));

  return 0;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x535c
movb $0x1, %al
cmpq $0xffff, %rsi           # imm = 0xFFFF
ja 0x535a
testq %rsi, %rsi
je 0x5358
movzwl 0x12(%rdi), %eax
cmpl %eax, %esi
jg 0x5378
addq %rsi, 0x8(%rdi)
subl %esi, %eax
movw %ax, 0x12(%rdi)
subw %si, 0x10(%rdi)
xorl %eax, %eax
popq %rcx
retq
leaq 0xff69(%rip), %rdi      # 0x152cc
leaq 0x10549(%rip), %rsi     # 0x158b3
leaq 0x104b8(%rip), %rcx     # 0x15829
movl $0x24b, %edx            # imm = 0x24B
jmp 0x5392
leaq 0xff4d(%rip), %rdi      # 0x152cc
leaq 0x1056b(%rip), %rsi     # 0x158f1
leaq 0x1049c(%rip), %rcx     # 0x15829
movl $0x255, %edx            # imm = 0x255
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_header_impl
static u8_t
pbuf_header_impl(struct pbuf *p, s16_t header_size_increment, u8_t force)
{
  if (header_size_increment < 0) {
    return pbuf_remove_header(p, (size_t) - header_size_increment);
  } else {
    return pbuf_add_header_impl(p, (size_t)header_size_increment, force);
  }
}

// Assembly:
testw %si, %si
js 0x53b9
movzwl %si, %esi
movzbl %dl, %edx
jmp 0x529d
movswq %si, %rsi
negq %rsi
jmp 0x532c
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_free_header
struct pbuf *
pbuf_free_header(struct pbuf *q, u16_t size)
{
  struct pbuf *p = q;
  u16_t free_left = size;
  while (free_left && p) {
    if (free_left >= p->len) {
      struct pbuf *f = p;
      free_left = (u16_t)(free_left - p->len);
      p = p->next;
      f->next = 0;
      pbuf_free(f);
    } else {
      pbuf_remove_header(p, free_left);
      free_left = 0;
    }
  }
  return p;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
sete %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x541d
movl %esi, %ebp
movzwl 0x12(%rbx), %eax
cmpw %ax, %bp
jae 0x53fc
movzwl %bp, %esi
movq %rbx, %rdi
callq 0x532c
xorl %ebp, %ebp
jmp 0x5413
subl %eax, %ebp
movq (%rbx), %r14
movq $0x0, (%rbx)
movq %rbx, %rdi
callq 0x5069
movq %r14, %rbx
testw %bp, %bp
je 0x541d
testq %rbx, %rbx
jne 0x53e4
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_ref
void
pbuf_ref(struct pbuf *p)
{
  /* pbuf given? */
  if (p != NULL) {
    SYS_ARCH_SET(p->ref, (LWIP_PBUF_REF_T)(p->ref + 1));
    LWIP_ASSERT("pbuf ref overflow", p->ref > 0);
  }
}

// Assembly:
testq %rdi, %rdi
je 0x543e
incb 0x16(%rdi)
je 0x543f
retq
pushq %rax
leaq 0xfe85(%rip), %rdi      # 0x152cc
leaq 0x1050a(%rip), %rsi     # 0x15958
leaq 0x103d4(%rip), %rcx     # 0x15829
movl $0x342, %edx            # imm = 0x342
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_cat
void
pbuf_cat(struct pbuf *h, struct pbuf *t)
{
  struct pbuf *p;

  LWIP_ERROR("(h != NULL) && (t != NULL) (programmer violates API)",
             ((h != NULL) && (t != NULL)), return;);

  /* proceed to last pbuf of chain */
  for (p = h; p->next != NULL; p = p->next) {
    /* add total length of second chain to all totals of first chain */
    p->tot_len = (u16_t)(p->tot_len + t->tot_len);
  }
  /* { p is last pbuf of first h chain, p->next == NULL } */
  LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len);
  LWIP_ASSERT("p->next == NULL", p->next == NULL);
  /* add total length of second chain to last pbuf total of first chain */
  p->tot_len = (u16_t)(p->tot_len + t->tot_len);
  /* chain last pbuf of head (p) with first of tail (t) */
  p->next = t;
  /* p->next now references t, but the caller will drop its reference to t,
   * so netto there is no change to the reference count of t.
   */
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x54b2
testq %rsi, %rsi
je 0x54b2
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x5498
movzwl 0x10(%rsi), %eax
addw %ax, 0x10(%rdi)
movq %rcx, %rax
movq (%rcx), %rcx
movq %rax, %rdi
testq %rcx, %rcx
jne 0x5480
jmp 0x549b
movq %rdi, %rax
movzwl 0x10(%rax), %ecx
cmpw 0x12(%rax), %cx
jne 0x54ce
addw 0x10(%rsi), %cx
movw %cx, 0x10(%rax)
movq %rsi, (%rax)
popq %rax
retq
leaq 0xfe13(%rip), %rdi      # 0x152cc
leaq 0x104aa(%rip), %rsi     # 0x1596a
leaq 0x10362(%rip), %rcx     # 0x15829
movl $0x35a, %edx            # imm = 0x35A
jmp 0x54e8
leaq 0xfdf7(%rip), %rdi      # 0x152cc
leaq 0x104c3(%rip), %rsi     # 0x1599f
leaq 0x10346(%rip), %rcx     # 0x15829
movl $0x362, %edx            # imm = 0x362
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_dechain
struct pbuf *
pbuf_dechain(struct pbuf *p)
{
  struct pbuf *q;
  u8_t tail_gone = 1;
  /* tail */
  q = p->next;
  /* pbuf has successor in chain? */
  if (q != NULL) {
    /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
    LWIP_ASSERT("p->tot_len == p->len + q->tot_len", q->tot_len == p->tot_len - p->len);
    /* enforce invariant if assertion is disabled */
    q->tot_len = (u16_t)(p->tot_len - p->len);
    /* decouple pbuf from remainder */
    p->next = NULL;
    /* total length of pbuf p is its own length only */
    p->tot_len = p->len;
    /* q is no longer referenced by p, free it */
    LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_dechain: unreferencing %p\n", (void *)q));
    tail_gone = pbuf_free(q);
    if (tail_gone > 0) {
      LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE,
                  ("pbuf_dechain: deallocated %p (as it is no longer referenced)\n", (void *)q));
    }
    /* return remaining tail or NULL if deallocated */
  }
  /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */
  LWIP_ASSERT("p->tot_len == p->len", p->tot_len == p->len);
  return ((tail_gone > 0) ? NULL : q);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x554f
movzwl 0x10(%rbx), %edx
movzwl 0x10(%r14), %ecx
movzwl 0x12(%r14), %eax
subl %eax, %ecx
cmpl %edx, %ecx
jne 0x5589
movw %cx, 0x10(%rbx)
movq $0x0, (%r14)
movw %ax, 0x10(%r14)
movq %rbx, %rdi
callq 0x5069
testb %al, %al
sete %cl
jmp 0x5551
xorl %ecx, %ecx
movzwl 0x10(%r14), %eax
cmpw 0x12(%r14), %ax
jne 0x556d
xorl %eax, %eax
testb %cl, %cl
cmovneq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xfd58(%rip), %rdi      # 0x152cc
leaq 0x10473(%rip), %rsi     # 0x159ee
leaq 0x102a7(%rip), %rcx     # 0x15829
movl $0x3aa, %edx            # imm = 0x3AA
jmp 0x55a3
leaq 0xfd3c(%rip), %rdi      # 0x152cc
leaq 0x10435(%rip), %rsi     # 0x159cc
leaq 0x1028b(%rip), %rcx     # 0x15829
movl $0x399, %edx            # imm = 0x399
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_copy_partial
u16_t
pbuf_copy_partial(const struct pbuf *buf, void *dataptr, u16_t len, u16_t offset)
{
  const struct pbuf *p;
  u16_t left = 0;
  u16_t buf_copy_len;
  u16_t copied_total = 0;

  LWIP_ERROR("pbuf_copy_partial: invalid buf", (buf != NULL), return 0;);
  LWIP_ERROR("pbuf_copy_partial: invalid dataptr", (dataptr != NULL), return 0;);

  /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
  for (p = buf; len != 0 && p != NULL; p = p->next) {
    if ((offset != 0) && (offset >= p->len)) {
      /* don't copy from this buffer -> on to the next */
      offset = (u16_t)(offset - p->len);
    } else {
      /* copy from this buffer. maybe only partially. */
      buf_copy_len = (u16_t)(p->len - offset);
      if (buf_copy_len > len) {
        buf_copy_len = len;
      }
      /* copy the necessary parts of the buffer */
      MEMCPY(&((char *)dataptr)[left], &((char *)p->payload)[offset], buf_copy_len);
      copied_total = (u16_t)(copied_total + buf_copy_len);
      left = (u16_t)(left + buf_copy_len);
      len = (u16_t)(len - buf_copy_len);
      offset = 0;
    }
  }
  return copied_total;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x57f0
movq %rsi, %r14
testq %rsi, %rsi
je 0x580c
movl %edx, %ebx
testw %bx, %bx
je 0x57dd
movq %rdi, %r15
xorl %ebp, %ebp
xorl %r12d, %r12d
testw %cx, %cx
je 0x5798
movzwl 0x12(%r15), %eax
cmpw %ax, %cx
jae 0x57cc
movzwl 0x12(%r15), %r13d
subl %ecx, %r13d
cmpw %bx, %r13w
cmovael %ebx, %r13d
movzwl %r12w, %edi
addq %r14, %rdi
movzwl %cx, %esi
addq 0x8(%r15), %rsi
movzwl %r13w, %edx
callq 0x2180
addl %r13d, %ebp
addl %r13d, %r12d
subl %r13d, %ebx
xorl %ecx, %ecx
jmp 0x57ce
subl %eax, %ecx
testw %bx, %bx
je 0x57df
movq (%r15), %r15
testq %r15, %r15
jne 0x5789
jmp 0x57df
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfad5(%rip), %rdi      # 0x152cc
leaq 0x1029e(%rip), %rsi     # 0x15a9c
leaq 0x10024(%rip), %rcx     # 0x15829
movl $0x40a, %edx            # imm = 0x40A
jmp 0x5826
leaq 0xfab9(%rip), %rdi      # 0x152cc
leaq 0x102a1(%rip), %rsi     # 0x15abb
leaq 0x10008(%rip), %rcx     # 0x15829
movl $0x40b, %edx            # imm = 0x40B
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_get_contiguous
void *
pbuf_get_contiguous(const struct pbuf *p, void *buffer, size_t bufsize, u16_t len, u16_t offset)
{
  const struct pbuf *q;
  u16_t out_offset;

  LWIP_ERROR("pbuf_get_contiguous: invalid buf", (p != NULL), return NULL;);
  LWIP_ERROR("pbuf_get_contiguous: invalid dataptr", (buffer != NULL), return NULL;);
  LWIP_ERROR("pbuf_get_contiguous: invalid dataptr", (bufsize >= len), return NULL;);

  q = pbuf_skip_const(p, offset, &out_offset);
  if (q != NULL) {
    if (q->len >= (out_offset + len)) {
      /* all data in this pbuf, return zero-copy */
      return (u8_t *)q->payload + out_offset;
    }
    /* need to copy */
    if (pbuf_copy_partial(q, buffer, len, out_offset) != len) {
      /* copying failed: pbuf is too short */
      return NULL;
    }
    return buffer;
  }
  /* pbuf is too short (offset does not fit in) */
  return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x58ac
movq %rsi, %rbx
testq %rsi, %rsi
je 0x58c8
movzwl %cx, %r14d
cmpq %rdx, %r14
ja 0x58e4
movzwl 0x12(%rdi), %eax
cmpw %ax, %r8w
jb 0x586c
subl %eax, %r8d
movq (%rdi), %rdi
testq %rdi, %rdi
jne 0x5857
testq %rdi, %rdi
je 0x589c
movzwl 0x12(%rdi), %ecx
movzwl %r8w, %eax
leal (%rax,%r14), %edx
cmpl %ecx, %edx
jbe 0x58a0
movq %rbx, %rsi
movl %r14d, %edx
movl %eax, %ecx
callq 0x575a
movl %eax, %ecx
xorl %eax, %eax
cmpw %r14w, %cx
cmoveq %rbx, %rax
jmp 0x58a4
xorl %eax, %eax
jmp 0x58a4
addq 0x8(%rdi), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xfa19(%rip), %rdi      # 0x152cc
leaq 0x10224(%rip), %rsi     # 0x15ade
leaq 0xff68(%rip), %rcx      # 0x15829
movl $0x437, %edx            # imm = 0x437
jmp 0x58fe
leaq 0xf9fd(%rip), %rdi      # 0x152cc
leaq 0x10229(%rip), %rsi     # 0x15aff
leaq 0xff4c(%rip), %rcx      # 0x15829
movl $0x438, %edx            # imm = 0x438
jmp 0x58fe
leaq 0xf9e1(%rip), %rdi      # 0x152cc
leaq 0x1020d(%rip), %rsi     # 0x15aff
leaq 0xff30(%rip), %rcx      # 0x15829
movl $0x439, %edx            # imm = 0x439
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_take
err_t
pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len)
{
  struct pbuf *p;
  size_t buf_copy_len;
  size_t total_copy_len = len;
  size_t copied_total = 0;

  LWIP_ERROR("pbuf_take: invalid buf", (buf != NULL), return ERR_ARG;);
  LWIP_ERROR("pbuf_take: invalid dataptr", (dataptr != NULL), return ERR_ARG;);
  LWIP_ERROR("pbuf_take: buf not large enough", (buf->tot_len >= len), return ERR_MEM;);

  if ((buf == NULL) || (dataptr == NULL) || (buf->tot_len < len)) {
    return ERR_ARG;
  }

  /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */
  for (p = buf; total_copy_len != 0; p = p->next) {
    LWIP_ASSERT("pbuf_take: invalid pbuf", p != NULL);
    buf_copy_len = total_copy_len;
    if (buf_copy_len > p->len) {
      /* this pbuf cannot hold all remaining data */
      buf_copy_len = p->len;
    }
    /* copy the necessary parts of the buffer */
    MEMCPY(p->payload, &((const char *)dataptr)[copied_total], buf_copy_len);
    total_copy_len -= buf_copy_len;
    copied_total += buf_copy_len;
  }
  LWIP_ASSERT("did not copy all data", total_copy_len == 0 && copied_total == len);
  return ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x59e3
movq %rsi, %rbx
testq %rsi, %rsi
je 0x59ff
movq %rdi, %r14
cmpw %dx, 0x10(%rdi)
jb 0x5a1b
movl %edx, %r12d
xorl %r13d, %r13d
testw %dx, %dx
je 0x599c
movq %r12, %rbp
testq %r14, %r14
je 0x59b6
movzwl 0x12(%r14), %r15d
cmpq %r15, %rbp
cmovbq %rbp, %r15
movq 0x8(%r14), %rdi
leaq (%rbx,%r13), %rsi
movq %r15, %rdx
callq 0x2180
addq %r15, %r13
movq (%r14), %r14
subq %r15, %rbp
jne 0x5970
cmpq %r12, %r13
jne 0x5a37
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf90f(%rip), %rdi      # 0x152cc
leaq 0x101b2(%rip), %rsi     # 0x15b76
leaq 0xfe5e(%rip), %rcx      # 0x15829
movl $0x4bd, %edx            # imm = 0x4BD
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
leaq 0xf8e2(%rip), %rdi      # 0x152cc
leaq 0x10133(%rip), %rsi     # 0x15b24
leaq 0xfe31(%rip), %rcx      # 0x15829
movl $0x4b3, %edx            # imm = 0x4B3
jmp 0x59d0
leaq 0xf8c6(%rip), %rdi      # 0x152cc
leaq 0x1012e(%rip), %rsi     # 0x15b3b
leaq 0xfe15(%rip), %rcx      # 0x15829
movl $0x4b4, %edx            # imm = 0x4B4
jmp 0x59d0
leaq 0xf8aa(%rip), %rdi      # 0x152cc
leaq 0x1012d(%rip), %rsi     # 0x15b56
leaq 0xfdf9(%rip), %rcx      # 0x15829
movl $0x4b5, %edx            # imm = 0x4B5
jmp 0x59d0
leaq 0xf88e(%rip), %rdi      # 0x152cc
leaq 0x10149(%rip), %rsi     # 0x15b8e
leaq 0xfddd(%rip), %rcx      # 0x15829
movl $0x4c8, %edx            # imm = 0x4C8
jmp 0x59d0
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_take_at
err_t
pbuf_take_at(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset)
{
  u16_t target_offset;
  struct pbuf *q = pbuf_skip(buf, offset, &target_offset);

  /* return requested data if pbuf is OK */
  if ((q != NULL) && (q->tot_len >= target_offset + len)) {
    u16_t remaining_len = len;
    const u8_t *src_ptr = (const u8_t *)dataptr;
    /* copy the part that goes into the first pbuf */
    u16_t first_copy_len;
    LWIP_ASSERT("check pbuf_skip result", target_offset < q->len);
    first_copy_len = (u16_t)LWIP_MIN(q->len - target_offset, len);
    MEMCPY(((u8_t *)q->payload) + target_offset, dataptr, first_copy_len);
    remaining_len = (u16_t)(remaining_len - first_copy_len);
    src_ptr += first_copy_len;
    if (remaining_len > 0) {
      return pbuf_take(q->next, src_ptr, remaining_len);
    }
    return ERR_OK;
  }
  return ERR_MEM;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testq %rdi, %rdi
je 0x5a7f
movzwl 0x12(%r14), %eax
cmpw %ax, %cx
jb 0x5a7f
subl %eax, %ecx
movq (%r14), %r14
testq %r14, %r14
jne 0x5a6b
movb $-0x1, %al
testq %r14, %r14
je 0x5ac8
movzwl 0x10(%r14), %edx
movzwl %cx, %edi
movzwl %bp, %r12d
leal (%rdi,%r12), %esi
cmpl %edx, %esi
ja 0x5ac8
movzwl 0x12(%r14), %eax
cmpw %ax, %cx
jae 0x5aed
subl %edi, %eax
cmpl %r12d, %eax
cmovgel %r12d, %eax
addq 0x8(%r14), %rdi
movzwl %ax, %r15d
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2180
cmpw %r12w, %r15w
jne 0x5ad1
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
subl %r15d, %ebp
addq %r15, %rbx
movq (%r14), %rdi
movzwl %bp, %edx
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5935
leaq 0xf7d8(%rip), %rdi      # 0x152cc
leaq 0x100a9(%rip), %rsi     # 0x15ba4
leaq 0xfd27(%rip), %rcx      # 0x15829
movl $0x4e3, %edx            # imm = 0x4E3
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_coalesce
struct pbuf *
pbuf_coalesce(struct pbuf *p, pbuf_layer layer)
{
  struct pbuf *q;
  if (p->next == NULL) {
    return p;
  }
  q = pbuf_clone(layer, PBUF_RAM, p);
  if (q == NULL) {
    /* @todo: what do we do now? */
    return p;
  }
  pbuf_free(p);
  return q;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, (%rdi)
je 0x5b49
movl %esi, %edi
movl $0x280, %esi            # imm = 0x280
movq %rbx, %rdx
callq 0x5b54
testq %rax, %rax
je 0x5b49
movq %rax, %r14
movq %rbx, %rdi
callq 0x5069
movq %r14, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_fill_chksum
err_t
pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr,
                 u16_t len, u16_t *chksum)
{
  u32_t acc;
  u16_t copy_chksum;
  char *dst_ptr;
  LWIP_ASSERT("p != NULL", p != NULL);
  LWIP_ASSERT("dataptr != NULL", dataptr != NULL);
  LWIP_ASSERT("chksum != NULL", chksum != NULL);
  LWIP_ASSERT("len != 0", len != 0);

  if ((start_offset >= p->len) || (start_offset + len > p->len)) {
    return ERR_ARG;
  }

  dst_ptr = ((char *)p->payload) + start_offset;
  copy_chksum = LWIP_CHKSUM_COPY(dst_ptr, dataptr, len);
  if ((start_offset & 1) != 0) {
    copy_chksum = SWAP_BYTES_IN_WORD(copy_chksum);
  }
  acc = *chksum;
  acc += copy_chksum;
  *chksum = FOLD_U32T(acc);
  return ERR_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5c07
testq %rdx, %rdx
je 0x5c23
movq %r8, %rbx
testq %r8, %r8
je 0x5c3f
testw %cx, %cx
je 0x5c5b
movzwl 0x12(%rdi), %r8d
movb $-0x10, %al
cmpw %si, %r8w
jbe 0x5bff
movzwl %cx, %ecx
movzwl %si, %r14d
leal (%rcx,%r14), %esi
cmpl %r8d, %esi
ja 0x5bff
movq 0x8(%rdi), %rdi
addq %r14, %rdi
movq %rdx, %rsi
movl %ecx, %edx
callq 0x14327
movl %eax, %ecx
rolw $0x8, %cx
testb $0x1, %r14b
cmovel %eax, %ecx
movzwl (%rbx), %eax
movzwl %cx, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
addl %ecx, %eax
movw %ax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xf6be(%rip), %rdi      # 0x152cc
leaq 0xfc9e(%rip), %rsi      # 0x158b3
leaq 0xfc0d(%rip), %rcx      # 0x15829
movl $0x53c, %edx            # imm = 0x53C
jmp 0x5c75
leaq 0xf6a2(%rip), %rdi      # 0x152cc
leaq 0xff8a(%rip), %rsi      # 0x15bbb
leaq 0xfbf1(%rip), %rcx      # 0x15829
movl $0x53d, %edx            # imm = 0x53D
jmp 0x5c75
leaq 0xf686(%rip), %rdi      # 0x152cc
leaq 0xff7e(%rip), %rsi      # 0x15bcb
leaq 0xfbd5(%rip), %rcx      # 0x15829
movl $0x53e, %edx            # imm = 0x53E
jmp 0x5c75
leaq 0xf66a(%rip), %rdi      # 0x152cc
leaq 0xff71(%rip), %rsi      # 0x15bda
leaq 0xfbb9(%rip), %rcx      # 0x15829
movl $0x53f, %edx            # imm = 0x53F
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_try_get_at
static const struct pbuf *
pbuf_skip_const(const struct pbuf *in, u16_t in_offset, u16_t *out_offset)
{
  u16_t offset_left = in_offset;
  const struct pbuf *q = in;

  /* get the correct pbuf */
  while ((q != NULL) && (q->len <= offset_left)) {
    offset_left = (u16_t)(offset_left - q->len);
    q = q->next;
  }
  if (out_offset != NULL) {
    *out_offset = offset_left;
  }
  return q;
}

// Assembly:
testq %rdi, %rdi
je 0x5cd5
movzwl 0x12(%rdi), %eax
cmpw %ax, %si
jb 0x5cd5
subl %eax, %esi
movq (%rdi), %rdi
jmp 0x5cc0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x5cf0
cmpw %si, 0x12(%rdi)
jbe 0x5cf0
movq 0x8(%rdi), %rax
movzwl %si, %ecx
movzbl (%rax,%rcx), %eax
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_memcmp
u16_t
pbuf_memcmp(const struct pbuf *p, u16_t offset, const void *s2, u16_t n)
{
  u16_t start = offset;
  const struct pbuf *q = p;
  u16_t i;

  /* pbuf long enough to perform check? */
  if (p->tot_len < (offset + n)) {
    return 0xffff;
  }

  /* get the correct pbuf from chain. We know it succeeds because of p->tot_len check above. */
  while ((q != NULL) && (q->len <= start)) {
    start = (u16_t)(start - q->len);
    q = q->next;
  }

  /* return requested data if pbuf is OK */
  for (i = 0; i < n; i++) {
    /* We know pbuf_get_at() succeeds because of p->tot_len check above. */
    u8_t a = pbuf_get_at(q, (u16_t)(start + i));
    u8_t b = ((const u8_t *)s2)[i];
    if (a != b) {
      return (u16_t)LWIP_MIN(i + 1, 0xFFFF);
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movzwl 0x10(%rdi), %eax
leal (%rcx,%rsi), %edx
movw $0xffff, %bp            # imm = 0xFFFF
cmpl %eax, %edx
ja 0x5d89
movq %rdi, %r14
testq %r14, %r14
je 0x5d52
movzwl 0x12(%r14), %eax
cmpw %ax, %si
jb 0x5d52
subl %eax, %esi
movq (%r14), %r14
jmp 0x5d3c
testw %cx, %cx
je 0x5d87
movzwl %cx, %r15d
movzwl %si, %r12d
xorl %r13d, %r13d
leal (%r12,%r13), %eax
movzwl %ax, %esi
movq %r14, %rdi
callq 0x5c88
leal 0x1(%r13), %ecx
cmpb (%rbx,%r13), %al
cmovnel %ecx, %ebp
jne 0x5d89
incq %r13
cmpw %r13w, %r15w
jne 0x5d62
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_memfind
u16_t
pbuf_memfind(const struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset)
{
  u16_t i;
  u16_t max_cmp_start = (u16_t)(p->tot_len - mem_len);
  if (p->tot_len >= mem_len + start_offset) {
    for (i = start_offset; i <= max_cmp_start; i++) {
      u16_t plus = pbuf_memcmp(p, i, mem, mem_len);
      if (plus == 0) {
        return i;
      }
    }
  }
  return 0xFFFF;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rsi, (%rsp)
movzwl 0x10(%rdi), %eax
movl %eax, %ebp
subl %edx, %ebp
addl %edx, %ecx
cmpl %eax, %ecx
seta %al
cmpw %bx, %bp
setb %cl
orb %al, %cl
movw $0xffff, %ax            # imm = 0xFFFF
jne 0x5dfe
movq %rdi, %r15
movzwl %dx, %r12d
movzwl %bx, %r13d
movq %r15, %rdi
movl %r13d, %esi
movq (%rsp), %rdx
movl %r12d, %ecx
callq 0x5d1c
testw %ax, %ax
cmovel %r13d, %r14d
je 0x5dfb
incl %ebx
cmpw %bp, %bx
jbe 0x5dcf
movw $0xffff, %ax            # imm = 0xFFFF
jmp 0x5dfe
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_strstr
u16_t
pbuf_strstr(const struct pbuf *p, const char *substr)
{
  size_t substr_len;
  if ((substr == NULL) || (substr[0] == 0) || (p->tot_len == 0xFFFF)) {
    return 0xFFFF;
  }
  substr_len = strlen(substr);
  if (substr_len >= 0xFFFF) {
    return 0xFFFF;
  }
  return pbuf_memfind(p, substr, (u16_t)substr_len, 0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x5e38
movq %rsi, %rbx
cmpb $0x0, (%rsi)
je 0x5e38
movq %rdi, %r14
cmpw $-0x1, 0x10(%rdi)
je 0x5e38
movq %rbx, %rdi
callq 0x20c0
cmpq $0xfffe, %rax           # imm = 0xFFFE
jbe 0x5e44
movw $0xffff, %ax            # imm = 0xFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzwl %ax, %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5d9a
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_bind
err_t
raw_bind(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
{
  LWIP_ASSERT_CORE_LOCKED();
  if ((pcb == NULL) || (ipaddr == NULL)) {
    return ERR_VAL;
  }
  ip_addr_set_ipaddr(&pcb->local_ip, ipaddr);
#if LWIP_IPV6 && LWIP_IPV6_SCOPES
  /* If the given IP address should have a zone but doesn't, assign one now.
   * This is legacy support: scope-aware callers should always provide properly
   * zoned source addresses. */
  if (IP_IS_V6(&pcb->local_ip) &&
      ip6_addr_lacks_zone(ip_2_ip6(&pcb->local_ip), IP6_UNKNOWN)) {
    ip6_addr_select_zone(ip_2_ip6(&pcb->local_ip), ip_2_ip6(&pcb->local_ip));
  }
#endif /* LWIP_IPV6 && LWIP_IPV6_SCOPES */
  return ERR_OK;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movb $-0x6, %al
jne 0x618c
pushq %rbx
movq %rdi, %rbx
movb 0x14(%rsi), %al
movb %al, 0x14(%rdi)
cmpb $0x6, 0x14(%rsi)
movl (%rsi), %ecx
movl %ecx, (%rdi)
jne 0x610d
movl 0x4(%rsi), %ecx
movl %ecx, 0x4(%rbx)
movl 0x8(%rsi), %ecx
movl %ecx, 0x8(%rbx)
movl 0xc(%rsi), %ecx
movl %ecx, 0xc(%rbx)
movb 0x10(%rsi), %cl
movb %cl, 0x10(%rbx)
jmp 0x6117
xorl %ecx, %ecx
movq %rcx, 0x9(%rbx)
movq %rcx, 0x4(%rbx)
cmpb $0x6, %al
jne 0x6189
cmpb $0x0, 0x10(%rbx)
jne 0x6189
movl (%rbx), %eax
movl %eax, %ecx
andl $0xc0ff, %ecx           # imm = 0xC0FF
cmpl $0x80fe, %ecx           # imm = 0x80FE
je 0x6146
andl $0x8fff, %eax           # imm = 0x8FFF
cmpl $0x2ff, %eax            # imm = 0x2FF
je 0x6146
cmpl $0x1ff, %eax            # imm = 0x1FF
jne 0x6189
movq %rbx, %rdi
movq %rbx, %rsi
callq 0xfae4
testq %rax, %rax
je 0x6189
movl (%rbx), %ecx
movl %ecx, %edx
andl $0xc0ff, %edx           # imm = 0xC0FF
cmpl $0x80fe, %edx           # imm = 0x80FE
je 0x617e
andl $0x8fff, %ecx           # imm = 0x8FFF
cmpl $0x2ff, %ecx            # imm = 0x2FF
je 0x617e
cmpl $0x1ff, %ecx            # imm = 0x1FF
jne 0x618d
movb 0xee(%rax), %al
incb %al
movb %al, 0x10(%rbx)
xorl %eax, %eax
popq %rbx
retq
xorl %eax, %eax
jmp 0x6186
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_connect
err_t
raw_connect(struct raw_pcb *pcb, const ip_addr_t *ipaddr)
{
  LWIP_ASSERT_CORE_LOCKED();
  if ((pcb == NULL) || (ipaddr == NULL)) {
    return ERR_VAL;
  }
  ip_addr_set_ipaddr(&pcb->remote_ip, ipaddr);
#if LWIP_IPV6 && LWIP_IPV6_SCOPES
  /* If the given IP address should have a zone but doesn't, assign one now,
   * using the bound address to make a more informed decision when possible. */
  if (IP_IS_V6(&pcb->remote_ip) &&
      ip6_addr_lacks_zone(ip_2_ip6(&pcb->remote_ip), IP6_UNKNOWN)) {
    ip6_addr_select_zone(ip_2_ip6(&pcb->remote_ip), ip_2_ip6(&pcb->local_ip));
  }
#endif /* LWIP_IPV6 && LWIP_IPV6_SCOPES */
  raw_set_flags(pcb, RAW_FLAGS_CONNECTED);
  return ERR_OK;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
movb $-0x6, %al
jne 0x627d
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb 0x14(%rsi), %al
movb %al, 0x2c(%rdi)
cmpb $0x6, 0x14(%rsi)
movl (%rsi), %ecx
movl %ecx, 0x18(%rdi)
jne 0x61ee
movl 0x4(%rsi), %ecx
movl %ecx, 0x1c(%rbx)
movl 0x8(%rsi), %ecx
movl %ecx, 0x20(%rbx)
movl 0xc(%rsi), %ecx
movl %ecx, 0x24(%rbx)
movb 0x10(%rsi), %cl
movb %cl, 0x28(%rbx)
jmp 0x61f8
xorl %ecx, %ecx
movq %rcx, 0x21(%rbx)
movq %rcx, 0x1c(%rbx)
cmpb $0x6, %al
jne 0x6270
cmpb $0x0, 0x28(%rbx)
jne 0x6270
leaq 0x18(%rbx), %r14
movl (%r14), %eax
movl %eax, %ecx
andl $0xc0ff, %ecx           # imm = 0xC0FF
cmpl $0x80fe, %ecx           # imm = 0x80FE
je 0x622c
andl $0x8fff, %eax           # imm = 0x8FFF
cmpl $0x2ff, %eax            # imm = 0x2FF
je 0x622c
cmpl $0x1ff, %eax            # imm = 0x1FF
jne 0x6270
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfae4
testq %rax, %rax
je 0x6270
movl (%r14), %ecx
movl %ecx, %edx
andl $0xc0ff, %edx           # imm = 0xC0FF
cmpl $0x80fe, %edx           # imm = 0x80FE
je 0x6265
andl $0x8fff, %ecx           # imm = 0x8FFF
cmpl $0x2ff, %ecx            # imm = 0x2FF
je 0x6265
cmpl $0x1ff, %ecx            # imm = 0x1FF
jne 0x627e
movb 0xee(%rax), %al
incb %al
movb %al, 0x28(%rbx)
orb $0x1, 0x41(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
jmp 0x626d
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_sendto
err_t
raw_sendto(struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *ipaddr)
{
  struct netif *netif;
  const ip_addr_t *src_ip;

  if ((pcb == NULL) || (ipaddr == NULL) || !IP_ADDR_PCB_VERSION_MATCH(pcb, ipaddr)) {
    return ERR_VAL;
  }

  LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_sendto\n"));

  if (pcb->netif_idx != NETIF_NO_INDEX) {
    netif = netif_get_by_index(pcb->netif_idx);
  } else {
#if LWIP_MULTICAST_TX_OPTIONS
    netif = NULL;
    if (ip_addr_ismulticast(ipaddr)) {
      /* For multicast-destined packets, use the user-provided interface index to
       * determine the outgoing interface, if an interface index is set and a
       * matching netif can be found. Otherwise, fall back to regular routing. */
      netif = netif_get_by_index(pcb->mcast_ifindex);
    }

    if (netif == NULL)
#endif /* LWIP_MULTICAST_TX_OPTIONS */
    {
      netif = ip_route(&pcb->local_ip, ipaddr);
    }
  }

  if (netif == NULL) {
    LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: No route to "));
    ip_addr_debug_print(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ipaddr);
    return ERR_RTE;
  }

  if (ip_addr_isany(&pcb->local_ip) || ip_addr_ismulticast(&pcb->local_ip)) {
    /* use outgoing network interface IP address as source address */
    src_ip = ip_netif_get_local_ip(netif, ipaddr);
#if LWIP_IPV6
    if (src_ip == NULL) {
      return ERR_RTE;
    }
#endif /* LWIP_IPV6 */
  } else {
    /* use RAW PCB local IP address as source address */
    src_ip = &pcb->local_ip;
  }

  return raw_sendto_if_src(pcb, p, ipaddr, netif, src_ip);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
movb $-0x6, %bpl
jne 0x63f5
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movb 0x14(%rdi), %al
cmpb $0x2e, %al
je 0x6333
cmpb 0x14(%rbx), %al
jne 0x63f5
movb 0x30(%r15), %al
testb %al, %al
je 0x6345
movzbl %al, %edi
callq 0x4dfd
jmp 0x6360
cmpb $0x6, 0x14(%rbx)
jne 0x6358
movq %r15, %rdi
movq %rbx, %rsi
callq 0xfae4
jmp 0x6360
movq %rbx, %rdi
callq 0xe3b4
movq %rax, %r12
movb $-0x4, %bpl
testq %rax, %rax
je 0x63f5
movb 0x14(%r15), %al
movl (%r15), %ecx
cmpb $0x6, %al
jne 0x6395
testl %ecx, %ecx
jne 0x6399
cmpl $0x0, 0x4(%r15)
jne 0x6399
cmpl $0x0, 0x8(%r15)
jne 0x6399
cmpl $0x0, 0xc(%r15)
jne 0x6399
jmp 0x63bc
testl %ecx, %ecx
je 0x63bc
movzbl (%r15), %ecx
cmpb $0x6, %al
jne 0x63ae
movq %r15, %r8
cmpl $0xff, %ecx
je 0x63bc
jmp 0x63dc
andl $-0x10, %ecx
movq %r15, %r8
cmpl $0xe0, %ecx
jne 0x63dc
cmpb $0x6, 0x14(%rbx)
jne 0x63d2
movq %r12, %rdi
movq %rbx, %rsi
callq 0xfaef
movq %rax, %r8
jmp 0x63d7
leaq 0x8(%r12), %r8
testq %r8, %r8
je 0x63f5
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x6400
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_remove
void
raw_remove(struct raw_pcb *pcb)
{
  struct raw_pcb *pcb2;
  LWIP_ASSERT_CORE_LOCKED();
  /* pcb to be removed is first in list? */
  if (raw_pcbs == pcb) {
    /* make list start at 2nd pcb */
    raw_pcbs = raw_pcbs->next;
    /* pcb not 1st in list */
  } else {
    for (pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) {
      /* find pcb in raw_pcbs list */
      if (pcb2->next != NULL && pcb2->next == pcb) {
        /* remove pcb from list */
        pcb2->next = pcb->next;
        break;
      }
    }
  }
  memp_free(MEMP_RAW_PCB, pcb);
}

// Assembly:
movq %rdi, %rsi
movq 0x17289(%rip), %rcx     # 0x1d8f0
cmpq %rdi, %rcx
je 0x6693
testq %rcx, %rcx
je 0x66a1
movq %rcx, %rax
movq 0x38(%rcx), %rcx
testq %rcx, %rcx
sete %dl
cmpq %rsi, %rcx
setne %dil
orb %dl, %dil
jne 0x666c
addq $0x38, %rax
movq %rsi, %rcx
jmp 0x669a
leaq 0x17256(%rip), %rax     # 0x1d8f0
movq 0x38(%rcx), %rcx
movq %rcx, (%rax)
xorl %edi, %edi
jmp 0x3d28
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_new_ip_type
struct raw_pcb *
raw_new_ip_type(u8_t type, u8_t proto)
{
  struct raw_pcb *pcb;
  LWIP_ASSERT_CORE_LOCKED();
  pcb = raw_new(proto);
#if LWIP_IPV4 && LWIP_IPV6
  if (pcb != NULL) {
    IP_SET_TYPE_VAL(pcb->local_ip,  type);
    IP_SET_TYPE_VAL(pcb->remote_ip, type);
  }
#else /* LWIP_IPV4 && LWIP_IPV6 */
  LWIP_UNUSED_ARG(type);
#endif /* LWIP_IPV4 && LWIP_IPV6 */
  return pcb;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
xorl %edi, %edi
callq 0x3c9e
testq %rax, %rax
je 0x6739
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movb %bpl, 0x40(%rax)
movb $0x40, 0x33(%rax)
movq 0x171c8(%rip), %rcx     # 0x1d8f0
movq %rcx, 0x38(%rax)
movq %rax, 0x171bd(%rip)     # 0x1d8f0
movb %bl, 0x14(%rax)
movb %bl, 0x2c(%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/raw.c
// Function: raw_netif_ip_addr_changed
void raw_netif_ip_addr_changed(const ip_addr_t *old_addr, const ip_addr_t *new_addr)
{
  struct raw_pcb *rpcb;

  if (!ip_addr_isany(old_addr) && !ip_addr_isany(new_addr)) {
    for (rpcb = raw_pcbs; rpcb != NULL; rpcb = rpcb->next) {
      /* PCB bound to current local interface address? */
      if (ip_addr_cmp(&rpcb->local_ip, old_addr)) {
        /* The PCB is bound to the old ipaddr and
         * is set to bound to the new one instead */
        ip_addr_copy(rpcb->local_ip, *new_addr);
      }
    }
  }
}

// Assembly:
testq %rdi, %rdi
je 0x6835
cmpb $0x6, 0x14(%rdi)
movl (%rdi), %eax
jne 0x676f
testl %eax, %eax
jne 0x6765
cmpl $0x0, 0x4(%rdi)
jne 0x6765
cmpl $0x0, 0x8(%rdi)
je 0x6836
testq %rsi, %rsi
jne 0x6782
jmp 0x6835
testl %eax, %eax
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x6835
cmpb $0x6, 0x14(%rsi)
movl (%rsi), %eax
jne 0x67a5
testl %eax, %eax
jne 0x67ad
cmpl $0x0, 0x4(%rsi)
jne 0x67ad
cmpl $0x0, 0x8(%rsi)
jne 0x67ad
cmpl $0x0, 0xc(%rsi)
jne 0x67ad
jmp 0x6835
testl %eax, %eax
je 0x6835
movq 0x1713c(%rip), %rax     # 0x1d8f0
testq %rax, %rax
je 0x6835
xorl %ecx, %ecx
movb 0x14(%rax), %dl
cmpb 0x14(%rdi), %dl
jne 0x682c
movl (%rax), %r8d
movl (%rdi), %r9d
cmpb $0x6, %dl
jne 0x67f5
cmpl %r9d, %r8d
jne 0x682c
movl 0x4(%rax), %edx
cmpl 0x4(%rdi), %edx
jne 0x682c
movl 0x8(%rax), %edx
cmpl 0x8(%rdi), %edx
jne 0x682c
movl 0xc(%rax), %edx
cmpl 0xc(%rdi), %edx
jne 0x682c
movb 0x10(%rax), %dl
cmpb 0x10(%rdi), %dl
je 0x67fa
jmp 0x682c
cmpl %r9d, %r8d
jne 0x682c
movb 0x14(%rsi), %dl
movb %dl, 0x14(%rax)
cmpb $0x6, 0x14(%rsi)
movl (%rsi), %edx
movl %edx, (%rax)
jne 0x6824
movl 0x4(%rsi), %edx
movl %edx, 0x4(%rax)
movl 0x8(%rsi), %edx
movl %edx, 0x8(%rax)
movl 0xc(%rsi), %edx
movl %edx, 0xc(%rax)
movb 0x10(%rsi), %dl
movb %dl, 0x10(%rax)
jmp 0x682c
movq %rcx, 0x9(%rax)
movq %rcx, 0x4(%rax)
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x67bb
retq
testq %rsi, %rsi
je 0x6835
cmpl $0x0, 0xc(%rdi)
jne 0x6782
jmp 0x6835
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_fasttmr
void
tcp_fasttmr(void)
{
  struct tcp_pcb *pcb;

  ++tcp_timer_ctr;

tcp_fasttmr_start:
  pcb = tcp_active_pcbs;

  while (pcb != NULL) {
    if (pcb->last_timer != tcp_timer_ctr) {
      struct tcp_pcb *next;
      pcb->last_timer = tcp_timer_ctr;
      /* send delayed ACKs */
      if (pcb->flags & TF_ACK_DELAY) {
        LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: delayed ACK\n"));
        tcp_ack_now(pcb);
        tcp_output(pcb);
        tcp_clear_flags(pcb, TF_ACK_DELAY | TF_ACK_NOW);
      }
      /* send pending FIN */
      if (pcb->flags & TF_CLOSEPEND) {
        LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: pending FIN\n"));
        tcp_clear_flags(pcb, TF_CLOSEPEND);
        tcp_close_shutdown_fin(pcb);
      }

      next = pcb->next;

      /* If there is data which was previously "refused" by upper layer */
      if (pcb->refused_data != NULL) {
        tcp_active_pcbs_changed = 0;
        tcp_process_refused_data(pcb);
        if (tcp_active_pcbs_changed) {
          /* application callback has changed the pcb list: restart the loop */
          goto tcp_fasttmr_start;
        }
      }
      pcb = next;
    } else {
      pcb = pcb->next;
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
incb 0x17058(%rip)           # 0x1d920
movq 0x17039(%rip), %rbx     # 0x1d908
testq %rbx, %rbx
je 0x6963
movb 0x17042(%rip), %al      # 0x1d920
cmpb %al, 0x56(%rbx)
jne 0x68e9
movq 0x38(%rbx), %r14
jmp 0x6957
movb %al, 0x56(%rbx)
movzwl 0x52(%rbx), %eax
testb $0x1, %al
je 0x6907
orl $0x2, %eax
movw %ax, 0x52(%rbx)
movq %rbx, %rdi
callq 0xbfab
andb $-0x4, 0x52(%rbx)
movzwl 0x52(%rbx), %eax
testb $0x8, %al
je 0x6920
andl $0xfff7, %eax           # imm = 0xFFF7
movw %ax, 0x52(%rbx)
movq %rbx, %rdi
callq 0x80b8
movq 0x38(%rbx), %r14
cmpq $0x0, 0xc0(%rbx)
je 0x694d
movb $0x0, 0x16fe4(%rip)     # 0x1d919
movq %rbx, %rdi
callq 0x8122
cmpb $0x0, 0x16fd5(%rip)     # 0x1d919
je 0x694d
xorl %eax, %eax
movq %rbx, %r14
jmp 0x694f
movb $0x1, %al
testb %al, %al
je 0x68c8
movq %r14, %rbx
testq %r14, %r14
jne 0x68d8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_close
err_t
tcp_close(struct tcp_pcb *pcb)
{
  LWIP_ASSERT_CORE_LOCKED();

  LWIP_ERROR("tcp_close: invalid pcb", pcb != NULL, return ERR_ARG);
  LWIP_DEBUGF(TCP_DEBUG, ("tcp_close: closing in "));

  tcp_debug_print_state(pcb->state);

  if (pcb->state != LISTEN) {
    /* Set a flag not to receive any more data... */
    tcp_set_flags(pcb, TF_RXCLOSED);
  }
  /* ... and close */
  return tcp_close_shutdown(pcb, 1);
}

// Assembly:
testq %rdi, %rdi
je 0x6f79
cmpl $0x1, 0x48(%rdi)
je 0x6f72
orb $0x10, 0x52(%rdi)
movl $0x1, %esi
jmp 0x6fa8
pushq %rax
leaq 0xe34b(%rip), %rdi      # 0x152cc
leaq 0xed31(%rip), %rsi      # 0x15cb9
leaq 0xed10(%rip), %rcx      # 0x15c9f
movl $0x1e8, %edx            # imm = 0x1E8
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050