#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct sockaddr_ll {
  unsigned int sll_ifindex;
  unsigned int sll_halen;
  int /*<<< orphan*/ *sll_addr;
  void *sll_pkttype;
  void *sll_protocol;
  void *sll_family;
};
struct sockaddr {
  int dummy;
};
struct TYPE_2__ {
  int sa_family;
  scalar_t__ sa_data;
};
struct ifreq {
  unsigned int ifr_ifindex;
  char *ifr_name;
  int ifr_flags;
  TYPE_1__ ifr_hwaddr;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int socklen_t;
typedef int /*<<< orphan*/ req;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int ARPHRD_ETHER;
int IFF_UP;
void *PACKET_HOST;
void *PF_PACKET;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SIOCGIFHWADDR;
int /*<<< orphan*/ SIOCGIFNAME;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ assert(int);
unsigned int atoi(char *);
int bind(int, struct sockaddr *, int);
int errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
void *htons(int);
int ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ ntohs(void *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recvfrom(int, char *, int, int /*<<< orphan*/,
                            struct sockaddr *, int *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(void *, int /*<<< orphan*/, void *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int r;
  int s = socket(PF_PACKET, SOCK_DGRAM, htons(0xf040));
  assert(s >= 0);
  unsigned index = -1;
  {
    unsigned i = 0;
    struct ifreq ifr;
    do {
      ifr.ifr_ifindex = i;
      r = ioctl(s, SIOCGIFNAME, &ifr);
      if (r >= 0) {
        int up;
        printf("Index %d: r: %d errno %d name: %10s", i, r, errno,
               ifr.ifr_name);
        r = ioctl(s, SIOCGIFFLAGS, &ifr);
        assert(r >= 0);
        printf(" flags 0x%05x", ifr.ifr_flags);
        up = ifr.ifr_flags & IFF_UP;
        r = ioctl(s, SIOCGIFHWADDR, &ifr);
        assert(r >= 0);
        printf(" addr family %d ", ifr.ifr_hwaddr.sa_family);
        if (ifr.ifr_hwaddr.sa_family == ARPHRD_ETHER) {
          printf("ethernet %s ", up ? "up" : "down");
          uint8_t *addr = (uint8_t *)ifr.ifr_hwaddr.sa_data;
          for (unsigned n = 0; n < 6; n++)
            printf("%s%02X", n ? ":" : "", addr[n]);
          if (up)
            index = i;
        }
        printf("\n");
      }
    } while (++i < 10);
  }
  assert(index >= 0);
  static char buf[10000];
  static char req[] = {0x00, 0x0A, 0x00, 0x00, 0x0F,
                       0x05, 0x80, 0x00, 0x00, 0x01};
  struct sockaddr_ll addr;
  addr.sll_protocol = htons(0xf040);
  addr.sll_ifindex = argv[1] ? atoi(argv[1]) : index;
  addr.sll_family = PF_PACKET;
  addr.sll_pkttype = PACKET_HOST;
  memset(addr.sll_addr, 0xff, sizeof(addr.sll_addr));
  r = bind(s, (struct sockaddr *)&addr, sizeof(addr));
  assert(r >= 0);
  for (unsigned i = 0; i < 10; i++) {
    socklen_t alen = sizeof(addr);
    addr.sll_protocol = htons(0xf040);
    addr.sll_ifindex = argv[1] ? atoi(argv[1]) : index;
    addr.sll_family = PF_PACKET;
    addr.sll_pkttype = PACKET_HOST;
    memset(addr.sll_addr, 0xff, sizeof(addr.sll_addr));
    ssize_t ss = sendto(s, req, sizeof(req), 0, (struct sockaddr *)&addr, alen);
    printf("ss %5zd\n", ss);
    ssize_t sr = recvfrom(s, buf, 10000, 0, (struct sockaddr *)&addr, &alen);
    printf(
        "sr %5zd, alen %zd %d, errno %d, addr.fam %d proto 0x%x if %d %d %d ",
        sr, sizeof(addr), alen, errno, addr.sll_family,
        ntohs(addr.sll_protocol), addr.sll_ifindex, addr.sll_pkttype,
        addr.sll_halen);
    for (unsigned n = 0; n < addr.sll_halen; n++)
      printf("%s%02X", n ? ":" : "", addr.sll_addr[n]);
    printf("\n");
    fflush(stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xe8,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xb0(%rbp)
mov    0x2dde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    $0xf040,%edi
call   1030 <htons@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%esi
mov    %rax,%rdx
call   10e0 <socket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
movl   $0xffffffff,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%edi
mov    0x2d5d(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1060 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     13b9 <main+0x1f9>
mov    -0x28(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    0x2d30(%rip),%rax
mov    (%rax),%ecx
mov    -0x48(%rbp),%r8
lea    0xd83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1060 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x40(%rbp),%esi
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%eax
mov    0x2d10(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%edi
mov    0x2cd9(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1060 <ioctl@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x38(%rbp),%esi
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
mov    0x2cb7(%rip),%rcx
cmp    (%rcx),%eax
jne    13ab <main+0x1eb>
mov    -0x54(%rbp),%ecx
lea    0xd30(%rip),%rsi
lea    0xd26(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x6,-0x64(%rbp)
jae    1396 <main+0x1d6>
mov    -0x64(%rbp),%ecx
lea    0xd07(%rip),%rsi
lea    0xcf6(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x60(%rbp),%rax
mov    -0x64(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    0xcd7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    134e <main+0x18e>
cmpl   $0x0,-0x54(%rbp)
je     13a6 <main+0x1e6>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    13ab <main+0x1eb>
lea    0xcb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13be <main+0x1fe>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmp    $0xa,%eax
jb     123b <main+0x7b>
cmpl   $0x0,-0x24(%rbp)
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    $0xf040,%edi
call   1030 <htons@plt>
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1416 <main+0x256>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0xb4(%rbp)
jmp    141f <main+0x25f>
mov    -0x24(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    0x2bbe(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    0x2ba0(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x88(%rbp),%rdi
mov    $0xff,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
mov    -0x20(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x28,%edx
call   10c0 <bind@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0xa,-0x94(%rbp)
jae    16af <main+0x4ef>
movl   $0x28,-0x98(%rbp)
mov    $0xf040,%edi
call   1030 <htons@plt>
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     14db <main+0x31b>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0xb8(%rbp)
jmp    14e4 <main+0x324>
mov    -0x24(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    0x2af9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    0x2adb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x88(%rbp),%rdi
mov    $0xff,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
mov    -0x20(%rbp),%edi
lea    -0x90(%rbp),%r8
mov    -0x98(%rbp),%r9d
lea    0x2b46(%rip),%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%esi
lea    0xb08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x90(%rbp),%r8
lea    0x2b5f(%rip),%rsi
mov    $0x2710,%edx
xor    %ecx,%ecx
lea    -0x98(%rbp),%r9
call   10a0 <recvfrom@plt>
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    0x29f7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x78(%rbp),%rdi
call   10b0 <ntohs@plt>
mov    -0xcc(%rbp),%esi
mov    -0xc8(%rbp),%ecx
mov    -0xc4(%rbp),%r8d
mov    -0xc0(%rbp),%r9
mov    %eax,%ebx
mov    -0x90(%rbp),%r11d
mov    -0x80(%rbp),%r10
mov    -0x8c(%rbp),%eax
lea    0xa71(%rip),%rdi
mov    $0x28,%edx
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
cmp    -0x8c(%rbp),%eax
jae    167f <main+0x4bf>
mov    -0xa4(%rbp),%ecx
lea    0xa2a(%rip),%rsi
lea    0xa19(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x88(%rbp),%rax
mov    -0xa4(%rbp),%ecx
mov    (%rax,%rcx,4),%edx
lea    0x9f4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1620 <main+0x460>
lea    0x9e2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2904(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    148f <main+0x2cf>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,0x40(%rsp)
mov    0x2e06(%rip),%rax
mov    (%rax),%rbx
mov    0x2ddc(%rip),%rax
mov    (%rax),%ebp
mov    $0xf040,%edi
call   1040 <htons@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
call   10f0 <socket@plt>
mov    %eax,%ebp
mov    %eax,%edi
not    %edi
shr    $0x1f,%edi
call   1090 <assert@plt>
movl   $0xffffffff,0x4(%rsp)
ff
lea    0x10(%rsp),%r12
lea    0xe29(%rip),%r13
xor    %r14d,%r14d
mov    %ebp,0xc(%rsp)
jmp    1258 <main+0x88>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    $0xa,%r14d
je     13c5 <main+0x1f5>
mov    %r14d,0x10(%rsp)
mov    0x2d44(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r12,%rdx
call   1070 <ioctl@plt>
test   %eax,%eax
js     124a <main+0x7a>
mov    0x2d25(%rip),%rcx
mov    (%rcx),%ecx
mov    0x18(%rsp),%r8
lea    0xd77(%rip),%rdi
mov    %r14d,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r12,%rdx
call   1070 <ioctl@plt>
not    %eax
shr    $0x1f,%eax
mov    %eax,%edi
call   1090 <assert@plt>
mov    0x20(%rsp),%esi
lea    0xd65(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rsp),%r15d
mov    0x2d06(%rip),%rax
mov    (%rax),%ebx
mov    0x2cd5(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
mov    %r12,%rdx
call   1070 <ioctl@plt>
not    %eax
shr    $0x1f,%eax
mov    %eax,%edi
call   1090 <assert@plt>
mov    0x28(%rsp),%esi
lea    0xd34(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%eax
mov    0x2cb8(%rip),%rcx
cmp    (%rcx),%eax
jne    1240 <main+0x70>
test   %r15d,%ebx
lea    0xd2e(%rip),%rsi
lea    0xd2a(%rip),%rax
cmove  %rax,%rsi
mov    0x4(%rsp),%eax
cmovne %r14d,%eax
mov    %eax,0x4(%rsp)
lea    0xd03(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%r15
mov    (%r15),%edx
mov    %r13,%rdi
lea    0xd10(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%r15),%edx
mov    %r13,%rdi
lea    0xcf1(%rip),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%r15),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%r15),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%r15),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%r15),%edx
mov    0xc(%rsp),%ebp
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1240 <main+0x70>
mov    $0x1,%edi
call   1090 <assert@plt>
mov    $0xf040,%edi
call   1040 <htons@plt>
mov    %rax,0x28(%rsp)
mov    0x40(%rsp),%rax
mov    0x8(%rax),%rdi
mov    0x4(%rsp),%eax
test   %rdi,%rdi
je     13f5 <main+0x225>
call   10e0 <atoi@plt>
mov    %eax,0x10(%rsp)
mov    0x2bf0(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
mov    0x2bd1(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x20(%rsp)
mov    $0xff,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x28,%edx
call   10d0 <bind@plt>
not    %eax
shr    $0x1f,%eax
mov    %eax,%edi
call   1090 <assert@plt>
lea    0xc0e(%rip),%r13
xor    %eax,%eax
jmp    147c <main+0x2ac>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2b37(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    0x3c(%rsp),%eax
add    $0x1,%eax
cmp    $0xa,%eax
mov    0xc(%rsp),%ebp
je     15de <main+0x40e>
mov    %eax,0x3c(%rsp)
movl   $0x28,0x8(%rsp)
mov    $0xf040,%edi
call   1040 <htons@plt>
mov    %rax,0x28(%rsp)
mov    0x40(%rsp),%rax
mov    0x8(%rax),%rdi
mov    0x4(%rsp),%eax
test   %rdi,%rdi
je     14ae <main+0x2de>
call   10e0 <atoi@plt>
mov    %eax,0x10(%rsp)
mov    0x2b37(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
mov    0x2b18(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x20(%rsp)
mov    0x18(%rsp),%rdi
mov    $0xff,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
mov    0x8(%rsp),%r9d
mov    %ebp,%edi
lea    0x2b96(%rip),%rsi
mov    $0xa,%edx
xor    %ecx,%ecx
lea    0x10(%rsp),%rbx
mov    %rbx,%r8
call   1080 <sendto@plt>
lea    0xb54(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
lea    0x2bc1(%rip),%rsi
mov    $0x2710,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
lea    0x8(%rsp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%r12d
mov    0x2a5e(%rip),%rax
mov    (%rax),%r15d
mov    0x28(%rsp),%rdi
mov    0x30(%rsp),%rbx
call   10c0 <ntohs@plt>
mov    %eax,%r10d
mov    0x10(%rsp),%r11d
mov    0x14(%rsp),%ebp
mov    $0x28,%edx
lea    0xafe(%rip),%rdi
mov    %r14d,%esi
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %rbx,%r9
xor    %eax,%eax
push   %rbp
push   0x28(%rsp)
push   %r11
push   %r10
call   1050 <printf@plt>
add    $0x20,%rsp
cmpl   $0x0,0x14(%rsp)
lea    0xad1(%rip),%r14
lea    0xac0(%rip),%rbp
je     1450 <main+0x280>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
test   %rbx,%rbx
mov    %rbp,%rsi
cmove  %r14,%rsi
mov    0x18(%rsp),%rax
mov    (%rax,%rbx,4),%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
mov    0x14(%rsp),%eax
cmp    %rax,%rbx
jb     15b0 <main+0x3e0>
jmp    1450 <main+0x280>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ifreq = type { i32, i8*, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32, i64 }
%struct.sockaddr_ll = type { i32, i32, i32*, i8*, i8*, i8* }
%struct.sockaddr = type { i32 }
@PF_PACKET = global i8* null
@SOCK_DGRAM = global i32 0
@SIOCGIFNAME = global i32 0
@.str = [36 x i8] c"Index %d: r: %d errno %d name: %10s\00"
@errno = global i32 0
@SIOCGIFFLAGS = global i32 0
@.str.1 = [14 x i8] c" flags 0x%05x\00"
@IFF_UP = global i32 0
@SIOCGIFHWADDR = global i32 0
@.str.2 = [17 x i8] c" addr family %d \00"
@ARPHRD_ETHER = global i32 0
@.str.3 = [13 x i8] c"ethernet %s \00"
@.str.4 = [3 x i8] c"up\00"
@.str.5 = [5 x i8] c"down\00"
@.str.6 = [7 x i8] c"%s%02X\00"
@.str.7 = [2 x i8] c":\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [2 x i8] c"\0A\00"
@main.buf = internal global [10000 x i8] zeroinitializer
@main.req = internal global [10 x i8] c"\00\0A\00\00\0F\05\80\00\00\01"
@PACKET_HOST = global i8* null
@.str.10 = [9 x i8] c"ss %5zd\0A\00"
@.str.11 = [68 x i8] c"sr %5zd, alen %zd %d, errno %d, addr.fam %d proto 0x%x if %d %d %d \00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.ifreq
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca %struct.sockaddr_ll
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i8*, i8** @PF_PACKET
%21 = load i32, i32* @SOCK_DGRAM
%22 = call i8* @htons(i32 61504)
%23 = call i32 @socket(i8* %20, i32 %21, i8* %22)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp sge i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
store i32 -1, i32* %8
store i32 0, i32* %9
br label %28
28: ; preds = %109, %2
%29 = load i32, i32* %9
%30 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 0
store i32 %29, i32* %30
%31 = load i32, i32* %7
%32 = load i32, i32* @SIOCGIFNAME
%33 = call i32 @ioctl(i32 %31, i32 %32, %struct.ifreq* %10)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = icmp sge i32 %34, 0
br i1 %35, label %36, label %108
36: ; preds = %28
%37 = load i32, i32* %9
%38 = load i32, i32* %6
%39 = load i32, i32* @errno
%40 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 1
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %37, i32 %38, i32 %39, i8* %41)
%43 = load i32, i32* %7
%44 = load i32, i32* @SIOCGIFFLAGS
%45 = call i32 @ioctl(i32 %43, i32 %44, %struct.ifreq* %10)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = icmp sge i32 %46, 0
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 2
%51 = load i32, i32* %50
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 2
%54 = load i32, i32* %53
%55 = load i32, i32* @IFF_UP
%56 = and i32 %54, %55
store i32 %56, i32* %11
%57 = load i32, i32* %7
%58 = load i32, i32* @SIOCGIFHWADDR
%59 = call i32 @ioctl(i32 %57, i32 %58, %struct.ifreq* %10)
store i32 %59, i32* %6
%60 = load i32, i32* %6
%61 = icmp sge i32 %60, 0
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
%64 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 3
%65 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %64, i32 0, i32 0
%66 = load i32, i32* %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %66)
%68 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 3
%69 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %68, i32 0, i32 0
%70 = load i32, i32* %69
%71 = load i32, i32* @ARPHRD_ETHER
%72 = icmp eq i32 %70, %71
br i1 %72, label %73, label %106
73: ; preds = %36
%74 = load i32, i32* %11
%75 = icmp ne i32 %74, 0
%76 = zext i1 %75 to i64
%77 = select i1 %75, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %10, i32 0, i32 3
%80 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %79, i32 0, i32 1
%81 = load i64, i64* %80
%82 = inttoptr i64 %81 to i32*
store i32* %82, i32** %12
store i32 0, i32* %13
br label %83
83: ; preds = %97, %73
%84 = load i32, i32* %13
%85 = icmp ult i32 %84, 6
br i1 %85, label %86, label %100
86: ; preds = %83
%87 = load i32, i32* %13
%88 = icmp ne i32 %87, 0
%89 = zext i1 %88 to i64
%90 = select i1 %88, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%91 = load i32*, i32** %12
%92 = load i32, i32* %13
%93 = zext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %91, i64 %93
%95 = load i32, i32* %94
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %90, i32 %95)
br label %97
97: ; preds = %86
%98 = load i32, i32* %13
%99 = add i32 %98, 1
store i32 %99, i32* %13
br label %83
100: ; preds = %83
%101 = load i32, i32* %11
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %100
%104 = load i32, i32* %9
store i32 %104, i32* %8
br label %105
105: ; preds = %103, %100
br label %106
106: ; preds = %105, %36
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
br label %108
108: ; preds = %106, %28
br label %109
109: ; preds = %108
%110 = load i32, i32* %9
%111 = add i32 %110, 1
store i32 %111, i32* %9
%112 = icmp ult i32 %111, 10
br i1 %112, label %28, label %113
113: ; preds = %109
%114 = load i32, i32* %8
%115 = icmp uge i32 %114, 0
%116 = zext i1 %115 to i32
%117 = call i32 @assert(i32 %116)
%118 = call i8* @htons(i32 61504)
%119 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 4
store i8* %118, i8** %119
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 1
%122 = load i8*, i8** %121
%123 = icmp ne i8* %122, null
br i1 %123, label %124, label %129
124: ; preds = %113
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 1
%127 = load i8*, i8** %126
%128 = call i32 @atoi(i8* %127)
br label %131
129: ; preds = %113
%130 = load i32, i32* %8
br label %131
131: ; preds = %129, %124
%132 = phi i32 [ %128, %124 ], [ %130, %129 ]
%133 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 0
store i32 %132, i32* %133
%134 = load i8*, i8** @PF_PACKET
%135 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 5
store i8* %134, i8** %135
%136 = load i8*, i8** @PACKET_HOST
%137 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 3
store i8* %136, i8** %137
%138 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 2
%139 = load i32*, i32** %138
%140 = call i32 @memset(i32* %139, i32 255, i32 8)
%141 = load i32, i32* %7
%142 = bitcast %struct.sockaddr_ll* %14 to %struct.sockaddr*
%143 = call i32 @bind(i32 %141, %struct.sockaddr* %142, i32 40)
store i32 %143, i32* %6
%144 = load i32, i32* %6
%145 = icmp sge i32 %144, 0
%146 = zext i1 %145 to i32
%147 = call i32 @assert(i32 %146)
store i32 0, i32* %15
br label %148
148: ; preds = %223, %131
%149 = load i32, i32* %15
%150 = icmp ult i32 %149, 10
br i1 %150, label %151, label %226
151: ; preds = %148
store i32 40, i32* %16
%152 = call i8* @htons(i32 61504)
%153 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 4
store i8* %152, i8** %153
%154 = load i8**, i8*** %5
%155 = getelementptr inbounds i8*, i8** %154, i64 1
%156 = load i8*, i8** %155
%157 = icmp ne i8* %156, null
br i1 %157, label %158, label %163
158: ; preds = %151
%159 = load i8**, i8*** %5
%160 = getelementptr inbounds i8*, i8** %159, i64 1
%161 = load i8*, i8** %160
%162 = call i32 @atoi(i8* %161)
br label %165
163: ; preds = %151
%164 = load i32, i32* %8
br label %165
165: ; preds = %163, %158
%166 = phi i32 [ %162, %158 ], [ %164, %163 ]
%167 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 0
store i32 %166, i32* %167
%168 = load i8*, i8** @PF_PACKET
%169 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 5
store i8* %168, i8** %169
%170 = load i8*, i8** @PACKET_HOST
%171 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 3
store i8* %170, i8** %171
%172 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 2
%173 = load i32*, i32** %172
%174 = call i32 @memset(i32* %173, i32 255, i32 8)
%175 = load i32, i32* %7
%176 = bitcast %struct.sockaddr_ll* %14 to %struct.sockaddr*
%177 = load i32, i32* %16
%178 = call i32 @sendto(i32 %175, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @main.req, i64 0, i64 0), i32 10, i32 0, %struct.sockaddr* %176, i32 %177)
store i32 %178, i32* %17
%179 = load i32, i32* %17
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %179)
%181 = load i32, i32* %7
%182 = bitcast %struct.sockaddr_ll* %14 to %struct.sockaddr*
%183 = call i32 @recvfrom(i32 %181, i8* getelementptr inbounds ([10000 x i8], [10000 x i8]* @main.buf, i64 0, i64 0), i32 10000, i32 0, %struct.sockaddr* %182, i32* %16)
store i32 %183, i32* %18
%184 = load i32, i32* %18
%185 = load i32, i32* %16
%186 = load i32, i32* @errno
%187 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 5
%188 = load i8*, i8** %187
%189 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 4
%190 = load i8*, i8** %189
%191 = call i32 @ntohs(i8* %190)
%192 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 0
%193 = load i32, i32* %192
%194 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 3
%195 = load i8*, i8** %194
%196 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 1
%197 = load i32, i32* %196
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.11, i64 0, i64 0), i32 %184, i64 40, i32 %185, i32 %186, i8* %188, i32 %191, i32 %193, i8* %195, i32 %197)
store i32 0, i32* %19
br label %199
199: ; preds = %216, %165
%200 = load i32, i32* %19
%201 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 1
%202 = load i32, i32* %201
%203 = icmp ult i32 %200, %202
br i1 %203, label %204, label %219
204: ; preds = %199
%205 = load i32, i32* %19
%206 = icmp ne i32 %205, 0
%207 = zext i1 %206 to i64
%208 = select i1 %206, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0)
%209 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %14, i32 0, i32 2
%210 = load i32*, i32** %209
%211 = load i32, i32* %19
%212 = zext i32 %211 to i64
%213 = getelementptr inbounds i32, i32* %210, i64 %212
%214 = load i32, i32* %213
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %208, i32 %214)
br label %216
216: ; preds = %204
%217 = load i32, i32* %19
%218 = add i32 %217, 1
store i32 %218, i32* %19
br label %199
219: ; preds = %199
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%221 = load i32, i32* @stdout
%222 = call i32 @fflush(i32 %221)
br label %223
223: ; preds = %219
%224 = load i32, i32* %15
%225 = add i32 %224, 1
store i32 %225, i32* %15
br label %148
226: ; preds = %148
ret i32 0
}

LLVM IR (-O2):
%struct.ifreq = type { i32, i8*, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32, i64 }
%struct.sockaddr_ll = type { i32, i32, i32*, i8*, i8*, i8* }
%struct.sockaddr = type { i32 }
@PF_PACKET = global i8* null
@SOCK_DGRAM = global i32 0
@SIOCGIFNAME = global i32 0
@.str = [36 x i8] c"Index %d: r: %d errno %d name: %10s\00"
@errno = global i32 0
@SIOCGIFFLAGS = global i32 0
@.str.1 = [14 x i8] c" flags 0x%05x\00"
@IFF_UP = global i32 0
@SIOCGIFHWADDR = global i32 0
@.str.2 = [17 x i8] c" addr family %d \00"
@ARPHRD_ETHER = global i32 0
@.str.3 = [13 x i8] c"ethernet %s \00"
@.str.4 = [3 x i8] c"up\00"
@.str.5 = [5 x i8] c"down\00"
@.str.6 = [7 x i8] c"%s%02X\00"
@.str.7 = [2 x i8] c":\00"
@.str.8 = [1 x i8] zeroinitializer
@main.buf = internal global [10000 x i8] zeroinitializer
@main.req = internal global [10 x i8] c"\00\0A\00\00\0F\05\80\00\00\01"
@PACKET_HOST = global i8* null
@.str.10 = [9 x i8] c"ss %5zd\0A\00"
@.str.11 = [68 x i8] c"sr %5zd, alen %zd %d, errno %d, addr.fam %d proto 0x%x if %d %d %d \00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.ifreq
%4 = alloca %struct.sockaddr_ll
%5 = alloca i32
%6 = load i8*, i8** @PF_PACKET
%7 = load i32, i32* @SOCK_DGRAM
%8 = tail call i8* @htons(i32 61504)
%9 = tail call i32 @socket(i8* %6, i32 %7, i8* %8)
%10 = xor i32 %9, -1
%11 = lshr i32 %10, 31
%12 = tail call i32 @assert(i32 %11)
%13 = bitcast %struct.ifreq* %3 to i8*
%14 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 0
%15 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 1
%16 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 2
%17 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 3, i32 0
%18 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %3, i64 0, i32 3, i32 1
br label %19
19: ; preds = %76, %2
%20 = phi i32 [ 0, %2 ], [ %78, %76 ]
%21 = phi i32 [ -1, %2 ], [ %77, %76 ]
store i32 %20, i32* %14
%22 = load i32, i32* @SIOCGIFNAME
%23 = call i32 @ioctl(i32 %9, i32 %22, %struct.ifreq* %3)
%24 = icmp sgt i32 %23, -1
br i1 %24, label %25, label %76
25: ; preds = %19
%26 = load i32, i32* @errno
%27 = load i8*, i8** %15
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %23, i32 %26, i8* %27)
%29 = load i32, i32* @SIOCGIFFLAGS
%30 = call i32 @ioctl(i32 %9, i32 %29, %struct.ifreq* %3)
%31 = xor i32 %30, -1
%32 = lshr i32 %31, 31
%33 = call i32 @assert(i32 %32)
%34 = load i32, i32* %16
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %16
%37 = load i32, i32* @IFF_UP
%38 = load i32, i32* @SIOCGIFHWADDR
%39 = call i32 @ioctl(i32 %9, i32 %38, %struct.ifreq* %3)
%40 = xor i32 %39, -1
%41 = lshr i32 %40, 31
%42 = call i32 @assert(i32 %41)
%43 = load i32, i32* %17
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %17
%46 = load i32, i32* @ARPHRD_ETHER
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %73
48: ; preds = %25
%49 = and i32 %37, %36
%50 = icmp eq i32 %49, 0
%51 = select i1 %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = load i64, i64* %18
%54 = inttoptr i64 %53 to i32*
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds i32, i32* %54, i64 1
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %58)
%60 = getelementptr inbounds i32, i32* %54, i64 2
%61 = load i32, i32* %60
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %61)
%63 = getelementptr inbounds i32, i32* %54, i64 3
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %64)
%66 = getelementptr inbounds i32, i32* %54, i64 4
%67 = load i32, i32* %66
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds i32, i32* %54, i64 5
%70 = load i32, i32* %69
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %70)
%72 = select i1 %50, i32 %21, i32 %20
br label %73
73: ; preds = %48, %25
%74 = phi i32 [ %72, %48 ], [ %21, %25 ]
%75 = call i32 @putchar(i32 10)
br label %76
76: ; preds = %19, %73
%77 = phi i32 [ %74, %73 ], [ %21, %19 ]
%78 = add nuw nsw i32 %20, 1
%79 = icmp eq i32 %78, 10
br i1 %79, label %80, label %19
80: ; preds = %76
%81 = call i32 @assert(i32 1)
%82 = bitcast %struct.sockaddr_ll* %4 to i8*
%83 = call i8* @htons(i32 61504)
%84 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 4
store i8* %83, i8** %84
%85 = getelementptr inbounds i8*, i8** %1, i64 1
%86 = load i8*, i8** %85
%87 = icmp eq i8* %86, null
br i1 %87, label %90, label %88
88: ; preds = %80
%89 = call i32 @atoi(i8* %86)
br label %90
90: ; preds = %80, %88
%91 = phi i32 [ %89, %88 ], [ %77, %80 ]
%92 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 0
store i32 %91, i32* %92
%93 = load i8*, i8** @PF_PACKET
%94 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 5
store i8* %93, i8** %94
%95 = load i8*, i8** @PACKET_HOST
%96 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 3
store i8* %95, i8** %96
%97 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 2
%98 = call i32 @memset(i32* undef, i32 255, i32 8)
%99 = bitcast %struct.sockaddr_ll* %4 to %struct.sockaddr*
%100 = call i32 @bind(i32 %9, %struct.sockaddr* %99, i32 40)
%101 = xor i32 %100, -1
%102 = lshr i32 %101, 31
%103 = call i32 @assert(i32 %102)
%104 = bitcast i32* %5 to i8*
%105 = getelementptr inbounds %struct.sockaddr_ll, %struct.sockaddr_ll* %4, i64 0, i32 1
br label %107
106: ; preds = %135
ret i32 0
107: ; preds = %90, %135
%108 = phi i32 [ 0, %90 ], [ %139, %135 ]
store i32 40, i32* %5
%109 = call i8* @htons(i32 61504)
store i8* %109, i8** %84
%110 = load i8*, i8** %85
%111 = icmp eq i8* %110, null
br i1 %111, label %114, label %112
112: ; preds = %107
%113 = call i32 @atoi(i8* %110)
br label %114
114: ; preds = %107, %112
%115 = phi i32 [ %113, %112 ], [ %77, %107 ]
store i32 %115, i32* %92
%116 = load i8*, i8** @PF_PACKET
store i8* %116, i8** %94
%117 = load i8*, i8** @PACKET_HOST
store i8* %117, i8** %96
%118 = load i32*, i32** %97
%119 = call i32 @memset(i32* %118, i32 255, i32 8)
%120 = load i32, i32* %5
%121 = call i32 @sendto(i32 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @main.req, i64 0, i64 0), i32 10, i32 0, %struct.sockaddr* %99, i32 %120)
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %121)
%123 = call i32 @recvfrom(i32 %9, i8* getelementptr inbounds ([10000 x i8], [10000 x i8]* @main.buf, i64 0, i64 0), i32 10000, i32 0, %struct.sockaddr* %99, i32* %5)
%124 = load i32, i32* %5
%125 = load i32, i32* @errno
%126 = load i8*, i8** %94
%127 = load i8*, i8** %84
%128 = call i32 @ntohs(i8* %127)
%129 = load i32, i32* %92
%130 = load i8*, i8** %96
%131 = load i32, i32* %105
%132 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.11, i64 0, i64 0), i32 %123, i64 40, i32 %124, i32 %125, i8* %126, i32 %128, i32 %129, i8* %130, i32 %131)
%133 = load i32, i32* %105
%134 = icmp eq i32 %133, 0
br i1 %134, label %135, label %141
135: ; preds = %141, %114
%136 = call i32 @putchar(i32 10)
%137 = load i32, i32* @stdout
%138 = call i32 @fflush(i32 %137)
%139 = add nuw nsw i32 %108, 1
%140 = icmp eq i32 %139, 10
br i1 %140, label %106, label %107
141: ; preds = %114, %141
%142 = phi i64 [ %149, %141 ], [ 0, %114 ]
%143 = icmp eq i64 %142, 0
%144 = select i1 %143, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0)
%145 = load i32*, i32** %97
%146 = getelementptr inbounds i32, i32* %145, i64 %142
%147 = load i32, i32* %146
%148 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %144, i32 %147)
%149 = add nuw nsw i64 %142, 1
%150 = load i32, i32* %105
%151 = zext i32 %150 to i64
%152 = icmp ult i64 %149, %151
br i1 %152, label %141, label %135
}