#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 */

/* Type definitions */
struct sockaddr_storage {
  int /*<<< orphan*/ ss_family;
};
struct sockaddr {
  int dummy;
};
struct pollfd {
  int fd;
  int events;
  int revents;
};
struct addrinfo {
  scalar_t__ ai_family;
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
};
typedef int socklen_t;

/* Variables and functions */
scalar_t__ AF_INET;
scalar_t__ AF_INET6;
scalar_t__ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ IPPROTO_IPV6;
int /*<<< orphan*/ IPV6_V6ONLY;
int POLLIN;
int /*<<< orphan*/ SOCK_DGRAM;
int bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
char *inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ poll(struct pollfd *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int socket(scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(void) {
  int sockfd4 = -1, sockfd6 = -1;
  struct addrinfo hints, *servinfo, *p;
  int rv;
  int numbytes;
  struct sockaddr_storage their_addr;
  char s[INET6_ADDRSTRLEN];
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_flags = AI_PASSIVE;
  if ((rv = getaddrinfo(NULL, "4950", &hints, &servinfo)) != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
    return 1;
  }
  for (p = servinfo; p != NULL; p = p->ai_next) {
    if (p->ai_family != AF_INET6)
      continue;
    if ((sockfd6 = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) ==
        -1) {
      perror("socket");
      continue;
    }
    int yes = 1;
    if (setsockopt(sockfd6, IPPROTO_IPV6, IPV6_V6ONLY, &yes, sizeof(int)) ==
        -1) {
      close(sockfd6);
      perror("setsockopt");
    }
    if (bind(sockfd6, p->ai_addr, p->ai_addrlen) == -1) {
      close(sockfd6);
      perror("bind");
      continue;
    }
    break;
  }
  for (p = servinfo; p != NULL; p = p->ai_next) {
    if (p->ai_family != AF_INET)
      continue;
    if ((sockfd4 = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) ==
        -1) {
      perror("socket");
      continue;
    }
    if (bind(sockfd4, p->ai_addr, p->ai_addrlen) == -1) {
      close(sockfd4);
      perror("bind");
      continue;
    }
    break;
  }
  if (p == NULL) {
    fprintf(stderr, "failed to bind socket\n");
    return 2;
  }
  freeaddrinfo(servinfo);
  printf("Waiting for something to read from either the IPv4 or IPv6 "
         "sockets...\n");
  struct pollfd fds[2];
  fds[0].fd = sockfd4;
  fds[0].events = POLLIN;
  fds[1].fd = sockfd6;
  fds[1].events = POLLIN;
  poll(fds, 2, -1);
  int sockfd;
  if (fds[0].revents & POLLIN) {
    printf("Reading from IPv4 socket\n");
    sockfd = sockfd4;
  } else {
    printf("Reading from IPv6 socket\n");
    sockfd = sockfd6;
  }
  char buf[100];
  socklen_t addr_len = sizeof their_addr;
  if ((numbytes = recvfrom(sockfd, buf, 100 - 1, 0,
                           (struct sockaddr *)&their_addr, &addr_len)) == -1) {
    perror("recvfrom");
    exit(1);
  }
  printf("got packet from %s\n",
         inet_ntop(their_addr.ss_family,
                   get_in_addr((struct sockaddr *)&their_addr), s, sizeof s));
  printf("packet is %d bytes long\n", numbytes);
  buf[numbytes] = '\0';
  printf("packet contains \"%s\"\n", buf);
  close(sockfd4);
  close(sockfd6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    0x2dc1(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x118(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x110(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x68(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1080 <memset@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xd69(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   1100 <getaddrinfo@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0x0,%eax
je     12f1 <main+0xf1>
mov    0x2cf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x11c(%rbp)
mov    -0x4c(%rbp),%edi
call   1070 <gai_strerror@plt>
mov    -0x11c(%rbp),%edi
mov    %rax,%rdx
lea    0xd2e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    165b <main+0x45b>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     13ed <main+0x1ed>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
mov    0x2cae(%rip),%rcx
cmp    (%rcx),%rax
je     1320 <main+0x120>
jmp    13dc <main+0x1dc>
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1357 <main+0x157>
lea    0xcc9(%rip),%rdi
call   10e0 <perror@plt>
jmp    13dc <main+0x1dc>
movl   $0x1,-0x70(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2c30(%rip),%rax
mov    (%rax),%esi
mov    0x2c2f(%rip),%rax
mov    (%rax),%edx
lea    -0x70(%rbp),%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    139f <main+0x19f>
mov    -0xc(%rbp),%edi
call   1090 <close@plt>
lea    0xc83(%rip),%rdi
call   10e0 <perror@plt>
mov    -0xc(%rbp),%edi
mov    -0x48(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    13d7 <main+0x1d7>
mov    -0xc(%rbp),%edi
call   1090 <close@plt>
lea    0xc5b(%rip),%rdi
call   10e0 <perror@plt>
jmp    13dc <main+0x1dc>
jmp    13ed <main+0x1ed>
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    12f9 <main+0xf9>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     14a1 <main+0x2a1>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
mov    0x2bca(%rip),%rcx
cmp    (%rcx),%rax
je     141c <main+0x21c>
jmp    1490 <main+0x290>
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
mov    -0x48(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    1453 <main+0x253>
lea    0xbcd(%rip),%rdi
call   10e0 <perror@plt>
jmp    1490 <main+0x290>
mov    -0x8(%rbp),%edi
mov    -0x48(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    148b <main+0x28b>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
lea    0xba7(%rip),%rdi
call   10e0 <perror@plt>
jmp    1490 <main+0x290>
jmp    14a1 <main+0x2a1>
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    13f5 <main+0x1f5>
cmpq   $0x0,-0x48(%rbp)
jne    14d6 <main+0x2d6>
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
lea    0xb71(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    165b <main+0x45b>
mov    -0x40(%rbp),%rdi
call   1110 <freeaddrinfo@plt>
lea    0xb5e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    0x2abb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    0x2aa3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   10c0 <poll@plt>
mov    -0x88(%rbp),%eax
mov    0x2a7b(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1564 <main+0x364>
lea    0xb3c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x94(%rbp)
jmp    157b <main+0x37b>
lea    0xb3a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x94(%rbp)
movl   $0x4,-0x104(%rbp)
mov    -0x94(%rbp),%edi
lea    -0x100(%rbp),%rsi
lea    -0x58(%rbp),%r8
mov    $0x63,%edx
xor    %ecx,%ecx
lea    -0x104(%rbp),%r9
call   10b0 <recvfrom@plt>
mov    %eax,-0x50(%rbp)
cmp    $0xffffffff,%eax
jne    15cb <main+0x3cb>
lea    0xb03(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x58(%rbp),%eax
mov    %eax,-0x120(%rbp)
lea    -0x58(%rbp),%rdi
call   1040 <get_in_addr@plt>
mov    -0x120(%rbp),%edi
mov    -0x110(%rbp),%rdx
mov    %eax,%esi
mov    -0x118(%rbp),%rax
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rsi
lea    0xac4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x50(%rbp),%esi
lea    0xac7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x50(%rbp),%rax
movb   $0x0,-0x100(%rbp,%rax,1)
lea    -0x100(%rbp),%rsi
lea    0xabf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%edi
call   1090 <close@plt>
mov    -0xc(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x6c(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rsp,%r14
mov    0x2dba(%rip),%rax
mov    (%rax),%ebx
mov    %rsp,%r13
lea    0xf(%rbx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    -0x90(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1090 <memset@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2d65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
lea    0xd79(%rip),%rsi
lea    -0x38(%rbp),%rcx
xor    %edi,%edi
mov    %r15,%rdx
call   1110 <getaddrinfo@plt>
test   %eax,%eax
je     12c6 <main+0xb6>
mov    0x2d08(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1080 <gai_strerror@plt>
lea    0xd55(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%ebx
jmp    153f <main+0x32f>
mov    %rbx,-0x68(%rbp)
mov    %r14,-0x48(%rbp)
mov    -0x38(%rbp),%rbx
test   %rbx,%rbx
je     1413 <main+0x203>
mov    $0xffffffff,%r15d
mov    0x2cd8(%rip),%r14
lea    -0x100(%rbp),%r12
jmp    131d <main+0x10d>
lea    0xe02(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xffffffff,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
je     13ac <main+0x19c>
mov    (%rbx),%rdi
cmp    (%r14),%rdi
jne    1310 <main+0x100>
mov    0x10(%rbx),%edx
mov    0x14(%rbx),%esi
call   1130 <socket@plt>
cmp    $0xffffffff,%eax
je     12f1 <main+0xe1>
mov    %eax,%r15d
movl   $0x1,-0x100(%rbp)
mov    0x2c4f(%rip),%rax
mov    (%rax),%esi
mov    0x2c4e(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
mov    %r12,%rcx
mov    $0x4,%r8d
call   1060 <setsockopt@plt>
cmp    $0xffffffff,%eax
je     1396 <main+0x186>
mov    0x8(%rbx),%edx
mov    0xc(%rbx),%esi
mov    %r15d,%edi
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    13ac <main+0x19c>
mov    %r15d,%edi
call   10a0 <close@plt>
lea    0xc95(%rip),%rdi
call   10f0 <perror@plt>
jmp    1310 <main+0x100>
mov    %r15d,%edi
call   10a0 <close@plt>
lea    0xc71(%rip),%rdi
call   10f0 <perror@plt>
jmp    136a <main+0x15a>
mov    -0x38(%rbp),%rbx
test   %rbx,%rbx
je     1413 <main+0x203>
mov    0x2c1c(%rip),%r14
jmp    13ce <main+0x1be>
xchg   %ax,%ax
call   10f0 <perror@plt>
mov    0x18(%rbx),%rbx
test   %rbx,%rbx
je     1413 <main+0x203>
mov    (%rbx),%rdi
cmp    (%r14),%rdi
jne    13c5 <main+0x1b5>
mov    0x10(%rbx),%edx
mov    0x14(%rbx),%esi
call   1130 <socket@plt>
lea    0xd12(%rip),%rdi
cmp    $0xffffffff,%eax
je     13c0 <main+0x1b0>
mov    %eax,%r12d
mov    0x8(%rbx),%edx
mov    0xc(%rbx),%esi
mov    %eax,%edi
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1434 <main+0x224>
mov    %r12d,%edi
call   10a0 <close@plt>
lea    0xc10(%rip),%rdi
jmp    13c0 <main+0x1b0>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
lea    0xc03(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x2,%ebx
jmp    153b <main+0x32b>
mov    -0x38(%rbp),%rdi
call   1120 <freeaddrinfo@plt>
lea    0xc45(%rip),%rdi
call   1050 <puts@plt>
mov    %r12d,-0x60(%rbp)
mov    0x2b64(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,-0x5c(%rbp)
mov    %r15d,-0x54(%rbp)
mov    %eax,-0x50(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x2,%esi
mov    $0xffffffff,%edx
call   10d0 <poll@plt>
mov    (%rbx),%eax
and    -0x58(%rbp),%eax
lea    0xc50(%rip),%rax
lea    0xc62(%rip),%rdi
cmove  %rax,%rdi
mov    %r12d,%r14d
cmove  %r15d,%r14d
call   1050 <puts@plt>
movl   $0x4,-0x40(%rbp)
lea    -0x100(%rbp),%rsi
xor    %ebx,%ebx
lea    -0x30(%rbp),%r8
lea    -0x40(%rbp),%r9
mov    %r14d,%edi
mov    $0x63,%edx
xor    %ecx,%ecx
call   10c0 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     1553 <main+0x343>
mov    %eax,%r14d
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <get_in_addr@plt>
mov    -0x3c(%rbp),%edi
mov    %eax,%esi
mov    %r13,%rdx
mov    -0x68(%rbp),%rcx
call   1030 <inet_ntop@plt>
lea    0xb56(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xb59(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
movslq %r14d,%rax
movb   $0x0,-0x100(%rbp,%rax,1)
lea    0xb56(%rip),%rdi
lea    -0x100(%rbp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r12d,%edi
call   10a0 <close@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
mov    -0x48(%rbp),%r14
mov    %r14,%rsp
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xae3(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.pollfd = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@AF_UNSPEC = global i64 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"4950\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@AF_INET6 = global i64 0
@.str.2 = [7 x i8] c"socket\00"
@IPPROTO_IPV6 = global i32 0
@IPV6_V6ONLY = global i32 0
@.str.3 = [11 x i8] c"setsockopt\00"
@.str.4 = [5 x i8] c"bind\00"
@AF_INET = global i64 0
@.str.5 = [23 x i8] c"failed to bind socket\0A\00"
@.str.6 = [71 x i8] c"Waiting for something to read from either the IPv4 or IPv6 sockets...\0A\00"
@POLLIN = global i32 0
@.str.7 = [26 x i8] c"Reading from IPv4 socket\0A\00"
@.str.8 = [26 x i8] c"Reading from IPv6 socket\0A\00"
@.str.9 = [9 x i8] c"recvfrom\00"
@.str.10 = [20 x i8] c"got packet from %s\0A\00"
@.str.11 = [25 x i8] c"packet is %d bytes long\0A\00"
@.str.12 = [22 x i8] c"packet contains \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = alloca %struct.addrinfo*
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.sockaddr_storage
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca [2 x %struct.pollfd]
%15 = alloca i32
%16 = alloca [100 x i8]
%17 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
store i32 -1, i32* %3
%18 = load i32, i32* @INET6_ADDRSTRLEN
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %10
%21 = alloca i8, i64 %19
store i64 %19, i64* %11
%22 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 40)
%23 = load i64, i64* @AF_UNSPEC
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i32 0, i32 0
store i64 %23, i64* %24
%25 = load i32, i32* @SOCK_DGRAM
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i32 0, i32 4
store i32 %25, i32* %26
%27 = load i32, i32* @AI_PASSIVE
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i32 0, i32 6
store i32 %27, i32* %28
%29 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %5)
store i32 %29, i32* %7
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %0
%32 = load i32, i32* @stderr
%33 = load i32, i32* %7
%34 = call i8* @gai_strerror(i32 %33)
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %34)
store i32 1, i32* %1
store i32 1, i32* %12
br label %200
36: ; preds = %0
%37 = load %struct.addrinfo*, %struct.addrinfo** %5
store %struct.addrinfo* %37, %struct.addrinfo** %6
br label %38
38: ; preds = %87, %36
%39 = load %struct.addrinfo*, %struct.addrinfo** %6
%40 = icmp ne %struct.addrinfo* %39, null
br i1 %40, label %41, label %91
41: ; preds = %38
%42 = load %struct.addrinfo*, %struct.addrinfo** %6
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i32 0, i32 0
%44 = load i64, i64* %43
%45 = load i64, i64* @AF_INET6
%46 = icmp ne i64 %44, %45
br i1 %46, label %47, label %48
47: ; preds = %41
br label %87
48: ; preds = %41
%49 = load %struct.addrinfo*, %struct.addrinfo** %6
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %49, i32 0, i32 0
%51 = load i64, i64* %50
%52 = load %struct.addrinfo*, %struct.addrinfo** %6
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %52, i32 0, i32 4
%54 = load i32, i32* %53
%55 = load %struct.addrinfo*, %struct.addrinfo** %6
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %55, i32 0, i32 3
%57 = load i32, i32* %56
%58 = call i32 @socket(i64 %51, i32 %54, i32 %57)
store i32 %58, i32* %3
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %62
60: ; preds = %48
%61 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %87
62: ; preds = %48
store i32 1, i32* %13
%63 = load i32, i32* %3
%64 = load i32, i32* @IPPROTO_IPV6
%65 = load i32, i32* @IPV6_V6ONLY
%66 = call i32 @setsockopt(i32 %63, i32 %64, i32 %65, i32* %13, i32 4)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %72
68: ; preds = %62
%69 = load i32, i32* %3
%70 = call i32 @close(i32 %69)
%71 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %72
72: ; preds = %68, %62
%73 = load i32, i32* %3
%74 = load %struct.addrinfo*, %struct.addrinfo** %6
%75 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %74, i32 0, i32 2
%76 = load i32, i32* %75
%77 = load %struct.addrinfo*, %struct.addrinfo** %6
%78 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %77, i32 0, i32 1
%79 = load i32, i32* %78
%80 = call i32 @bind(i32 %73, i32 %76, i32 %79)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %86
82: ; preds = %72
%83 = load i32, i32* %3
%84 = call i32 @close(i32 %83)
%85 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %87
86: ; preds = %72
br label %91
87: ; preds = %82, %60, %47
%88 = load %struct.addrinfo*, %struct.addrinfo** %6
%89 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %88, i32 0, i32 5
%90 = load %struct.addrinfo*, %struct.addrinfo** %89
store %struct.addrinfo* %90, %struct.addrinfo** %6
br label %38
91: ; preds = %86, %38
%92 = load %struct.addrinfo*, %struct.addrinfo** %5
store %struct.addrinfo* %92, %struct.addrinfo** %6
br label %93
93: ; preds = %132, %91
%94 = load %struct.addrinfo*, %struct.addrinfo** %6
%95 = icmp ne %struct.addrinfo* %94, null
br i1 %95, label %96, label %136
96: ; preds = %93
%97 = load %struct.addrinfo*, %struct.addrinfo** %6
%98 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %97, i32 0, i32 0
%99 = load i64, i64* %98
%100 = load i64, i64* @AF_INET
%101 = icmp ne i64 %99, %100
br i1 %101, label %102, label %103
102: ; preds = %96
br label %132
103: ; preds = %96
%104 = load %struct.addrinfo*, %struct.addrinfo** %6
%105 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %104, i32 0, i32 0
%106 = load i64, i64* %105
%107 = load %struct.addrinfo*, %struct.addrinfo** %6
%108 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %107, i32 0, i32 4
%109 = load i32, i32* %108
%110 = load %struct.addrinfo*, %struct.addrinfo** %6
%111 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %110, i32 0, i32 3
%112 = load i32, i32* %111
%113 = call i32 @socket(i64 %106, i32 %109, i32 %112)
store i32 %113, i32* %2
%114 = icmp eq i32 %113, -1
br i1 %114, label %115, label %117
115: ; preds = %103
%116 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %132
117: ; preds = %103
%118 = load i32, i32* %2
%119 = load %struct.addrinfo*, %struct.addrinfo** %6
%120 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %119, i32 0, i32 2
%121 = load i32, i32* %120
%122 = load %struct.addrinfo*, %struct.addrinfo** %6
%123 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %122, i32 0, i32 1
%124 = load i32, i32* %123
%125 = call i32 @bind(i32 %118, i32 %121, i32 %124)
%126 = icmp eq i32 %125, -1
br i1 %126, label %127, label %131
127: ; preds = %117
%128 = load i32, i32* %2
%129 = call i32 @close(i32 %128)
%130 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %132
131: ; preds = %117
br label %136
132: ; preds = %127, %115, %102
%133 = load %struct.addrinfo*, %struct.addrinfo** %6
%134 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %133, i32 0, i32 5
%135 = load %struct.addrinfo*, %struct.addrinfo** %134
store %struct.addrinfo* %135, %struct.addrinfo** %6
br label %93
136: ; preds = %131, %93
%137 = load %struct.addrinfo*, %struct.addrinfo** %6
%138 = icmp eq %struct.addrinfo* %137, null
br i1 %138, label %139, label %142
139: ; preds = %136
%140 = load i32, i32* @stderr
%141 = call i32 (i32, i8*, ...) @fprintf(i32 %140, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %1
store i32 1, i32* %12
br label %200
142: ; preds = %136
%143 = load %struct.addrinfo*, %struct.addrinfo** %5
%144 = call i32 @freeaddrinfo(%struct.addrinfo* %143)
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.6, i64 0, i64 0))
%146 = load i32, i32* %2
%147 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %14, i64 0, i64 0
%148 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %147, i32 0, i32 0
store i32 %146, i32* %148
%149 = load i32, i32* @POLLIN
%150 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %14, i64 0, i64 0
%151 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %150, i32 0, i32 1
store i32 %149, i32* %151
%152 = load i32, i32* %3
%153 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %14, i64 0, i64 1
%154 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %153, i32 0, i32 0
store i32 %152, i32* %154
%155 = load i32, i32* @POLLIN
%156 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %14, i64 0, i64 1
%157 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %156, i32 0, i32 1
store i32 %155, i32* %157
%158 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %14, i64 0, i64 0
%159 = call i32 @poll(%struct.pollfd* %158, i32 2, i32 -1)
%160 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %14, i64 0, i64 0
%161 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %160, i32 0, i32 2
%162 = load i32, i32* %161
%163 = load i32, i32* @POLLIN
%164 = and i32 %162, %163
%165 = icmp ne i32 %164, 0
br i1 %165, label %166, label %169
166: ; preds = %142
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
%168 = load i32, i32* %2
store i32 %168, i32* %15
br label %172
169: ; preds = %142
%170 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%171 = load i32, i32* %3
store i32 %171, i32* %15
br label %172
172: ; preds = %169, %166
store i32 4, i32* %17
%173 = load i32, i32* %15
%174 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 0, i64 0
%175 = bitcast %struct.sockaddr_storage* %9 to %struct.sockaddr*
%176 = call i32 @recvfrom(i32 %173, i8* %174, i32 99, i32 0, %struct.sockaddr* %175, i32* %17)
store i32 %176, i32* %8
%177 = icmp eq i32 %176, -1
br i1 %177, label %178, label %181
178: ; preds = %172
%179 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%180 = call i32 @exit(i32 1)
unreachable
181: ; preds = %172
%182 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %9, i32 0, i32 0
%183 = load i32, i32* %182
%184 = bitcast %struct.sockaddr_storage* %9 to %struct.sockaddr*
%185 = call i32 @get_in_addr(%struct.sockaddr* %184)
%186 = trunc i64 %19 to i32
%187 = call i8* @inet_ntop(i32 %183, i32 %185, i8* %21, i32 %186)
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %187)
%189 = load i32, i32* %8
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %189)
%191 = load i32, i32* %8
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 0, i64 %192
store i8 0, i8* %193
%194 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 0, i64 0
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %194)
%196 = load i32, i32* %2
%197 = call i32 @close(i32 %196)
%198 = load i32, i32* %3
%199 = call i32 @close(i32 %198)
store i32 0, i32* %1
store i32 1, i32* %12
br label %200
200: ; preds = %181, %139, %31
%201 = load i8*, i8** %10
%202 = load i32, i32* %1
ret i32 %202
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.pollfd = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@AF_UNSPEC = global i64 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"4950\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@AF_INET6 = global i64 0
@.str.2 = [7 x i8] c"socket\00"
@IPPROTO_IPV6 = global i32 0
@IPV6_V6ONLY = global i32 0
@.str.3 = [11 x i8] c"setsockopt\00"
@.str.4 = [5 x i8] c"bind\00"
@AF_INET = global i64 0
@.str.5 = [23 x i8] c"failed to bind socket\0A\00"
@POLLIN = global i32 0
@.str.9 = [9 x i8] c"recvfrom\00"
@.str.10 = [20 x i8] c"got packet from %s\0A\00"
@.str.11 = [25 x i8] c"packet is %d bytes long\0A\00"
@.str.12 = [22 x i8] c"packet contains \22%s\22\0A\00"
@str = [70 x i8] c"Waiting for something to read from either the IPv4 or IPv6 sockets...\00"
@str.13 = [25 x i8] c"Reading from IPv6 socket\00"
@str.14 = [25 x i8] c"Reading from IPv4 socket\00"
define i32 @main() {
%1 = alloca %struct.addrinfo
%2 = alloca %struct.addrinfo*
%3 = alloca %struct.sockaddr_storage
%4 = alloca i32
%5 = alloca [2 x %struct.pollfd]
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = bitcast %struct.addrinfo* %1 to i8*
%9 = bitcast %struct.addrinfo** %2 to i8*
%10 = bitcast %struct.sockaddr_storage* %3 to i8*
%11 = load i32, i32* @INET6_ADDRSTRLEN
%12 = zext i32 %11 to i64
%13 = tail call i8* @llvm.stacksave()
%14 = alloca i8, i64 %12
%15 = call i32 @memset(%struct.addrinfo* %1, i32 0, i32 40)
%16 = load i64, i64* @AF_UNSPEC
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 0
store i64 %16, i64* %17
%18 = load i32, i32* @SOCK_DGRAM
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 4
store i32 %18, i32* %19
%20 = load i32, i32* @AI_PASSIVE
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 6
store i32 %20, i32* %21
%22 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %1, %struct.addrinfo** %2)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %0
%25 = load %struct.addrinfo*, %struct.addrinfo** %2
%26 = icmp eq %struct.addrinfo* %25, null
br i1 %26, label %106, label %27
27: ; preds = %24
%28 = bitcast i32* %4 to i8*
br label %33
29: ; preds = %0
%30 = load i32, i32* @stderr
%31 = call i8* @gai_strerror(i32 %22)
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %31)
br label %149
33: ; preds = %27, %68
%34 = phi %struct.addrinfo* [ %25, %27 ], [ %71, %68 ]
%35 = phi i32 [ -1, %27 ], [ %69, %68 ]
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 0
%37 = load i64, i64* %36
%38 = load i64, i64* @AF_INET6
%39 = icmp eq i64 %37, %38
br i1 %39, label %40, label %68
40: ; preds = %33
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 4
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 3
%44 = load i32, i32* %43
%45 = call i32 @socket(i64 %37, i32 %42, i32 %44)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %68
49: ; preds = %40
store i32 1, i32* %4
%50 = load i32, i32* @IPPROTO_IPV6
%51 = load i32, i32* @IPV6_V6ONLY
%52 = call i32 @setsockopt(i32 %45, i32 %50, i32 %51, i32* %4, i32 4)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = call i32 @close(i32 %45)
%56 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %57
57: ; preds = %54, %49
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 2
%59 = load i32, i32* %58
%60 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 1
%61 = load i32, i32* %60
%62 = call i32 @bind(i32 %45, i32 %59, i32 %61)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %67
64: ; preds = %57
%65 = call i32 @close(i32 %45)
%66 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %68
67: ; preds = %57
br label %73
68: ; preds = %64, %33, %47
%69 = phi i32 [ %35, %33 ], [ -1, %47 ], [ %45, %64 ]
%70 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 5
%71 = load %struct.addrinfo*, %struct.addrinfo** %70
%72 = icmp eq %struct.addrinfo* %71, null
br i1 %72, label %73, label %33
73: ; preds = %68, %67
%74 = phi i32 [ %45, %67 ], [ %69, %68 ]
%75 = load %struct.addrinfo*, %struct.addrinfo** %2
%76 = icmp eq %struct.addrinfo* %75, null
br i1 %76, label %106, label %77
77: ; preds = %73, %102
%78 = phi %struct.addrinfo* [ %104, %102 ], [ %75, %73 ]
%79 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i64 0, i32 0
%80 = load i64, i64* %79
%81 = load i64, i64* @AF_INET
%82 = icmp eq i64 %80, %81
br i1 %82, label %83, label %102
83: ; preds = %77
%84 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i64 0, i32 4
%85 = load i32, i32* %84
%86 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i64 0, i32 3
%87 = load i32, i32* %86
%88 = call i32 @socket(i64 %80, i32 %85, i32 %87)
%89 = icmp eq i32 %88, -1
br i1 %89, label %99, label %90
90: ; preds = %83
%91 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i64 0, i32 2
%92 = load i32, i32* %91
%93 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i64 0, i32 1
%94 = load i32, i32* %93
%95 = call i32 @bind(i32 %88, i32 %92, i32 %94)
%96 = icmp eq i32 %95, -1
br i1 %96, label %97, label %109
97: ; preds = %90
%98 = call i32 @close(i32 %88)
br label %99
99: ; preds = %83, %97
%100 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %97 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %83 ]
%101 = call i32 @perror(i8* %100)
br label %102
102: ; preds = %99, %77
%103 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i64 0, i32 5
%104 = load %struct.addrinfo*, %struct.addrinfo** %103
%105 = icmp eq %struct.addrinfo* %104, null
br i1 %105, label %106, label %77
106: ; preds = %102, %24, %73
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %149
109: ; preds = %90
%110 = load %struct.addrinfo*, %struct.addrinfo** %2
%111 = call i32 @freeaddrinfo(%struct.addrinfo* %110)
%112 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%113 = bitcast [2 x %struct.pollfd]* %5 to i8*
%114 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0
%115 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0, i32 0
store i32 %88, i32* %115
%116 = load i32, i32* @POLLIN
%117 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0, i32 1
store i32 %116, i32* %117
%118 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 1, i32 0
store i32 %74, i32* %118
%119 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 1, i32 1
store i32 %116, i32* %119
%120 = call i32 @poll(%struct.pollfd* %114, i32 2, i32 -1)
%121 = getelementptr inbounds [2 x %struct.pollfd], [2 x %struct.pollfd]* %5, i64 0, i64 0, i32 2
%122 = load i32, i32* %121
%123 = load i32, i32* @POLLIN
%124 = and i32 %123, %122
%125 = icmp eq i32 %124, 0
%126 = select i1 %125, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.13, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0)
%127 = select i1 %125, i32 %74, i32 %88
%128 = call i32 @puts(i8* dereferenceable(1) %126)
%129 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%130 = bitcast i32* %7 to i8*
store i32 4, i32* %7
%131 = bitcast %struct.sockaddr_storage* %3 to %struct.sockaddr*
%132 = call i32 @recvfrom(i32 %127, i8* %129, i32 99, i32 0, %struct.sockaddr* %131, i32* %7)
%133 = icmp eq i32 %132, -1
br i1 %133, label %134, label %137
134: ; preds = %109
%135 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%136 = call i32 @exit(i32 1)
unreachable
137: ; preds = %109
%138 = getelementptr inbounds %struct.sockaddr_storage, %struct.sockaddr_storage* %3, i64 0, i32 0
%139 = load i32, i32* %138
%140 = call i32 @get_in_addr(%struct.sockaddr* %131)
%141 = call i8* @inet_ntop(i32 %139, i32 %140, i8* %14, i32 %11)
%142 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* %141)
%143 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i32 %132)
%144 = sext i32 %132 to i64
%145 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 %144
store i8 0, i8* %145
%146 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %129)
%147 = call i32 @close(i32 %88)
%148 = call i32 @close(i32 %74)
br label %149
149: ; preds = %137, %106, %29
%150 = phi i32 [ 1, %29 ], [ 2, %106 ], [ 0, %137 ]
ret i32 %150
}