#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_3__ TYPE_1__;

/* Type definitions */
typedef int uint8_t;
struct udphdr {
  int /*<<< orphan*/ len;
};
struct sockaddr_storage {
  int dummy;
};
struct TYPE_3__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
};
struct iphdr {
  int /*<<< orphan*/ saddr;
};
struct ifreq {
  int /*<<< orphan*/ ifr_addr;
  int /*<<< orphan*/ ifr_name;
  int /*<<< orphan*/ ifr_flags;
};
struct ether_header {
  int *ether_dhost;
};
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ IFF_PROMISC;
int IFNAMSIZ;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ PF_PACKET;
int /*<<< orphan*/ SIOCGIFADDR;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SIOCSIFFLAGS;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_BINDTODEVICE;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, TYPE_1__ *, char *, int);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ memset(struct ifreq *, int /*<<< orphan*/, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, int *, int, int /*<<< orphan*/, int /*<<< orphan*/ *,
             int /*<<< orphan*/ *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char *, int);
int main(int argc, char *argv[]) {
  char sender[INET6_ADDRSTRLEN];
  int sockfd, ret, i;
  int sockopt;
  ssize_t numbytes;
  struct ifreq ifopts;
  struct ifreq if_ip;
  struct sockaddr_storage their_addr;
  uint8_t buf[1024];
  char ifName[IFNAMSIZ];
  if (argc > 1)
    strcpy(ifName, argv[1]);
  else
    strcpy(ifName, "eth0");
  struct ether_header *eh = (struct ether_header *)buf;
  struct iphdr *iph = (struct iphdr *)(buf + sizeof(struct ether_header));
  struct udphdr *udph = (struct udphdr *)(buf + sizeof(struct iphdr) +
                                          sizeof(struct ether_header));
  memset(&if_ip, 0, sizeof(struct ifreq));
  if ((sockfd = socket(PF_PACKET, SOCK_RAW, htons(0x0800))) == -1) {
    perror("listener: socket");
    return -1;
  }
  strncpy(ifopts.ifr_name, ifName, IFNAMSIZ - 1);
  ioctl(sockfd, SIOCGIFFLAGS, &ifopts);
  ifopts.ifr_flags |= IFF_PROMISC;
  ioctl(sockfd, SIOCSIFFLAGS, &ifopts);
  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof sockopt) ==
      -1) {
    perror("setsockopt");
    close(sockfd);
    exit(EXIT_FAILURE);
  }
  if (setsockopt(sockfd, SOL_SOCKET, SO_BINDTODEVICE, ifName, IFNAMSIZ - 1) ==
      -1) {
    perror("SO_BINDTODEVICE");
    close(sockfd);
    exit(EXIT_FAILURE);
  }
repeat:
  printf("listener: Waiting to recvfrom...\n");
  numbytes = recvfrom(sockfd, buf, 1024, 0, NULL, NULL);
  printf("listener: got packet %lu bytes\n", numbytes);
  if (eh->ether_dhost[0] == 0x00 && eh->ether_dhost[1] == 0x13 &&
      eh->ether_dhost[2] == 0x20 && eh->ether_dhost[3] == 0xfd &&
      eh->ether_dhost[4] == 0xf5 && eh->ether_dhost[5] == 0x30) {
    printf("Correct destination MAC address\n");
  } else {
    printf("Wrong destination MAC: %x:%x:%x:%x:%x:%x\n", eh->ether_dhost[0],
           eh->ether_dhost[1], eh->ether_dhost[2], eh->ether_dhost[3],
           eh->ether_dhost[4], eh->ether_dhost[5]);
    ret = -1;
    goto done;
  }
  ((struct sockaddr_in *)&their_addr)->sin_addr.s_addr = iph->saddr;
  inet_ntop(AF_INET, &((struct sockaddr_in *)&their_addr)->sin_addr, sender,
            sizeof sender);
  strncpy(if_ip.ifr_name, ifName, IFNAMSIZ - 1);
  if (ioctl(sockfd, SIOCGIFADDR, &if_ip) >= 0) {
    printf("Source IP: %s\n My IP: %s\n", sender,
           inet_ntoa(((struct sockaddr_in *)&if_ip.ifr_addr)->sin_addr));
    if (strcmp(sender,
               inet_ntoa(((struct sockaddr_in *)&if_ip.ifr_addr)->sin_addr)) ==
        0) {
      printf("but I sent it :(\n");
      ret = -1;
      goto done;
    }
  }
  ret = ntohs(udph->len) - sizeof(struct udphdr);
  printf("\tData:");
  for (i = 0; i < numbytes; i++)
    printf("%02x:", buf[i]);
  printf("\n");
