LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_get_router
static s8_t
nd6_get_router(const ip6_addr_t *router_addr, struct netif *netif)
{
  s8_t i;

  IP6_ADDR_ZONECHECK_NETIF(router_addr, netif);

  /* Look for router. */
  for (i = 0; i < LWIP_ND6_NUM_ROUTERS; i++) {
    if ((default_router_list[i].neighbor_entry != NULL) &&
        ((netif != NULL) ? netif == default_router_list[i].neighbor_entry->netif : 1) &&
        ip6_addr_cmp(router_addr, &(default_router_list[i].neighbor_entry->next_hop_address))) {
      return i;
    }
  }

  /* router not found. */
  return -1;
}

// Assembly:
leaq 0xae25(%rip), %rax      # 0x1d770
movl 0x24(%rax), %ecx
movl 0x28(%rax), %edx
movl 0x2c(%rax), %esi
movl 0x30(%rax), %r8d
movb 0x34(%rax), %r9b
leaq 0xb2dd(%rip), %r10      # 0x1dc40
xorl %eax, %eax
movq (%r10), %r11
testq %r11, %r11
je 0x12995
testq %rdi, %rdi
je 0x12978
cmpq %rdi, 0x18(%r11)
jne 0x12995
cmpl (%r11), %ecx
jne 0x12995
cmpl 0x4(%r11), %edx
jne 0x12995
cmpl 0x8(%r11), %esi
jne 0x12995
cmpl 0xc(%r11), %r8d
jne 0x12995
cmpb 0x10(%r11), %r9b
je 0x129a4
incq %rax
addq $0x10, %r10
cmpq $0x3, %rax
jne 0x12965
movb $-0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_new_onlink_prefix
static s8_t
nd6_new_onlink_prefix(const ip6_addr_t *prefix, struct netif *netif)
{
  s8_t i;

  /* Create new entry. */
  for (i = 0; i < LWIP_ND6_NUM_PREFIXES; ++i) {
    if ((prefix_list[i].netif == NULL) ||
        (prefix_list[i].invalidation_timer == 0)) {
      /* Found empty prefix entry. */
      prefix_list[i].netif = netif;
      ip6_addr_set(&(prefix_list[i].prefix), prefix);
      return i;
    }
  }

  /* Entry not available. */
  return -1;
}

// Assembly:
leaq 0xb1ef(%rip), %rcx      # 0x1dc90
xorl %eax, %eax
cmpq $0x0, 0x18(%rcx)
je 0x12abd
cmpl $0x0, 0x20(%rcx)
je 0x12abd
incb %al
addq $0x28, %rcx
cmpb $0x5, %al
jne 0x12aa3
movb $-0x1, %al
retq
movq %rsi, 0x18(%rcx)
testq %rdi, %rdi
je 0x12acf
movl (%rdi), %edx
movl %edx, (%rcx)
movl 0x4(%rdi), %edx
jmp 0x12ad7
movl $0x0, (%rcx)
xorl %edx, %edx
movl %edx, 0x4(%rcx)
testq %rdi, %rdi
je 0x12aea
movl 0x8(%rdi), %edx
movl %edx, 0x8(%rcx)
movl 0xc(%rdi), %edx
jmp 0x12af3
movl $0x0, 0x8(%rcx)
xorl %edx, %edx
movl %edx, 0xc(%rcx)
testq %rdi, %rdi
je 0x12b00
movb 0x10(%rdi), %dl
jmp 0x12b02
xorl %edx, %edx
movb %dl, 0x10(%rcx)
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_free_neighbor_cache_entry
static void
nd6_free_neighbor_cache_entry(s8_t i)
{
  if ((i < 0) || (i >= LWIP_ND6_NUM_NEIGHBORS)) {
    return;
  }
  if (neighbor_cache[i].isrouter) {
    /* isrouter needs to be cleared before deleting a neighbor cache entry */
    return;
  }

  /* Free any queued packets. */
  if (neighbor_cache[i].q != NULL) {
    nd6_free_q(neighbor_cache[i].q);
    neighbor_cache[i].q = NULL;
  }

  neighbor_cache[i].state = ND6_NO_ENTRY;
  neighbor_cache[i].isrouter = 0;
  neighbor_cache[i].netif = NULL;
  neighbor_cache[i].counter.reachable_time = 0;
  ip6_addr_set_zero(&(neighbor_cache[i].next_hop_address));
}

// Assembly:
pushq %rbx
cmpb $0x9, %dil
ja 0x13130
movzbl %dil, %eax
imulq $0x38, %rax, %rax
leaq 0xa91f(%rip), %rbx      # 0x1da10
cmpb $0x0, 0x31(%rax,%rbx)
jne 0x13130
addq %rax, %rbx
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x13111
callq 0x13b8a
movq $0x0, 0x28(%rbx)
movw $0x0, 0x30(%rbx)
movq $0x0, 0x18(%rbx)
movl $0x0, 0x34(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movb $0x0, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_find_route
struct netif *
nd6_find_route(const ip6_addr_t *ip6addr)
{
  struct netif *netif;
  s8_t i;

  /* @todo decide if it makes sense to check the destination cache first */

  /* Check if there is a matching on-link prefix. There may be multiple
   * matches. Pick the first one that is associated with a suitable netif. */
  for (i = 0; i < LWIP_ND6_NUM_PREFIXES; ++i) {
    netif = prefix_list[i].netif;
    if ((netif != NULL) && ip6_addr_netcmp(&prefix_list[i].prefix, ip6addr) &&
        netif_is_up(netif) && netif_is_link_up(netif)) {
      return netif;
    }
  }

  /* No on-link prefix match. Find a router that can forward the packet. */
  i = nd6_select_router(ip6addr, NULL);
  if (i >= 0) {
    LWIP_ASSERT("selected router must have a neighbor entry",
      default_router_list[i].neighbor_entry != NULL);
    return default_router_list[i].neighbor_entry->netif;
  }

  return NULL;
}

// Assembly:
pushq %rbx
xorl %eax, %eax
leaq 0xa983(%rip), %rcx      # 0x1dc90
movq 0x18(%rax,%rcx), %rbx
testq %rbx, %rbx
je 0x1333d
movl (%rax,%rcx), %edx
cmpl (%rdi), %edx
jne 0x1333d
movl 0x4(%rax,%rcx), %edx
cmpl 0x4(%rdi), %edx
jne 0x1333d
movb 0x10(%rax,%rcx), %dl
cmpb 0x10(%rdi), %dl
jne 0x1333d
movb 0xeb(%rbx), %dl
notb %dl
testb $0x5, %dl
je 0x13370
addq $0x28, %rax
cmpq $0xc8, %rax
jne 0x1330d
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x133a2
testb %al, %al
js 0x13370
movzbl %al, %eax
shll $0x4, %eax
leaq 0xa8dd(%rip), %rcx      # 0x1dc40
movq (%rax,%rcx), %rax
testq %rax, %rax
je 0x13375
movq 0x18(%rax), %rbx
movq %rbx, %rax
popq %rbx
retq
leaq 0x1f50(%rip), %rdi      # 0x152cc
leaq 0x44ef(%rip), %rsi      # 0x17872
leaq 0x44c9(%rip), %rcx      # 0x17853
movl $0x6e3, %edx            # imm = 0x6E3
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/ipv6/nd6.c
// Function: nd6_get_destination_mtu
u16_t
nd6_get_destination_mtu(const ip6_addr_t *ip6addr, struct netif *netif)
{
  s16_t i;

  i = nd6_find_destination_cache_entry(ip6addr);
  if (i >= 0) {
    if (destination_cache[i].pmtu > 0) {
      return destination_cache[i].pmtu;
    }
  }

  if (netif != NULL) {
    return netif_mtu6(netif);
  }

  return 1280; /* Minimum MTU */
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
callq 0x12d3c
testw %ax, %ax
js 0x139fa
movzwl %ax, %eax
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
leaq 0xa370(%rip), %rcx      # 0x1dd60
movzwl 0x28(%rax,%rcx), %eax
testw %ax, %ax
jne 0x13a0c
testq %rbx, %rbx
je 0x13a08
movzwl 0xe2(%rbx), %eax
jmp 0x13a0c
movw $0x500, %ax             # imm = 0x500
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_reachability_hint
void
nd6_reachability_hint(const ip6_addr_t *ip6addr)
{
  s8_t i;
  s16_t dst_idx;

  /* Find destination in cache. */
  if (ip6_addr_cmp(ip6addr, &(destination_cache[nd6_cached_destination_index].destination_addr))) {
    dst_idx = nd6_cached_destination_index;
    ND6_STATS_INC(nd6.cachehit);
  } else {
    dst_idx = nd6_find_destination_cache_entry(ip6addr);
  }
  if (dst_idx < 0) {
    return;
  }

  /* Find next hop neighbor in cache. */
  if (ip6_addr_cmp(&(destination_cache[dst_idx].next_hop_addr), &(neighbor_cache[nd6_cached_neighbor_index].next_hop_address))) {
    i = nd6_cached_neighbor_index;
    ND6_STATS_INC(nd6.cachehit);
  } else {
    i = nd6_find_neighbor_cache_entry(&(destination_cache[dst_idx].next_hop_addr));
  }
  if (i < 0) {
    return;
  }

  /* For safety: don't set as reachable if we don't have a LL address yet. Misuse protection. */
  if (neighbor_cache[i].state == ND6_INCOMPLETE || neighbor_cache[i].state == ND6_NO_ENTRY) {
    return;
  }

  /* Set reachability state. */
  neighbor_cache[i].state = ND6_REACHABLE;
  neighbor_cache[i].counter.reachable_time = reachable_time;
}

// Assembly:
pushq %rbx
movl (%rdi), %edx
movzbl 0xa529(%rip), %eax      # 0x1df41
leaq (%rax,%rax,2), %rcx
shll $0x4, %ecx
leaq 0xa33a(%rip), %rbx      # 0x1dd60
cmpl (%rcx,%rbx), %edx
jne 0x13a4e
addq %rbx, %rcx
movl 0x4(%rdi), %edx
cmpl 0x4(%rcx), %edx
jne 0x13a4e
movl 0x8(%rdi), %edx
cmpl 0x8(%rcx), %edx
jne 0x13a4e
movl 0xc(%rdi), %edx
cmpl 0xc(%rcx), %edx
jne 0x13a4e
movb 0x10(%rdi), %dl
cmpb 0x10(%rcx), %dl
je 0x13a53
callq 0x12d3c
testw %ax, %ax
js 0x13acd
movzwl %ax, %eax
leaq (%rax,%rax,2), %rax
shll $0x4, %eax
leaq (%rax,%rbx), %rdi
addq $0x14, %rdi
movl (%rdi), %edx
movzbl 0xa4cf(%rip), %eax      # 0x1df42
imulq $0x38, %rax, %rcx
leaq 0x9f92(%rip), %rbx      # 0x1da10
cmpl (%rcx,%rbx), %edx
jne 0x13aa6
addq %rbx, %rcx
movl 0x4(%rdi), %edx
cmpl 0x4(%rcx), %edx
jne 0x13aa6
movl 0x8(%rdi), %edx
cmpl 0x8(%rcx), %edx
jne 0x13aa6
movl 0xc(%rdi), %edx
cmpl 0xc(%rcx), %edx
jne 0x13aa6
movb 0x10(%rdi), %dl
cmpb 0x10(%rcx), %dl
je 0x13aab
callq 0x123f7
testb %al, %al
js 0x13acd
movzbl %al, %eax
imulq $0x38, %rax, %rax
cmpb $0x2, 0x30(%rax,%rbx)
jb 0x13acd
addq %rax, %rbx
movb $0x2, 0x30(%rbx)
movl 0x968a(%rip), %eax      # 0x1d154
movl %eax, 0x34(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_cleanup_netif
void
nd6_cleanup_netif(struct netif *netif)
{
  u8_t i;
  s8_t router_index;
  for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) {
    if (prefix_list[i].netif == netif) {
      prefix_list[i].netif = NULL;
    }
  }
  for (i = 0; i < LWIP_ND6_NUM_NEIGHBORS; i++) {
    if (neighbor_cache[i].netif == netif) {
      for (router_index = 0; router_index < LWIP_ND6_NUM_ROUTERS; router_index++) {
        if (default_router_list[router_index].neighbor_entry == &neighbor_cache[i]) {
          default_router_list[router_index].neighbor_entry = NULL;
          default_router_list[router_index].flags = 0;
        }
      }
      neighbor_cache[i].isrouter = 0;
      nd6_free_neighbor_cache_entry(i);
    }
  }
  /* Clear the destination cache, since many entries may now have become
   * invalid for one of several reasons. As destination cache entries have no
   * netif association, use a sledgehammer approach (this can be improved). */
  nd6_clear_destination_cache();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x18, %eax
leaq 0xa1aa(%rip), %rcx      # 0x1dc90
cmpq %rbx, (%rax,%rcx)
jne 0x13af4
movq $0x0, (%rax,%rcx)
addq $0x28, %rax
cmpq $0xe0, %rax
jne 0x13ae6
xorl %r14d, %r14d
leaq 0x9f06(%rip), %r15      # 0x1da10
leaq 0xa12f(%rip), %r12      # 0x1dc40
imulq $0x38, %r14, %rax
cmpq %rbx, 0x18(%rax,%r15)
jne 0x13b4c
addq %r15, %rax
xorl %ecx, %ecx
cmpq %rax, (%rcx,%r12)
jne 0x13b35
movq $0x0, (%rcx,%r12)
movb $0x0, 0xc(%rcx,%r12)
addq $0x10, %rcx
cmpq $0x30, %rcx
jne 0x13b21
movb $0x0, 0x31(%rax)
movsbl %r14b, %edi
callq 0x130db
incq %r14
cmpq $0xa, %r14
jne 0x13b11
xorl %eax, %eax
leaq 0xa202(%rip), %rcx      # 0x1dd60
xorps %xmm0, %xmm0
movaps %xmm0, (%rax,%rcx)
movb $0x0, 0x10(%rax,%rcx)
addq $0x30, %rax
cmpq $0x1e0, %rax            # imm = 0x1E0
jne 0x13b61
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/ipv6/nd6.c
// Function: nd6_free_q
static void
nd6_free_q(struct nd6_q_entry *q)
{
  struct nd6_q_entry *r;
  LWIP_ASSERT("q != NULL", q != NULL);
  LWIP_ASSERT("q->p != NULL", q->p != NULL);
  while (q) {
    r = q;
    q = q->next;
    LWIP_ASSERT("r->p != NULL", (r->p != NULL));
    pbuf_free(r->p);
    memp_free(MEMP_ND6_QUEUE, r);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x13bf8
movq %rdi, %rbx
testq %rdi, %rdi
je 0x13bc3
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x13bcb
movq (%rbx), %r14
callq 0x5069
movl $0x8, %edi
movq %rbx, %rsi
callq 0x3d28
movq %r14, %rbx
testq %r14, %r14
jne 0x13b9d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x16fa(%rip), %rdi      # 0x152cc
leaq 0x3cec(%rip), %rsi      # 0x178c5
leaq 0x3c73(%rip), %rcx      # 0x17853
movl $0x873, %edx            # imm = 0x873
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050
leaq 0x16cd(%rip), %rdi      # 0x152cc
leaq 0x3cb2(%rip), %rsi      # 0x178b8
leaq 0x3c46(%rip), %rcx      # 0x17853
movl $0x86f, %edx            # imm = 0x86F
jmp 0x13be5
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/def.c
// Function: lwip_strnstr
char *
lwip_strnstr(const char *buffer, const char *token, size_t n)
{
  const char *p;
  size_t tokenlen = strlen(token);
  if (tokenlen == 0) {
    return LWIP_CONST_CAST(char *, buffer);
  }
  for (p = buffer; *p && (p + tokenlen <= buffer + n); p++) {
    if ((*p == *token) && (strncmp(p, token, tokenlen) == 0)) {
      return LWIP_CONST_CAST(char *, p);
    }
  }
  return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x20c0
testq %rax, %rax
je 0x13c9b
movq %rax, %r12
movb (%rbx), %al
testb %al, %al
sete %cl
cmpq %r14, %r12
setg %dl
orb %cl, %dl
je 0x13ca1
movq $0x0, (%rsp)
jmp 0x13ce5
movq %rbx, (%rsp)
jmp 0x13ce5
addq %rbx, %r14
movb (%r15), %bpl
incq %rbx
movq $0x0, (%rsp)
cmpb %bpl, %al
jne 0x13ccd
leaq -0x1(%rbx), %r13
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2080
testl %eax, %eax
je 0x13ce1
movb (%rbx), %al
testb %al, %al
je 0x13ce5
leaq (%rbx,%r12), %rcx
incq %rbx
cmpq %r14, %rcx
jbe 0x13cb2
jmp 0x13ce5
movq %r13, (%rsp)
movq (%rsp), %rax
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/def.c
// Function: lwip_itoa
void
lwip_itoa(char *result, size_t bufsize, int number)
{
  char *res = result;
  char *tmp = result + bufsize - 1;
  int n = (number >= 0) ? number : -number;

  /* handle invalid bufsize */
  if (bufsize < 2) {
    if (bufsize == 1) {
      *result = 0;
    }
    return;
  }

  /* First, add sign */
  if (number < 0) {
    *res++ = '-';
  }
  /* Then create the string from the end and stop if buffer full,
     and ensure output string is zero terminated */
  *tmp = 0;
  while ((n != 0) && (tmp > res)) {
    char val = (char)('0' + (n % 10));
    tmp--;
    *tmp = val;
    n = n / 10;
  }
  if (n) {
    /* buffer is too small */
    *result = 0;
    return;
  }
  if (*tmp == 0) {
    /* Nothing added? */
    *res++ = '0';
    *res++ = 0;
    return;
  }
  /* move from temporary buffer to output buffer (sign is not moved) */
  memmove(res, tmp, (size_t)((result + bufsize) - tmp));
}

// Assembly:
movq %rdi, %rcx
movl %edx, %r8d
negl %r8d
cmovsl %edx, %r8d
cmpq $0x1, %rsi
ja 0x13d8a
je 0x13e0b
retq
leaq (%rcx,%rsi), %rax
decq %rax
movq %rcx, %rdi
testl %edx, %edx
jns 0x13d9f
leaq 0x1(%rcx), %rdi
movb $0x2d, (%rcx)
movb $0x0, (%rax)
testl %edx, %edx
setne %r10b
cmpq %rdi, %rax
seta %dl
andb %r10b, %dl
cmpb $0x1, %dl
jne 0x13e06
leaq (%rsi,%rcx), %r9
addq $-0x2, %r9
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
movl %r8d, %r11d
movl %r8d, %r8d
imulq %rdx, %r8
shrq $0x23, %r8
leal (%r8,%r8), %eax
leal (%rax,%rax,4), %eax
movl %r11d, %r10d
subl %eax, %r10d
orb $0x30, %r10b
movb %r10b, (%r9)
addl $-0xa, %r11d
cmpl $-0x13, %r11d
setb %r10b
leaq -0x1(%r9), %rax
cmpl $-0x14, %r11d
ja 0x13e03
cmpq %rdi, %r9
movq %rax, %r9
ja 0x13dc3
incq %rax
testb %r10b, %r10b
je 0x13e0f
movb $0x0, (%rcx)
retq
cmpb $0x0, (%rax)
je 0x13e25
addq %rsi, %rcx
subq %rax, %rcx
movq %rax, %rsi
movq %rcx, %rdx
jmp 0x21d0
movw $0x30, (%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: lwip_standard_chksum
u16_t
lwip_standard_chksum(const void *dataptr, int len)
{
  const u8_t *pb = (const u8_t *)dataptr;
  const u16_t *ps;
  u16_t t = 0;
  u32_t sum = 0;
  int odd = ((mem_ptr_t)pb & 1);

  /* Get aligned to u16_t */
  if (odd && len > 0) {
    ((u8_t *)&t)[1] = *pb++;
    len--;
  }

  /* Add the bulk of the data */
  ps = (const u16_t *)(const void *)pb;
  while (len > 1) {
    sum += *ps++;
    len -= 2;
  }

  /* Consume left-over byte, if any */
  if (len > 0) {
    ((u8_t *)&t)[0] = *(const u8_t *)ps;
  }

  /* Add end bytes */
  sum += t;

  /* Fold 32-bit sum to 16 bits
     calling this twice is probably faster than if statements... */
  sum = FOLD_U32T(sum);
  sum = FOLD_U32T(sum);

  /* Swap if alignment was odd */
  if (odd) {
    sum = SWAP_BYTES_IN_WORD(sum);
  }

  return (u16_t)sum;
}

// Assembly:
testb $0x1, %dil
sete %cl
testl %esi, %esi
setle %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x13e4c
leaq 0x1(%rdi), %rdx
movzbl (%rdi), %ecx
decl %esi
shll $0x8, %ecx
jmp 0x13e51
movq %rdi, %rdx
xorl %ecx, %ecx
cmpl $0x2, %esi
jl 0x13e71
xorl %eax, %eax
movzwl (%rdx), %r8d
addq $0x2, %rdx
addl %r8d, %eax
leal -0x2(%rsi), %r8d
cmpl $0x3, %esi
movl %r8d, %esi
jg 0x13e58
jmp 0x13e74
movl %esi, %r8d
xorl %esi, %esi
cmpl $0x1, %r8d
jne 0x13e7f
movzbl (%rdx), %esi
orl %ecx, %esi
addl %eax, %esi
movl %esi, %eax
shrl $0x10, %eax
movzwl %si, %ecx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x10, %edx
addl %ecx, %edx
movl %edx, %eax
rolw $0x8, %ax
testb $0x1, %dil
cmovel %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: inet_chksum_pseudo
u16_t
inet_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
                   const ip4_addr_t *src, const ip4_addr_t *dest)
{
  u32_t acc;
  u32_t addr;

  addr = ip4_addr_get_u32(src);
  acc = (addr & 0xffffUL);
  acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  addr = ip4_addr_get_u32(dest);
  acc = (u32_t)(acc + (addr & 0xffffUL));
  acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  /* fold down to 16 bits */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);

  return inet_cksum_pseudo_base(p, proto, proto_len, acc);
}

// Assembly:
movl (%rcx), %eax
movl $0xffff, %r9d           # imm = 0xFFFF
movl %eax, %ecx
andl %r9d, %ecx
shrl $0x10, %eax
addl %ecx, %eax
movl (%r8), %ecx
movl %ecx, %r8d
andl %r9d, %r8d
shrl $0x10, %ecx
addl %r8d, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
andl %r9d, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
andl %r9d, %ecx
addl %eax, %ecx
jmp 0x13edb
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: inet_cksum_pseudo_base
static u16_t
inet_cksum_pseudo_base(struct pbuf *p, u8_t proto, u16_t proto_len, u32_t acc)
{
  struct pbuf *q;
  int swapped = 0;

  /* iterate through all pbuf in chain */
  for (q = p; q != NULL; q = q->next) {
    LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
                             (void *)q, (void *)q->next));
    acc += LWIP_CHKSUM(q->payload, q->len);
    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/
    /* just executing this next line is probably faster that the if statement needed
       to check whether we really need to execute it, and does no harm */
    acc = FOLD_U32T(acc);
    if (q->len % 2 != 0) {
      swapped = !swapped;
      acc = SWAP_BYTES_IN_WORD(acc);
    }
    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/
  }

  if (swapped) {
    acc = SWAP_BYTES_IN_WORD(acc);
  }

  acc += (u32_t)lwip_htons((u16_t)proto);
  acc += (u32_t)lwip_htons(proto_len);

  /* Fold 32-bit sum to 16 bits
     calling this twice is probably faster than if statements... */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);
  LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc));
  return (u16_t)~(acc & 0xffffUL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movl %edx, %ebx
movl %esi, %ebp
testq %rdi, %rdi
je 0x13f43
movq %rdi, %r15
xorl %r13d, %r13d
movq 0x8(%r15), %rdi
movzwl 0x12(%r15), %r12d
movl %r12d, %esi
callq 0x13e2c
movzwl %ax, %eax
addl %r14d, %eax
movzwl %ax, %r14d
shrl $0x10, %eax
addl %eax, %r14d
testb $0x1, %r12b
je 0x13f33
xorl %eax, %eax
testl %r13d, %r13d
sete %al
rolw $0x8, %r14w
movzwl %r14w, %r14d
movl %eax, %r13d
movq (%r15), %r15
testq %r15, %r15
jne 0x13ef8
testl %r13d, %r13d
sete %al
jmp 0x13f45
movb $0x1, %al
movl %r14d, %ecx
rolw $0x8, %cx
movzwl %cx, %r15d
testb %al, %al
cmovnel %r14d, %r15d
movzbl %bpl, %edi
callq 0x13c50
movzwl %ax, %ebp
movzwl %bx, %edi
callq 0x13c50
movzwl %ax, %eax
addl %ebp, %eax
addl %r15d, %eax
movzwl %ax, %ecx
shrl $0x10, %eax
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
addl %ecx, %eax
notl %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/inet_chksum.c
// Function: ip6_chksum_pseudo
u16_t
ip6_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
                  const ip6_addr_t *src, const ip6_addr_t *dest)
{
  u32_t acc = 0;
  u32_t addr;
  u8_t addr_part;

  for (addr_part = 0; addr_part < 4; addr_part++) {
    addr = src->addr[addr_part];
    acc = (u32_t)(acc + (addr & 0xffffUL));
    acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
    addr = dest->addr[addr_part];
    acc = (u32_t)(acc + (addr & 0xffffUL));
    acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  }
  /* fold down to 16 bits */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);

  return inet_cksum_pseudo_base(p, proto, proto_len, acc);
}