done:
  goto repeat;
  close(sockfd);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x1098(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1090(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    0x2d4a(%rip),%rax
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1088(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x1068(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    129d <main+0x9d>
mov    -0x1088(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1050 <strcpy@plt>
jmp    12b0 <main+0xb0>
mov    -0x1088(%rbp),%rdi
lea    0xd55(%rip),%rsi
call   1050 <strcpy@plt>
lea    -0x1060(%rbp),%rax
mov    %rax,-0x1070(%rbp)
lea    -0x1060(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x1078(%rbp)
lea    -0x1060(%rbp),%rax
add    $0x10,%rax
add    $0x20,%rax
mov    %rax,-0x1080(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10a0(%rbp)
mov    0x2cac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x109c(%rbp)
mov    $0x800,%edi
call   1080 <htons@plt>
mov    -0x10a0(%rbp),%edi
mov    -0x109c(%rbp),%esi
mov    %eax,%edx
call   1120 <socket@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
jne    135f <main+0x15f>
lea    0xcc1(%rip),%rdi
call   1100 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret
mov    -0x1088(%rbp),%rsi
mov    -0x3c(%rbp),%edi
mov    0x2c30(%rip),%rax
mov    (%rax),%edx
sub    $0x1,%edx
call   1040 <strncpy@plt>
mov    -0x24(%rbp),%edi
mov    0x2c2c(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   10b0 <ioctl@plt>
mov    0x2bfa(%rip),%rax
mov    (%rax),%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2c50(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   10b0 <ioctl@plt>
mov    -0x24(%rbp),%edi
mov    0x2c1b(%rip),%rax
mov    (%rax),%esi
mov    0x2bc2(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%rcx
mov    $0x4,%r8d
mov    $0x0,%al
call   1060 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1404 <main+0x204>
lea    0xc2d(%rip),%rdi
call   1100 <perror@plt>
mov    -0x24(%rbp),%edi
call   10c0 <close@plt>
mov    0x2b9b(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x1088(%rbp),%rcx
mov    -0x24(%rbp),%edi
mov    0x2bc3(%rip),%rax
mov    (%rax),%esi
mov    0x2b62(%rip),%rax
mov    (%rax),%edx
mov    0x2b79(%rip),%rax
mov    (%rax),%r8d
sub    $0x1,%r8d
mov    $0x0,%al
call   1060 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1460 <main+0x260>
lea    0xbdc(%rip),%rdi
call   1100 <perror@plt>
mov    -0x24(%rbp),%edi
call   10c0 <close@plt>
mov    0x2b3f(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
jmp    1465 <main+0x265>
lea    0xbc5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x24(%rbp),%edi
lea    -0x1060(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   10e0 <recvfrom@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    0xbb5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
cmpl   $0x0,(%rax)
jne    1535 <main+0x335>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
cmpl   $0x13,0x4(%rax)
jne    1535 <main+0x335>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
cmpl   $0x20,0x8(%rax)
jne    1535 <main+0x335>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
cmpl   $0xfd,0xc(%rax)
jne    1535 <main+0x335>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
cmpl   $0xf5,0x10(%rax)
jne    1535 <main+0x335>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
cmpl   $0x30,0x14(%rax)
jne    1535 <main+0x335>
lea    0xb4a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    15a9 <main+0x3a9>
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
mov    0x4(%rax),%edx
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%ecx
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
mov    0xc(%rax),%r8d
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
mov    0x10(%rax),%r9d
mov    -0x1070(%rbp),%rax
mov    (%rax),%rax
mov    0x14(%rax),%eax
lea    0xb09(%rip),%rdi
sub    $0x10,%rsp
mov    %eax,(%rsp)
mov    $0x0,%al
call   1090 <printf@plt>
add    $0x10,%rsp
movl   $0xffffffff,-0x28(%rbp)
jmp    16de <main+0x4de>
mov    -0x1090(%rbp),%rdx
mov    -0x1098(%rbp),%rax
mov    -0x1078(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,-0x58(%rbp)
mov    0x29f6(%rip),%rcx
mov    (%rcx),%edi
lea    -0x58(%rbp),%rsi
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x1088(%rbp),%rsi
mov    -0x4c(%rbp),%edi
mov    0x29b8(%rip),%rax
mov    (%rax),%edx
sub    $0x1,%edx
call   1040 <strncpy@plt>
mov    -0x24(%rbp),%edi
mov    0x29d4(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   10b0 <ioctl@plt>
cmp    $0x0,%rax
jl     1671 <main+0x471>
mov    -0x50(%rbp),%edi
call   1070 <inet_ntoa@plt>
mov    -0x1090(%rbp),%rsi
mov    %rax,%rdx
lea    0xa94(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x50(%rbp),%edi
call   1070 <inet_ntoa@plt>
mov    -0x1090(%rbp),%rdi
mov    %rax,%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    166c <main+0x46c>
lea    0xa7f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0xffffffff,-0x28(%rbp)
jmp    16de <main+0x4de>
jmp    1671 <main+0x471>
mov    -0x1080(%rbp),%rax
mov    (%rax),%edi
call   10f0 <ntohs@plt>
cltq
sub    $0x4,%rax
mov    %eax,-0x28(%rbp)
lea    0xa5b(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    16d0 <main+0x4d0>
movslq -0x2c(%rbp),%rax
mov    -0x1060(%rbp,%rax,4),%esi
lea    0xa36(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    169d <main+0x49d>
lea    0xa11(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1465 <main+0x265>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1048,%rsp
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
mov    %rax,-0x58(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2d47(%rip),%r12
mov    (%r12),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmp    $0x2,%edi
jl     1279 <main+0x59>
mov    0x8(%rsi),%rsi
jmp    1280 <main+0x60>
lea    0xd80(%rip),%rsi
mov    %r13,%rdi
call   1060 <strcpy@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10c0 <memset@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%r14d
mov    0x2d0f(%rip),%rax
mov    (%rax),%ebx
mov    $0x800,%edi
call   10a0 <htons@plt>
mov    %r14d,%edi
mov    %ebx,%esi
mov    %eax,%edx
call   1140 <socket@plt>
cmp    $0xffffffff,%eax
je     1531 <main+0x311>
mov    %eax,%r14d
mov    (%r12),%edx
add    $0xffffffff,%edx
mov    %r13,%rsi
call   1050 <strncpy@plt>
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
lea    -0x68(%rbp),%rbx
mov    %r14d,%edi
mov    %rbx,%rdx
call   10d0 <ioctl@plt>
mov    0x2c95(%rip),%rax
mov    (%rax),%eax
or     %eax,-0x60(%rbp)
mov    0x2cf1(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
mov    %rbx,%rdx
call   10d0 <ioctl@plt>
mov    0x2cbd(%rip),%rbx
mov    (%rbx),%esi
mov    0x2c64(%rip),%rax
mov    (%rax),%edx
lea    -0x5c(%rbp),%rcx
mov    $0x4,%r8d
mov    %r14d,%edi
xor    %eax,%eax
call   1080 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     1551 <main+0x331>
mov    %r15,-0x50(%rbp)
mov    (%rbx),%esi
mov    0x2c30(%rip),%rax
mov    (%rax),%edx
mov    (%r12),%r8d
add    $0xffffffff,%r8d
mov    %r14d,%edi
mov    %r13,-0x48(%rbp)
mov    %r13,%rcx
xor    %eax,%eax
call   1080 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     155a <main+0x33a>
lea    0xcb6(%rip),%r15
lea    0xccf(%rip),%r12
jmp    13b1 <main+0x191>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%ebx
sub    $0x8,%rsp
mov    %r12,%rdi
xor    %eax,%eax
push   %rbx
call   10b0 <printf@plt>
add    $0x10,%rsp
lea    0xcea(%rip),%rdi
call   1070 <puts@plt>
mov    %r14d,%edi
lea    -0x1070(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1100 <recvfrom@plt>
mov    %eax,%r13d
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    -0x1070(%rbp),%rax
mov    (%rax),%esi
mov    0x4(%rax),%edx
test   %esi,%esi
jne    1390 <main+0x170>
cmp    $0x13,%edx
jne    1390 <main+0x170>
mov    $0x13,%edx
cmpl   $0x20,0x8(%rax)
jne    1390 <main+0x170>
cmpl   $0xfd,0xc(%rax)
jne    1390 <main+0x170>
cmpl   $0xf5,0x10(%rax)
jne    1390 <main+0x170>
cmpl   $0x30,0x14(%rax)
jne    1390 <main+0x170>
lea    0xc90(%rip),%rdi
call   1070 <puts@plt>
mov    -0x1050(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2b78(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    -0x50(%rbp),%rbx
mov    %rbx,%rdx
mov    -0x58(%rbp),%rcx
call   1030 <inet_ntop@plt>
mov    -0x3c(%rbp),%edi
mov    0x2b38(%rip),%rax
mov    (%rax),%edx
add    $0xffffffff,%edx
mov    -0x48(%rbp),%rsi
call   1050 <strncpy@plt>
mov    0x2b53(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
lea    -0x40(%rbp),%rdx
call   10d0 <ioctl@plt>
test   %rax,%rax
js     14c4 <main+0x2a4>
mov    -0x40(%rbp),%edi
call   1090 <inet_ntoa@plt>
lea    0xbdc(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   10b0 <printf@plt>
mov    -0x40(%rbp),%edi
call   1090 <inet_ntoa@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1520 <main+0x300>
mov    -0x1040(%rbp),%edi
call   1110 <ntohs@plt>
lea    0xbbf(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
test   %r13d,%r13d
lea    0xbb5(%rip),%r15
jle    150a <main+0x2ea>
mov    %r13d,%r13d
xor    %ebx,%ebx
xchg   %ax,%ax
mov    -0x1070(%rbp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    14f0 <main+0x2d0>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xb16(%rip),%r15
jmp    13b1 <main+0x191>
lea    0xbbc(%rip),%rdi
call   1070 <puts@plt>
jmp    13b1 <main+0x191>
lea    0xacd(%rip),%rdi
call   1120 <perror@plt>
mov    $0xffffffff,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xabe(%rip),%rdi
jmp    1561 <main+0x341>
lea    0xac0(%rip),%rdi
call   1120 <perror@plt>
mov    %r14d,%edi
call   10e0 <close@plt>
mov    0x2a23(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.ifreq = type { i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.ether_header = type { i32* }
%struct.iphdr = type { i32 }
%struct.udphdr = type { i32 }
%struct.sockaddr_in = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@IFNAMSIZ = global i32 0
@.str = [5 x i8] c"eth0\00"
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@.str.1 = [17 x i8] c"listener: socket\00"
@SIOCGIFFLAGS = global i32 0
@IFF_PROMISC = global i32 0
@SIOCSIFFLAGS = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@EXIT_FAILURE = global i32 0
@SO_BINDTODEVICE = global i32 0
@.str.3 = [16 x i8] c"SO_BINDTODEVICE\00"
@.str.4 = [34 x i8] c"listener: Waiting to recvfrom...\0A\00"
@.str.5 = [32 x i8] c"listener: got packet %lu bytes\0A\00"
@.str.6 = [33 x i8] c"Correct destination MAC address\0A\00"
@.str.7 = [42 x i8] c"Wrong destination MAC: %x:%x:%x:%x:%x:%x\0A\00"
@AF_INET = global i32 0
@SIOCGIFADDR = global i32 0
@.str.8 = [26 x i8] c"Source IP: %s\0A My IP: %s\0A\00"
@.str.9 = [18 x i8] c"but I sent it :(\0A\00"
@.str.10 = [7 x i8] c"\09Data:\00"
@.str.11 = [6 x i8] c"%02x:\00"
@.str.12 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.ifreq
%14 = alloca %struct.ifreq
%15 = alloca %struct.sockaddr_storage
%16 = alloca [1024 x i32]
%17 = alloca i64
%18 = alloca %struct.ether_header*
%19 = alloca %struct.iphdr*
%20 = alloca %struct.udphdr*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%21 = load i32, i32* @INET6_ADDRSTRLEN
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %6
%24 = alloca i8, i64 %22
store i64 %22, i64* %7
%25 = load i32, i32* @IFNAMSIZ
%26 = zext i32 %25 to i64
%27 = alloca i8, i64 %26
store i64 %26, i64* %17
%28 = load i32, i32* %4
%29 = icmp sgt i32 %28, 1
br i1 %29, label %30, label %35
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @strcpy(i8* %27, i8* %33)
br label %37
35: ; preds = %2
%36 = call i32 @strcpy(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %37
37: ; preds = %35, %30
%38 = getelementptr inbounds [1024 x i32], [1024 x i32]* %16, i64 0, i64 0
%39 = bitcast i32* %38 to %struct.ether_header*
store %struct.ether_header* %39, %struct.ether_header** %18
%40 = getelementptr inbounds [1024 x i32], [1024 x i32]* %16, i64 0, i64 0
%41 = getelementptr inbounds i32, i32* %40, i64 8
%42 = bitcast i32* %41 to %struct.iphdr*
store %struct.iphdr* %42, %struct.iphdr** %19
%43 = getelementptr inbounds [1024 x i32], [1024 x i32]* %16, i64 0, i64 0
%44 = getelementptr inbounds i32, i32* %43, i64 4
%45 = getelementptr inbounds i32, i32* %44, i64 8
%46 = bitcast i32* %45 to %struct.udphdr*
store %struct.udphdr* %46, %struct.udphdr** %20
%47 = call i32 @memset(%struct.ifreq* %14, i32 0, i32 12)
%48 = load i32, i32* @PF_PACKET
%49 = load i32, i32* @SOCK_RAW
%50 = call i32 @htons(i32 2048)
%51 = call i32 @socket(i32 %48, i32 %49, i32 %50)
store i32 %51, i32* %8
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %57
53: ; preds = %37
%54 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
%55 = load i8*, i8** %6
%56 = load i32, i32* %3
ret i32 %56
57: ; preds = %37
%58 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %13, i32 0, i32 1
%59 = load i32, i32* %58
%60 = load i32, i32* @IFNAMSIZ
%61 = sub nsw i32 %60, 1
%62 = call i32 @strncpy(i32 %59, i8* %27, i32 %61)
%63 = load i32, i32* %8
%64 = load i32, i32* @SIOCGIFFLAGS
%65 = call i64 @ioctl(i32 %63, i32 %64, %struct.ifreq* %13)
%66 = load i32, i32* @IFF_PROMISC
%67 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %13, i32 0, i32 2
%68 = load i32, i32* %67
%69 = or i32 %68, %66
store i32 %69, i32* %67
%70 = load i32, i32* %8
%71 = load i32, i32* @SIOCSIFFLAGS
%72 = call i64 @ioctl(i32 %70, i32 %71, %struct.ifreq* %13)
%73 = load i32, i32* %8
%74 = load i32, i32* @SOL_SOCKET
%75 = load i32, i32* @SO_REUSEADDR
%76 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %73, i32 %74, i32 %75, i32* %11, i64 4)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %84
78: ; preds = %57
%79 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%80 = load i32, i32* %8
%81 = call i32 @close(i32 %80)
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %57
%85 = load i32, i32* %8
%86 = load i32, i32* @SOL_SOCKET
%87 = load i32, i32* @SO_BINDTODEVICE
%88 = load i32, i32* @IFNAMSIZ
%89 = sub nsw i32 %88, 1
%90 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %85, i32 %86, i32 %87, i8* %27, i32 %89)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %98
92: ; preds = %84
%93 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%94 = load i32, i32* %8
%95 = call i32 @close(i32 %94)
%96 = load i32, i32* @EXIT_FAILURE
%97 = call i32 @exit(i32 %96)
unreachable
98: ; preds = %84
br label %99
99: ; preds = %245, %98
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%101 = load i32, i32* %8
%102 = getelementptr inbounds [1024 x i32], [1024 x i32]* %16, i64 0, i64 0
%103 = call i32 @recvfrom(i32 %101, i32* %102, i32 1024, i32 0, i32* null, i32* null)
store i32 %103, i32* %12
%104 = load i32, i32* %12
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %104)
%106 = load %struct.ether_header*, %struct.ether_header** %18
%107 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %106, i32 0, i32 0
%108 = load i32*, i32** %107
%109 = getelementptr inbounds i32, i32* %108, i64 0
%110 = load i32, i32* %109
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %149
112: ; preds = %99
%113 = load %struct.ether_header*, %struct.ether_header** %18
%114 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %113, i32 0, i32 0
%115 = load i32*, i32** %114
%116 = getelementptr inbounds i32, i32* %115, i64 1
%117 = load i32, i32* %116
%118 = icmp eq i32 %117, 19
br i1 %118, label %119, label %149
119: ; preds = %112
%120 = load %struct.ether_header*, %struct.ether_header** %18
%121 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %120, i32 0, i32 0
%122 = load i32*, i32** %121
%123 = getelementptr inbounds i32, i32* %122, i64 2
%124 = load i32, i32* %123
%125 = icmp eq i32 %124, 32
br i1 %125, label %126, label %149
126: ; preds = %119
%127 = load %struct.ether_header*, %struct.ether_header** %18
%128 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %127, i32 0, i32 0
%129 = load i32*, i32** %128
%130 = getelementptr inbounds i32, i32* %129, i64 3
%131 = load i32, i32* %130
%132 = icmp eq i32 %131, 253
br i1 %132, label %133, label %149
133: ; preds = %126
%134 = load %struct.ether_header*, %struct.ether_header** %18
%135 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %134, i32 0, i32 0
%136 = load i32*, i32** %135
%137 = getelementptr inbounds i32, i32* %136, i64 4
%138 = load i32, i32* %137
%139 = icmp eq i32 %138, 245
br i1 %139, label %140, label %149
140: ; preds = %133
%141 = load %struct.ether_header*, %struct.ether_header** %18
%142 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %141, i32 0, i32 0
%143 = load i32*, i32** %142
%144 = getelementptr inbounds i32, i32* %143, i64 5
%145 = load i32, i32* %144
%146 = icmp eq i32 %145, 48
br i1 %146, label %147, label %149
147: ; preds = %140
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %181
149: ; preds = %140, %133, %126, %119, %112, %99
%150 = load %struct.ether_header*, %struct.ether_header** %18
%151 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %150, i32 0, i32 0
%152 = load i32*, i32** %151
%153 = getelementptr inbounds i32, i32* %152, i64 0
%154 = load i32, i32* %153
%155 = load %struct.ether_header*, %struct.ether_header** %18
%156 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %155, i32 0, i32 0
%157 = load i32*, i32** %156
%158 = getelementptr inbounds i32, i32* %157, i64 1
%159 = load i32, i32* %158
%160 = load %struct.ether_header*, %struct.ether_header** %18
%161 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %160, i32 0, i32 0
%162 = load i32*, i32** %161
%163 = getelementptr inbounds i32, i32* %162, i64 2
%164 = load i32, i32* %163
%165 = load %struct.ether_header*, %struct.ether_header** %18
%166 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %165, i32 0, i32 0
%167 = load i32*, i32** %166
%168 = getelementptr inbounds i32, i32* %167, i64 3
%169 = load i32, i32* %168
%170 = load %struct.ether_header*, %struct.ether_header** %18
%171 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %170, i32 0, i32 0
%172 = load i32*, i32** %171
%173 = getelementptr inbounds i32, i32* %172, i64 4
%174 = load i32, i32* %173
%175 = load %struct.ether_header*, %struct.ether_header** %18
%176 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %175, i32 0, i32 0
%177 = load i32*, i32** %176
%178 = getelementptr inbounds i32, i32* %177, i64 5
%179 = load i32, i32* %178
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %154, i32 %159, i32 %164, i32 %169, i32 %174, i32 %179)
store i32 -1, i32* %9
br label %245
181: ; preds = %147
%182 = load %struct.iphdr*, %struct.iphdr** %19
%183 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %182, i32 0, i32 0
%184 = load i32, i32* %183
%185 = bitcast %struct.sockaddr_storage* %15 to %struct.sockaddr_in*
%186 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %185, i32 0, i32 0
%187 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %186, i32 0, i32 0
store i32 %184, i32* %187
%188 = load i32, i32* @AF_INET
%189 = bitcast %struct.sockaddr_storage* %15 to %struct.sockaddr_in*
%190 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %189, i32 0, i32 0
%191 = trunc i64 %22 to i32
%192 = call i32 @inet_ntop(i32 %188, %struct.TYPE_3__* %190, i8* %24, i32 %191)
%193 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 1
%194 = load i32, i32* %193
%195 = load i32, i32* @IFNAMSIZ
%196 = sub nsw i32 %195, 1
%197 = call i32 @strncpy(i32 %194, i8* %27, i32 %196)
%198 = load i32, i32* %8
%199 = load i32, i32* @SIOCGIFADDR
%200 = call i64 @ioctl(i32 %198, i32 %199, %struct.ifreq* %14)
%201 = icmp sge i64 %200, 0
br i1 %201, label %202, label %221
202: ; preds = %181
%203 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%204 = bitcast i32* %203 to %struct.sockaddr_in*
%205 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %204, i32 0, i32 0
%206 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %205, i32 0, i32 0
%207 = load i32, i32* %206
%208 = call i8* @inet_ntoa(i32 %207)
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %24, i8* %208)
%210 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %14, i32 0, i32 0
%211 = bitcast i32* %210 to %struct.sockaddr_in*
%212 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %211, i32 0, i32 0
%213 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %212, i32 0, i32 0
%214 = load i32, i32* %213
%215 = call i8* @inet_ntoa(i32 %214)
%216 = call i64 @strcmp(i8* %24, i8* %215)
%217 = icmp eq i64 %216, 0
br i1 %217, label %218, label %220
218: ; preds = %202
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
store i32 -1, i32* %9
br label %245
220: ; preds = %202
br label %221
221: ; preds = %220, %181
%222 = load %struct.udphdr*, %struct.udphdr** %20
%223 = getelementptr inbounds %struct.udphdr, %struct.udphdr* %222, i32 0, i32 0
%224 = load i32, i32* %223
%225 = call i32 @ntohs(i32 %224)
%226 = sext i32 %225 to i64
%227 = sub i64 %226, 4
%228 = trunc i64 %227 to i32
store i32 %228, i32* %9
%229 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %10
br label %230
230: ; preds = %240, %221
%231 = load i32, i32* %10
%232 = load i32, i32* %12
%233 = icmp slt i32 %231, %232
br i1 %233, label %234, label %243
234: ; preds = %230
%235 = load i32, i32* %10
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds [1024 x i32], [1024 x i32]* %16, i64 0, i64 %236
%238 = load i32, i32* %237
%239 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %238)
br label %240
240: ; preds = %234
%241 = load i32, i32* %10
%242 = add nsw i32 %241, 1
store i32 %242, i32* %10
br label %230
243: ; preds = %230
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
br label %245
245: ; preds = %243, %218, %149
br label %99
}

LLVM IR (-O2):
%struct.ifreq = type { i32, i32, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.TYPE_3__ = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@IFNAMSIZ = global i32 0
@.str = [5 x i8] c"eth0\00"
@PF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@.str.1 = [17 x i8] c"listener: socket\00"
@SIOCGIFFLAGS = global i32 0
@IFF_PROMISC = global i32 0
@SIOCSIFFLAGS = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@EXIT_FAILURE = global i32 0
@SO_BINDTODEVICE = global i32 0
@.str.3 = [16 x i8] c"SO_BINDTODEVICE\00"
@.str.5 = [32 x i8] c"listener: got packet %lu bytes\0A\00"
@.str.7 = [42 x i8] c"Wrong destination MAC: %x:%x:%x:%x:%x:%x\0A\00"
@AF_INET = global i32 0
@SIOCGIFADDR = global i32 0
@.str.8 = [26 x i8] c"Source IP: %s\0A My IP: %s\0A\00"
@.str.10 = [7 x i8] c"\09Data:\00"
@.str.11 = [6 x i8] c"%02x:\00"
@str = [33 x i8] c"listener: Waiting to recvfrom...\00"
@str.13 = [32 x i8] c"Correct destination MAC address\00"
@str.14 = [17 x i8] c"but I sent it :(\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.ifreq
%5 = alloca %struct.ifreq
%6 = alloca %struct.sockaddr_storage
%7 = alloca [1024 x i32]
%8 = load i32, i32* @INET6_ADDRSTRLEN
%9 = zext i32 %8 to i64
%10 = alloca i8, i64 %9
%11 = bitcast i32* %3 to i8*
%12 = bitcast %struct.ifreq* %4 to i8*
%13 = bitcast %struct.ifreq* %5 to i8*
%14 = bitcast %struct.sockaddr_storage* %6 to i8*
%15 = bitcast [1024 x i32]* %7 to i8*
%16 = load i32, i32* @IFNAMSIZ
%17 = zext i32 %16 to i64
%18 = alloca i8, i64 %17
%19 = icmp sgt i32 %0, 1
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
br label %23
23: ; preds = %2, %20
%24 = phi i8* [ %22, %20 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ]
%25 = call i32 @strcpy(i8* %18, i8* %24)
%26 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 0
%27 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 8
%28 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 12
%29 = call i32 @memset(%struct.ifreq* %5, i32 0, i32 12)
%30 = load i32, i32* @PF_PACKET
%31 = load i32, i32* @SOCK_RAW
%32 = call i32 @htons(i32 2048)
%33 = call i32 @socket(i32 %30, i32 %31, i32 %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %37
35: ; preds = %23
%36 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i32 -1
37: ; preds = %23
%38 = load i32, i32* @IFNAMSIZ
%39 = add nsw i32 %38, -1
%40 = call i32 @strncpy(i32 undef, i8* %18, i32 %39)
%41 = load i32, i32* @SIOCGIFFLAGS
%42 = call i64 @ioctl(i32 %33, i32 %41, %struct.ifreq* %4)
%43 = load i32, i32* @IFF_PROMISC
%44 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %4, i64 0, i32 2
%45 = load i32, i32* %44
%46 = or i32 %45, %43
store i32 %46, i32* %44
%47 = load i32, i32* @SIOCSIFFLAGS
%48 = call i64 @ioctl(i32 %33, i32 %47, %struct.ifreq* %4)
%49 = load i32, i32* @SOL_SOCKET
%50 = load i32, i32* @SO_REUSEADDR
%51 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %33, i32 %49, i32 %50, i32* %3, i64 4)
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %58
53: ; preds = %37
%54 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%55 = call i32 @close(i32 %33)
%56 = load i32, i32* @EXIT_FAILURE
%57 = call i32 @exit(i32 %56)
unreachable
58: ; preds = %37
%59 = load i32, i32* @SOL_SOCKET
%60 = load i32, i32* @SO_BINDTODEVICE
%61 = load i32, i32* @IFNAMSIZ
%62 = add nsw i32 %61, -1
%63 = call i32 (i32, i32, i32, ...) @setsockopt(i32 %33, i32 %59, i32 %60, i8* %18, i32 %62)
%64 = icmp eq i32 %63, -1
br i1 %64, label %71, label %65
65: ; preds = %58
%66 = bitcast [1024 x i32]* %7 to i32**
%67 = bitcast %struct.sockaddr_storage* %6 to %struct.TYPE_3__*
%68 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %6, i64 0, i32 0
%69 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %5, i64 0, i32 1
%70 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %5, i64 0, i32 0
br label %76
71: ; preds = %58
%72 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%73 = call i32 @close(i32 %33)
%74 = load i32, i32* @EXIT_FAILURE
%75 = call i32 @exit(i32 %74)
unreachable
76: ; preds = %152, %65
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%78 = call i32 @recvfrom(i32 %33, i32* %26, i32 1024, i32 0, i32* null, i32* null)
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %78)
%80 = load i32*, i32** %66
%81 = load i32, i32* %80
%82 = icmp eq i32 %81, 0
%83 = getelementptr inbounds i32, i32* %80, i64 1
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, 19
%86 = select i1 %82, i1 %85, i1 false
br i1 %86, label %87, label %115
87: ; preds = %76
%88 = getelementptr inbounds i32, i32* %80, i64 2
%89 = load i32, i32* %88
%90 = icmp eq i32 %89, 32
br i1 %90, label %91, label %115
91: ; preds = %87
%92 = getelementptr inbounds i32, i32* %80, i64 3
%93 = load i32, i32* %92
%94 = icmp eq i32 %93, 253
br i1 %94, label %95, label %115
95: ; preds = %91
%96 = getelementptr inbounds i32, i32* %80, i64 4
%97 = load i32, i32* %96
%98 = icmp eq i32 %97, 245
br i1 %98, label %99, label %115
99: ; preds = %95
%100 = getelementptr inbounds i32, i32* %80, i64 5
%101 = load i32, i32* %100
%102 = icmp eq i32 %101, 48
br i1 %102, label %103, label %115
103: ; preds = %99
%104 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.13, i64 0, i64 0))
%105 = load i32, i32* %27
store i32 %105, i32* %68
%106 = load i32, i32* @AF_INET
%107 = call i32 @inet_ntop(i32 %106, %struct.TYPE_3__* %67, i8* %10, i32 %8)
%108 = load i32, i32* %69
%109 = load i32, i32* @IFNAMSIZ
%110 = add nsw i32 %109, -1
%111 = call i32 @strncpy(i32 %108, i8* %18, i32 %110)
%112 = load i32, i32* @SIOCGIFADDR
%113 = call i64 @ioctl(i32 %33, i32 %112, %struct.ifreq* %5)
%114 = icmp sgt i64 %113, -1
br i1 %114, label %126, label %136
115: ; preds = %76, %99, %95, %91, %87
%116 = phi i32 [ 19, %99 ], [ 19, %95 ], [ 19, %91 ], [ 19, %87 ], [ %84, %76 ]
%117 = getelementptr inbounds i32, i32* %80, i64 2
%118 = load i32, i32* %117
%119 = getelementptr inbounds i32, i32* %80, i64 3
%120 = load i32, i32* %119
%121 = getelementptr inbounds i32, i32* %80, i64 4
%122 = load i32, i32* %121
%123 = getelementptr inbounds i32, i32* %80, i64 5
%124 = load i32, i32* %123
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %81, i32 %116, i32 %118, i32 %120, i32 %122, i32 %124)
br label %152
126: ; preds = %103
%127 = load i32, i32* %70
%128 = call i8* @inet_ntoa(i32 %127)
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %10, i8* %128)
%130 = load i32, i32* %70
%131 = call i8* @inet_ntoa(i32 %130)
%132 = call i64 @strcmp(i8* %10, i8* %131)
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %136
134: ; preds = %126
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.14, i64 0, i64 0))
br label %152
136: ; preds = %126, %103
%137 = load i32, i32* %28
%138 = call i32 @ntohs(i32 %137)
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
%140 = icmp sgt i32 %78, 0
br i1 %140, label %141, label %150
141: ; preds = %136
%142 = zext i32 %78 to i64
br label %143
143: ; preds = %141, %143
%144 = phi i64 [ 0, %141 ], [ %148, %143 ]
%145 = getelementptr inbounds [1024 x i32], [1024 x i32]* %7, i64 0, i64 %144
%146 = load i32, i32* %145
%147 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %146)
%148 = add nuw nsw i64 %144, 1
%149 = icmp eq i64 %148, %142
br i1 %149, label %150, label %143
150: ; preds = %143, %136
%151 = call i32 @putchar(i32 10)
br label %152
152: ; preds = %150, %134, %115
br label %76
}