// Assembly:
pushq %rbp
pushq %rbx
movq %rcx, %rax
xorl %r9d, %r9d
movl $0xffff, %r10d          # imm = 0xFFFF
xorl %ecx, %ecx
movl (%rax,%r9,4), %r11d
movl %r11d, %ebx
andl %r10d, %ebx
addl %ecx, %ebx
shrl $0x10, %r11d
movl (%r8,%r9,4), %ecx
movl %ecx, %ebp
andl %r10d, %ebp
addl %r11d, %ebp
addl %ebx, %ebp
shrl $0x10, %ecx
addl %ebp, %ecx
incq %r9
cmpq $0x4, %r9
jne 0x13fa2
movl %ecx, %eax
shrl $0x10, %eax
movl $0xffff, %r8d           # imm = 0xFFFF
andl %r8d, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
andl %r8d, %ecx
addl %eax, %ecx
movzbl %sil, %esi
movzwl %dx, %edx
popq %rbx
popq %rbp
jmp 0x13edb
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: ip_chksum_pseudo
u16_t
ip_chksum_pseudo(struct pbuf *p, u8_t proto, u16_t proto_len,
                 const ip_addr_t *src, const ip_addr_t *dest)
{
#if LWIP_IPV6
  if (IP_IS_V6(dest)) {
    return ip6_chksum_pseudo(p, proto, proto_len, ip_2_ip6(src), ip_2_ip6(dest));
  }
#endif /* LWIP_IPV6 */
#if LWIP_IPV4 && LWIP_IPV6
  else
#endif /* LWIP_IPV4 && LWIP_IPV6 */
#if LWIP_IPV4
  {
    return inet_chksum_pseudo(p, proto, proto_len, ip_2_ip4(src), ip_2_ip4(dest));
  }
#endif /* LWIP_IPV4 */
}

// Assembly:
testq %r8, %r8
je 0x1400e
cmpb $0x6, 0x14(%r8)
jne 0x1400e
movzbl %sil, %esi
movzwl %dx, %edx
jmp 0x13f92
movl (%rcx), %eax
movl $0xffff, %r9d           # imm = 0xFFFF
movl %eax, %ecx
andl %r9d, %ecx
shrl $0x10, %eax
addl %ecx, %eax
movl (%r8), %ecx
movl %ecx, %r8d
andl %r9d, %r8d
shrl $0x10, %ecx
addl %r8d, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
andl %r9d, %ecx
addl %eax, %ecx
movl %ecx, %eax
shrl $0x10, %eax
andl %r9d, %ecx
addl %eax, %ecx
movzbl %sil, %esi
movzwl %dx, %edx
jmp 0x13edb
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: inet_chksum_pseudo_partial
u16_t
inet_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
                           u16_t chksum_len, const ip4_addr_t *src, const ip4_addr_t *dest)
{
  u32_t acc;
  u32_t addr;

  addr = ip4_addr_get_u32(src);
  acc = (addr & 0xffffUL);
  acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  addr = ip4_addr_get_u32(dest);
  acc = (u32_t)(acc + (addr & 0xffffUL));
  acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  /* fold down to 16 bits */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);

  return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
}

// Assembly:
movl (%r8), %eax
movl $0xffff, %r10d          # imm = 0xFFFF
movl %eax, %r8d
andl %r10d, %r8d
shrl $0x10, %eax
addl %r8d, %eax
movl (%r9), %r8d
movl %r8d, %r9d
andl %r10d, %r9d
shrl $0x10, %r8d
addl %r9d, %r8d
addl %eax, %r8d
movl %r8d, %eax
shrl $0x10, %eax
andl %r10d, %r8d
addl %eax, %r8d
movl %r8d, %eax
shrl $0x10, %eax
andl %r10d, %r8d
addl %eax, %r8d
jmp 0x14093
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: ip6_chksum_pseudo_partial
u16_t
ip6_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
                          u16_t chksum_len, const ip6_addr_t *src, const ip6_addr_t *dest)
{
  u32_t acc = 0;
  u32_t addr;
  u8_t addr_part;

  for (addr_part = 0; addr_part < 4; addr_part++) {
    addr = src->addr[addr_part];
    acc = (u32_t)(acc + (addr & 0xffffUL));
    acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
    addr = dest->addr[addr_part];
    acc = (u32_t)(acc + (addr & 0xffffUL));
    acc = (u32_t)(acc + ((addr >> 16) & 0xffffUL));
  }
  /* fold down to 16 bits */
  acc = FOLD_U32T(acc);
  acc = FOLD_U32T(acc);

  return inet_cksum_pseudo_partial_base(p, proto, proto_len, chksum_len, acc);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %r8, %rax
xorl %r10d, %r10d
movl $0xffff, %r11d          # imm = 0xFFFF
xorl %r8d, %r8d
movl (%rax,%r10,4), %ebx
movl %ebx, %ebp
andl %r11d, %ebp
addl %r8d, %ebp
shrl $0x10, %ebx
movl (%r9,%r10,4), %r8d
movl %r8d, %r14d
andl %r11d, %r14d
addl %ebx, %r14d
addl %ebp, %r14d
shrl $0x10, %r8d
addl %r14d, %r8d
incq %r10
cmpq $0x4, %r10
jne 0x141d6
movl %r8d, %eax
shrl $0x10, %eax
movl $0xffff, %r9d           # imm = 0xFFFF
andl %r9d, %r8d
addl %eax, %r8d
movl %r8d, %eax
shrl $0x10, %eax
andl %r9d, %r8d
addl %eax, %r8d
movzbl %sil, %esi
movzwl %dx, %edx
movzwl %cx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x14093
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: ip_chksum_pseudo_partial
u16_t
ip_chksum_pseudo_partial(struct pbuf *p, u8_t proto, u16_t proto_len,
                         u16_t chksum_len, const ip_addr_t *src, const ip_addr_t *dest)
{
#if LWIP_IPV6
  if (IP_IS_V6(dest)) {
    return ip6_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip6(src), ip_2_ip6(dest));
  }
#endif /* LWIP_IPV6 */
#if LWIP_IPV4 && LWIP_IPV6
  else
#endif /* LWIP_IPV4 && LWIP_IPV6 */
#if LWIP_IPV4
  {
    return inet_chksum_pseudo_partial(p, proto, proto_len, chksum_len, ip_2_ip4(src), ip_2_ip4(dest));
  }
#endif /* LWIP_IPV4 */
}

// Assembly:
testq %r9, %r9
je 0x14251
cmpb $0x6, 0x14(%r9)
jne 0x14251
movzbl %sil, %esi
movzwl %dx, %edx
movzwl %cx, %ecx
jmp 0x141c3
movl (%r8), %eax
movl $0xffff, %r10d          # imm = 0xFFFF
movl %eax, %r8d
andl %r10d, %r8d
shrl $0x10, %eax
addl %r8d, %eax
movl (%r9), %r8d
movl %r8d, %r9d
andl %r10d, %r9d
shrl $0x10, %r8d
addl %r9d, %r8d
addl %eax, %r8d
movl %r8d, %eax
shrl $0x10, %eax
andl %r10d, %r8d
addl %eax, %r8d
movl %r8d, %eax
shrl $0x10, %eax
andl %r10d, %r8d
addl %eax, %r8d
movzbl %sil, %esi
movzwl %dx, %edx
movzwl %cx, %ecx
jmp 0x14093
// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/inet_chksum.c
// Function: inet_chksum_pbuf
u16_t
inet_chksum_pbuf(struct pbuf *p)
{
  u32_t acc;
  struct pbuf *q;
  int swapped = 0;

  acc = 0;
  for (q = p; q != NULL; q = q->next) {
    acc += LWIP_CHKSUM(q->payload, q->len);
    acc = FOLD_U32T(acc);
    if (q->len % 2 != 0) {
      swapped = !swapped;
      acc = SWAP_BYTES_IN_WORD(acc);
    }
  }

  if (swapped) {
    acc = SWAP_BYTES_IN_WORD(acc);
  }
  return (u16_t)~(acc & 0xffffUL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x14308
movq %rdi, %rbx
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x8(%rbx), %rdi
movzwl 0x12(%rbx), %ebp
movl %ebp, %esi
callq 0x13e2c
movzwl %ax, %eax
addl %r14d, %eax
movzwl %ax, %r14d
shrl $0x10, %eax
addl %eax, %r14d
testb $0x1, %bpl
je 0x142f8
xorl %eax, %eax
testl %r15d, %r15d
sete %al
rolw $0x8, %r14w
movzwl %r14w, %r14d
movl %eax, %r15d
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x142bf
testl %r15d, %r15d
sete %cl
jmp 0x1430d
movb $0x1, %cl
xorl %r14d, %r14d
movl %r14d, %eax
rolw $0x8, %ax
testb %cl, %cl
cmovnel %r14d, %eax
notl %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/antonblanchard[P]will-it-scale/tests/fallocate1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	char tmpfile[] = "/dev/shm/willitscale.XXXXXX";
	int fd = mkstemp(tmpfile);
	unsigned long place = 0;
	assert(fd >= 0);
	unlink(tmpfile);

	while (1) {
		int ret = fallocate(fd, 0, place, BUFLEN);
		if (errno != EINTR)
			assert(ret == 0);
		place += BUFLEN;
		if (place >= FILESIZE) {
			ret = ftruncate(fd, 0);
			assert(ret == 0);
			place = 0;
		}
		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movups 0x678(%rip), %xmm0      # 0x22ec
movq %rsp, %rdi
movups %xmm0, 0xc(%rdi)
movaps 0x65e(%rip), %xmm0      # 0x22e0
movaps %xmm0, (%rdi)
callq 0x11f0
testl %eax, %eax
js 0x1d24
movl %eax, %ebp
movq %rsp, %rdi
callq 0x1080
movl $0x2000, %ecx           # imm = 0x2000
movl %ebp, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1170
movl %eax, %r15d
callq 0x1070
movq %rax, %r14
cmpl $0x4, (%rax)
je 0x1cc1
testl %r15d, %r15d
jne 0x1d05
xorl %r15d, %r15d
addq $0x2000, %r15           # imm = 0x2000
cmpq $0x100000, %r15         # imm = 0x100000
jb 0x1ce7
movl %ebp, %edi
xorl %esi, %esi
callq 0x1120
movl $0x0, %r15d
testl %eax, %eax
jne 0x1d43
incq (%rbx)
movl $0x2000, %ecx           # imm = 0x2000
movl %ebp, %edi
xorl %esi, %esi
movq %r15, %rdx
callq 0x1170
cmpl $0x4, (%r14)
je 0x1cc4
testl %eax, %eax
je 0x1cc4
leaq 0x5c0(%rip), %rdi       # 0x22cc
leaq 0x573(%rip), %rsi       # 0x2286
leaq 0x57f(%rip), %rcx       # 0x2299
movl $0x1a, %edx
callq 0x1130
leaq 0x553(%rip), %rdi       # 0x227e
leaq 0x554(%rip), %rsi       # 0x2286
leaq 0x560(%rip), %rcx       # 0x2299
movl $0x14, %edx
callq 0x1130
leaq 0x582(%rip), %rdi       # 0x22cc
leaq 0x535(%rip), %rsi       # 0x2286
leaq 0x541(%rip), %rcx       # 0x2299
movl $0x1e, %edx
callq 0x1130
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0xd/main_test.c
// Function: main
int main(void)
{
	int fail = 0;
	int i = 0;

	printf("=====================\n");
	printf("Column 0xd: Searching\n");
	printf("=====================\n");

	if (test_set1(&i))
		fail++;

	return fail;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4(%rsp), %rbx
movl $0x0, (%rbx)
leaq 0xe48(%rip), %r14       # 0x201a
movq %r14, %rdi
callq 0x1050
leaq 0xe23(%rip), %rdi       # 0x2004
callq 0x1050
movq %r14, %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1354
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0xd/set1.c
// Function: alloc_set1
struct set *alloc_set1(int nr, int max)
{
	struct set1 *s;
	int i;

	s = malloc(sizeof(struct set1)+sizeof(int)*(nr+1));
	if (!s)
		return NULL;

	s->max = max;
	s->set = set;
	s->alloc = nr+1;
	for (i = 0; i < nr; i++)
		s->x[i] = 0;
	s->n = 0;	/* n does not incluse the sentinel */
	s->x[0] = max;	/* sentinel */
	return &s->set;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %r15d
movslq %edi, %rax
leaq 0x34(,%rax,4), %rdi
callq 0x10a0
testq %rax, %rax
je 0x1279
movq %rax, %r14
leal 0x1(%r15), %eax
movl %ebx, 0x4(%r14)
movups 0x2647(%rip), %xmm0     # 0x3880
movups %xmm0, 0x8(%r14)
movups 0x264b(%rip), %xmm0     # 0x3890
movups %xmm0, 0x18(%r14)
movl %eax, 0x28(%r14)
testl %r15d, %r15d
jle 0x1265
leaq 0x2c(%r14), %rdi
movl %r15d, %edx
shlq $0x2, %rdx
xorl %esi, %esi
callq 0x1090
movq %r14, %rax
addq $0x8, %rax
movl $0x0, (%r14)
movl %ebx, 0x2c(%r14)
jmp 0x127b
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0xd/set1.c
// Function: insert
static int insert(struct set *b, int x)
{
	struct set1 *s = container_of(b, struct set1, set);
	int i, j;

	assert(x < s->max);

	/* find the position */
	for (i = 0; s->x[i] < x; i++)
		;

	/* ignore the duplicate */
	if (s->x[i] == x)
		return -1;

	/* array is full */
	if (s->n+1 == s->alloc)
		return -2;

	/* shift array */
	for (j = s->n+1; j > i; j--)
		s->x[j] = s->x[j-1];

	/* put the value */
	s->x[i] = x;
	s->n++;

	return i;
}

// Assembly:
pushq %rax
cmpl %esi, -0x4(%rdi)
jle 0x130e
leaq 0x24(%rdi), %r8
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %r8, %r9
addq %rax, %rdx
addq $0x4, %r8
incl %ecx
cmpl %esi, (%r9)
jl 0x12b2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
je 0x130c
movslq -0x8(%rdi), %r9
leal 0x1(%r9), %r10d
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpl 0x20(%rdi), %r10d
je 0x130c
cmpl %ecx, %r9d
jl 0x1303
sarq $0x20, %rdx
addq $0xa, %r9
movl -0x4(%rdi,%r9,4), %eax
movl %eax, (%rdi,%r9,4)
leaq -0x1(%r9), %rax
addq $-0xa, %r9
cmpq %rdx, %r9
movq %rax, %r9
jg 0x12ea
movl %esi, -0x4(%r8)
incl -0x8(%rdi)
movl %ecx, %eax
popq %rcx
retq
leaq 0xd1b(%rip), %rdi       # 0x2030
leaq 0xd1f(%rip), %rsi       # 0x203b
leaq 0xd1f(%rip), %rcx       # 0x2042
movl $0x26, %edx
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0xd/set1.c
// Function: report
static void report(const struct set *b, int x[])
{
	struct set1 *s = container_of(b, struct set1, set);
	int i;

	for (i = 0; i < s->n; i++)
		x[i] = s->x[i];
	x[i] = s->x[i]; /* copy sentinel */
}

// Assembly:
cmpl $0x0, -0x8(%rdi)
jle 0x134a
xorl %eax, %eax
movl 0x24(%rdi,%rax,4), %ecx
movl %ecx, (%rsi,%rax,4)
incq %rax
movslq -0x8(%rdi), %rcx
cmpq %rcx, %rax
jl 0x1335
jmp 0x134c
xorl %eax, %eax
movl 0x24(%rdi,%rax,4), %ecx
movl %ecx, (%rsi,%rax,4)
retq
// File: /workspace/github_c_makefile_star2_O1/ikbenlike[P]nngutils/src/tty.c
// Function: main
int main(int argc, char **argv){
    bool silent = false;
    if(argc > 1){
        if(strcmp(argv[1], "--quiet")){
            silent = true;
        }
        else if(strcmp(argv[1], "-s")){
            silent = true;
        }
        else if(strcmp(argv[1], "--silent")){
            silent = true;
        }
        else {
            fprintf(stderr, "%s: incorrect argument %s\n", argv[0], argv[1]);
            return 1;
        }
    }
    char *tty = ttyname(STDIN_FILENO);
    if(tty == NULL){
        fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
        return 1;
    }
    if(silent == false){
        puts(tty);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
cmpl $0x2, %edi
jl 0x121e
movq 0x8(%rbx), %r15
leaq 0xe18(%rip), %rsi       # 0x2004
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
jne 0x121e
leaq 0xe0d(%rip), %rsi       # 0x200c
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
jne 0x121e
leaq 0xdfd(%rip), %rsi       # 0x200f
movq %r15, %rdi
callq 0x1050
testl %eax, %eax
je 0x1259
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x1070
testq %rax, %rax
je 0x1249
cmpl $0x1, %r14d
jg 0x123b
movq %rax, %rdi
callq 0x1040
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x10a0
movl $0x1, %r15d
jmp 0x123b
movq 0x2d98(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0xdab(%rip), %rsi       # 0x2018
movq %r15, %rcx
xorl %eax, %eax
callq 0x1060
jmp 0x1251
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: err
void
err(char *fmt, ...)
{
	va_list ap;
	va_start(ap, fmt);
	fprintf(stderr, "error: ");
	vfprintf(stderr, fmt, ap);
	fprintf(stderr, "\n");
	va_end(ap);
	exit(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xe0(%rbp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2717
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0x30(%rbp), %r14
movq %rdi, 0x10(%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0x58a5(%rip), %r15      # 0x7fe0
movq (%r15), %rcx
leaq 0x2aeb(%rip), %rdi      # 0x5230
movl $0x7, %esi
movl $0x1, %edx
callq 0x2480
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2320
movq (%r15), %rsi
movl $0xa, %edi
callq 0x22e0
movl $0x1, %edi
callq 0x22d0
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: resize
void
resize(void)
{
	int w, h;
	SDL_GetWindowSize(window, &w, &h);
	printf("resize %d %d\n", w, h);
	texrect.x = (w-1024)/2;
	texrect.y = (h-1024)/2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq 0x5ac6(%rip), %rdi      # 0x8298
leaq -0x18(%rbp), %r14
leaq -0x14(%rbp), %rbx
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2110
movl (%r14), %esi
movl (%rbx), %edx
leaq 0x2a47(%rip), %rdi      # 0x5238
xorl %eax, %eax
callq 0x2040
movl (%r14), %eax
movl $0xfffffc00, %ecx       # imm = 0xFFFFFC00
movl %eax, %edx
addl %ecx, %edx
shrl $0x1f, %edx
addl %edx, %eax
addl $0xfffffc00, %eax       # imm = 0xFFFFFC00
sarl %eax
movl %eax, 0x5a8a(%rip)      # 0x82a0
movl (%rbx), %eax
addl %eax, %ecx
shrl $0x1f, %ecx
addl %ecx, %eax
addl $0xfffffc00, %eax       # imm = 0xFFFFFC00
sarl %eax
movl %eax, 0x5a78(%rip)      # 0x82a4
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: keydn
void
keydn(int scancode)
{
	int i;
	u32 ojoys[NUMJOYS];

	for(i = 0; i < NUMJOYS; i++)
		ojoys[i] = joys[i].b;
	switch(scancode){
	case SDL_SCANCODE_ESCAPE:
		exit(0);
		break;

	case SDL_SCANCODE_E: KEY1(04);
	case SDL_SCANCODE_X: KEY1(010);
	case SDL_SCANCODE_C: KEY1(020000);
	case SDL_SCANCODE_A: KEY1(020);
	case SDL_SCANCODE_D: KEY1(040);
	case SDL_SCANCODE_S: KEY1(0100);
	case SDL_SCANCODE_W: KEY1(0200);

	case SDL_SCANCODE_U: KEY2(04);
	case SDL_SCANCODE_N: KEY2(010);
	case SDL_SCANCODE_M: KEY2(020000);
	case SDL_SCANCODE_J: KEY2(020);
	case SDL_SCANCODE_L: KEY2(040);
	case SDL_SCANCODE_K: KEY2(0100);
	case SDL_SCANCODE_I: KEY2(0200);

	case SDL_SCANCODE_F:
		fullscreen = !fullscreen;
		SDL_SetWindowFullscreen(window, modes[fullscreen]);
		resize();
		break;
	}
	for(i = 0; i < NUMJOYS; i++)
		if(joys[i].b != ojoys[i])
			updatejoy(&joys[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
xorl %eax, %eax
leaq 0x5a65(%rip), %r14      # 0x82b0
movl 0x4(%r14,%rax,4), %ecx
movl %ecx, -0x30(%rbp,%rax)
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x284b
addl $-0x4, %edi
cmpl $0x25, %edi
ja 0x2931
leaq 0x2827(%rip), %rax      # 0x5098
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
orb $0x10, 0x5a33(%rip)     # 0x82b4
jmp 0x2931
orb $-0x80, 0x5a27(%rip)    # 0x82b4
jmp 0x2931
orb $0x8, 0x5a2b(%rip)      # 0x82c4
jmp 0x2931
orb $0x4, 0x5a1f(%rip)      # 0x82c4
jmp 0x2931
orb $0x20, 0x5a03(%rip)     # 0x82b4
jmp 0x2931
orb $-0x80, 0x5a0a(%rip)    # 0x82c4
jmp 0x2931
orb $0x40, 0x59f1(%rip)     # 0x82b4
jmp 0x2931
orb $0x20, 0x59e9(%rip)     # 0x82b5
jmp 0x2931
orb $0x10, 0x59ef(%rip)     # 0x82c4
jmp 0x2931
orb $0x40, 0x59e6(%rip)     # 0x82c4
jmp 0x2931
orb $0x8, 0x59cd(%rip)      # 0x82b4
jmp 0x2931
orb $0x4, 0x59c4(%rip)      # 0x82b4
jmp 0x2931
xorl %eax, %eax
cmpl $0x0, 0x59f5(%rip)      # 0x82f0
sete %al
movl %eax, 0x59ec(%rip)      # 0x82f0
movq 0x598d(%rip), %rdi      # 0x8298
leaq 0x595a(%rip), %rcx      # 0x826c
movl (%rcx,%rax,4), %esi
callq 0x2290
callq 0x27c0
jmp 0x2931
orb $0x20, 0x599d(%rip)     # 0x82c5
jmp 0x2931
orb $0x20, 0x5993(%rip)     # 0x82c4
xorl %r15d, %r15d
leaq -0x1c(%rbp), %rbx
movl 0x4(%r14,%r15,4), %eax
cmpl -0x30(%rbp,%r15), %eax
je 0x296b
leaq (,%r15,4), %rcx
movl (%rcx,%r14), %ecx
shll $0x18, %ecx
orl %eax, %ecx
movl %ecx, -0x1c(%rbp)
movl 0x5932(%rip), %edi      # 0x8290
movl $0x4, %edx
movq %rbx, %rsi
callq 0x20f0
addq $0x4, %r15
cmpq $0x10, %r15
jne 0x2938
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x22d0
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: keyup
void
keyup(int scancode)
{
	int i;
	u32 ojoys[NUMJOYS];

	for(i = 0; i < NUMJOYS; i++)
		ojoys[i] = joys[i].b;
	switch(scancode){
	case SDL_SCANCODE_E: KEY1(04);
	case SDL_SCANCODE_X: KEY1(010);
	case SDL_SCANCODE_C: KEY1(020000);
	case SDL_SCANCODE_A: KEY1(020);
	case SDL_SCANCODE_D: KEY1(040);
	case SDL_SCANCODE_S: KEY1(0100);
	case SDL_SCANCODE_W: KEY1(0200);

	case SDL_SCANCODE_U: KEY2(04);
	case SDL_SCANCODE_N: KEY2(010);
	case SDL_SCANCODE_M: KEY2(020000);
	case SDL_SCANCODE_J: KEY2(020);
	case SDL_SCANCODE_L: KEY2(040);
	case SDL_SCANCODE_K: KEY2(0100);
	case SDL_SCANCODE_I: KEY2(0200);
	}
	for(i = 0; i < NUMJOYS; i++)
		if(joys[i].b != ojoys[i])
			updatejoy(&joys[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
xorl %eax, %eax
leaq 0x5913(%rip), %r14      # 0x82b0
movl 0x4(%r14,%rax,4), %ecx
movl %ecx, -0x30(%rbp,%rax)
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x299d
addl $-0x4, %edi
cmpl $0x17, %edi
ja 0x29db
movl $0xd43f1d, %eax         # imm = 0xD43F1D
btl %edi, %eax
jae 0x29db
movl %edi, %eax
leaq 0x5345(%rip), %rcx      # 0x7d10
movq (%rcx,%rax,8), %rcx
leaq 0x275a(%rip), %rdx      # 0x5130
movl (%rdx,%rax,4), %eax
andl %eax, (%rcx)
xorl %r15d, %r15d
leaq -0x1c(%rbp), %rbx
movl 0x4(%r14,%r15,4), %eax
cmpl -0x30(%rbp,%r15), %eax
je 0x2a15
leaq (,%r15,4), %rcx
movl (%rcx,%r14), %ecx
shll $0x18, %ecx
orl %eax, %ecx
movl %ecx, -0x1c(%rbp)
movl 0x5888(%rip), %edi      # 0x8290
movl $0x4, %edx
movq %rbx, %rsi
callq 0x20f0
addq $0x4, %r15
cmpq $0x10, %r15
jne 0x29e2
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: joyhat
void
joyhat(SDL_JoyHatEvent *he)
{
//	printf("%d %d %d\n", he->which, he->hat, he->value);
	u32 i, b;
	i = he->which;
	if(i >= NUMJOYS)
		return;

	b = 0;
	switch(he->value){
	case SDL_HAT_UP:	b = 0200; break;
	case SDL_HAT_RIGHTUP:	b = 0240; break;
	case SDL_HAT_RIGHT:	b = 0040; break;
	case SDL_HAT_RIGHTDOWN:	b = 0140; break;
	case SDL_HAT_DOWN:	b = 0100; break;
	case SDL_HAT_LEFTDOWN:	b = 0120; break;
	case SDL_HAT_LEFT:	b = 0020; break;
	case SDL_HAT_LEFTUP:	b = 0220; break;
	}

	joys[i].b &= ~0360;
	joys[i].b |= b;
	updatejoy(&joys[i]);
}

// Assembly:
movl 0x8(%rdi), %eax
cmpq $0x3, %rax
ja 0x2ac3
movb 0xd(%rdi), %dl
decb %dl
xorl %ecx, %ecx
cmpb $0xb, %dl
ja 0x2a7e
movzbl %dl, %ecx
leaq 0x2759(%rip), %rdx      # 0x51d4
movl (%rdx,%rcx,4), %ecx
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
shlq $0x4, %rax
leaq 0x581f(%rip), %rdx      # 0x82b0
movl $0xffffff0f, %esi       # imm = 0xFFFFFF0F
andl 0x4(%rax,%rdx), %esi
orl %ecx, %esi
movl %esi, 0x4(%rax,%rdx)
movl (%rax,%rdx), %eax
shll $0x18, %eax
orl %esi, %eax
leaq -0x4(%rbp), %rsi
movl %eax, (%rsi)
movl 0x57dc(%rip), %edi      # 0x8290
movl $0x4, %edx
callq 0x20f0
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: joybtn
void
joybtn(SDL_JoyButtonEvent *be)
{
	u32 i, b;
	i = be->which;
	if(i >= NUMJOYS)
		return;

	b = joys[i].map(be->button);
	if(be->state){
		joys[i].b |= b;
		updatejoy(&joys[i]);
	}else{
		joys[i].b &= ~b;
		updatejoy(&joys[i]);
	}

//	printf("%d %d %d. %o\n", be->which, be->button, be->state, joys[i].b);
}

// Assembly:
movl 0x8(%rdi), %eax
cmpq $0x3, %rax
ja 0x2b3e
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
shlq $0x4, %rax
leaq 0x57ca(%rip), %rcx      # 0x82b0
leaq (%rcx,%rax), %r14
movzbl 0xc(%rdi), %edi
callq *0x8(%rax,%rcx)
cmpb $0x0, 0xd(%rbx)
je 0x2b0e
orl 0x4(%r14), %eax
movl %eax, 0x4(%r14)
movl (%r14), %ecx
shll $0x18, %ecx
orl %eax, %ecx
leaq -0x14(%rbp), %rsi
jmp 0x2b24
notl %eax
andl 0x4(%r14), %eax
movl %eax, 0x4(%r14)
movl (%r14), %ecx
shll $0x18, %ecx
orl %eax, %ecx
leaq -0x18(%rbp), %rsi
movl %ecx, (%rsi)
movl 0x5764(%rip), %edi      # 0x8290
movl $0x4, %edx
callq 0x20f0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: joyinit
void
joyinit(void)
{
	int i, n;
	SDL_Joystick *j;

	SDL_JoystickEventState(SDL_ENABLE);

	for(i = 0; i < NUMJOYS; i++){
		joys[i].i = i;
		joys[i].map = btnmap_ds3;
	}

	n = SDL_NumJoysticks();
	for(i = 0; i < n && i < NUMJOYS; i++){
		j = SDL_JoystickOpen(i);
		if(j == nil)
			continue;
		if(strcmp(SDL_JoystickNameForIndex(i), "Twin USB Joystick") == 0)
			joys[i].map = btnmap_ds2;
		printf("joy %d: %s\n", i, SDL_JoystickNameForIndex(i));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %edi
callq 0x2240
leaq 0x575a(%rip), %rax      # 0x82b8
xorl %ecx, %ecx
leaq -0x124(%rip), %rdx      # 0x2a43
movl %ecx, -0x8(%rax)
movq %rdx, (%rax)
incq %rcx
addq $0x10, %rax
cmpq $0x4, %rcx
jne 0x2b67
callq 0x2170
testl %eax, %eax
jle 0x2c00
decl %eax
cmpl $0x3, %eax
movl $0x3, %r12d
cmovbl %eax, %r12d
incl %r12d
leaq 0x571c(%rip), %r13      # 0x82b8
leaq 0x26a3(%rip), %rbx      # 0x5246
leaq 0x26ae(%rip), %r14      # 0x5258
xorl %r15d, %r15d
movl %r15d, %edi
callq 0x2120
testq %rax, %rax
je 0x2bf4
movl %r15d, %edi
callq 0x2330
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2350
testl %eax, %eax
jne 0x2bdc
leaq -0x1ae(%rip), %rax      # 0x2a2a
movq %rax, (%r13)
movl %r15d, %edi
callq 0x2330
movq %r14, %rdi
movl %r15d, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2040
incq %r15
addq $0x10, %r13
cmpq %r15, %r12
jne 0x2bad
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: mouse
void
mouse(int button, int state, int x, int y)
{
	u32 pen = 0x80000000;
	pen |= x;
	pen |= y<<10;
	if(state) pen |= 1<<20;
	if(state || penstate != !!state)
		write(sock, &pen, 4);
	penstate = !!state;
//	printf("%d %d %d %d\n", button, state, x, y);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
shll $0xa, %ecx
xorl %eax, %eax
testl %esi, %esi
setne %al
shll $0x14, %eax
orl %edx, %ecx
orl %eax, %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, -0xc(%rbp)
movl 0x56bd(%rip), %eax      # 0x82f4
orl %esi, %eax
je 0x2c4f
movl 0x564f(%rip), %edi      # 0x8290
leaq -0xc(%rbp), %rsi
movl $0x4, %edx
callq 0x20f0
xorl %eax, %eax
testl %ebx, %ebx
setne %al
movl %eax, 0x5698(%rip)      # 0x82f4
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aap[P]rx-0/misc/crt.c
// Function: startcrt
void
startcrt(int fd, void *arg)
{
	static CRT CRT_;

	sock = fd;
	threadcreate(pixelthread, &CRT_);
	threadcreate(renderthread, &CRT_);
for(;;) sleep(1);
	exit(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, 0x560f(%rip)      # 0x8290
leaq 0x2a(%rip), %rdi        # 0x2cb2
leaq 0x5669(%rip), %rbx      # 0x82f8
movq %rbx, %rsi
callq 0x3bb4
leaq 0x11f(%rip), %rdi       # 0x2dbd
movq %rbx, %rsi
callq 0x3bb4
movl $0x1, %edi
callq 0x21c0
jmp 0x2ca6