#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 dummy;
};
struct sockaddr {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ *ai_addr;
  scalar_t__ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ *ai_canonname;
  int /*<<< orphan*/ ai_flags;
};
typedef int ssize_t;
typedef int socklen_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AI_PASSIVE;
int EXIT_FAILURE;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ puts(char *);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  struct addrinfo hints;
  struct addrinfo *result, *rp;
  int sfd, s;
  struct sockaddr_storage peer_addr;
  socklen_t peer_addr_len;
  ssize_t nread;
  char buf[(1000 + 1)];
  if (argc != 2) {
    fprintf(stderr, "Usage: %s port\n", argv[0]);
    return EXIT_FAILURE;
  }
  memset(&hints, 0, sizeof(struct addrinfo));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_flags = AI_PASSIVE;
  hints.ai_protocol = 0;
  hints.ai_canonname = NULL;
  hints.ai_addr = NULL;
  hints.ai_next = NULL;
  s = getaddrinfo(NULL, argv[1], &hints, &result);
  if (s != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(s));
    return EXIT_FAILURE;
  }
  for (rp = result; rp != NULL; rp = rp->ai_next) {
    sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
    if (sfd == -1) {
      continue;
    }
    if (bind(sfd, rp->ai_addr, rp->ai_addrlen) == 0) {
      break;
    }
    close(sfd);
  }
  if (rp == NULL) {
    fprintf(stderr, "Could not bind to port: %s\n", argv[1]);
    return EXIT_FAILURE;
  }
  freeaddrinfo(result);
  fprintf(stderr, "Press ^C to terminate\n");
  for (;;) {
    peer_addr_len = sizeof(struct sockaddr_storage);
    nread = recvfrom(sfd, buf, (1000 + 1) - 1, 0, (struct sockaddr *)&peer_addr,
                     &peer_addr_len);
    if (nread == -1) {
      continue;
    }
    buf[nread] = '\0';
    puts(buf);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11f2 <main+0x52>
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe26(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13d8 <main+0x238>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1050 <memset@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2dc3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2dc7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
call   10a0 <getaddrinfo@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
je     12ab <main+0x10b>
mov    0x2d55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x464(%rbp)
mov    -0x60(%rbp),%edi
call   1040 <gai_strerror@plt>
mov    -0x464(%rbp),%edi
mov    %rax,%rdx
lea    0xd7d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13d8 <main+0x238>
mov    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     1329 <main+0x189>
mov    -0x58(%rbp),%rax
mov    0x1c(%rax),%edi
mov    -0x58(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%rdx
call   10c0 <socket@plt>
mov    %eax,-0x5c(%rbp)
cmpl   $0xffffffff,-0x5c(%rbp)
jne    12eb <main+0x14b>
jmp    1318 <main+0x178>
mov    -0x5c(%rbp),%edi
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x58(%rbp),%rax
mov    (%rax),%edx
call   1090 <bind@plt>
cmp    $0x0,%rax
jne    1310 <main+0x170>
jmp    1329 <main+0x189>
mov    -0x5c(%rbp),%edi
call   1060 <close@plt>
mov    -0x58(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    12b3 <main+0x113>
cmpq   $0x0,-0x58(%rbp)
jne    1364 <main+0x1c4>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xcd5(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2c66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13d8 <main+0x238>
mov    -0x50(%rbp),%rdi
call   10b0 <freeaddrinfo@plt>
mov    0x2c54(%rip),%rax
mov    (%rax),%edi
lea    0xcc0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x6c(%rbp)
mov    -0x5c(%rbp),%edi
lea    -0x460(%rbp),%rsi
lea    -0x68(%rbp),%r8
mov    $0x3e8,%edx
xor    %ecx,%ecx
lea    -0x6c(%rbp),%r9
call   1080 <recvfrom@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0xffffffff,-0x70(%rbp)
jne    13bb <main+0x21b>
jmp    1384 <main+0x1e4>
movslq -0x70(%rbp),%rax
movb   $0x0,-0x460(%rbp,%rax,1)
lea    -0x460(%rbp),%rdi
call   1030 <puts@plt>
jmp    1384 <main+0x1e4>
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x448,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jne    1232 <main+0x92>
lea    0x18(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1050 <memset@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x34(%rsp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x48(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movups %xmm0,0x38(%rsp)
mov    0x8(%r14),%rsi
lea    0x8(%rsp),%rcx
xor    %edi,%edi
mov    %rbp,%rdx
call   10a0 <getaddrinfo@plt>
test   %eax,%eax
je     1247 <main+0xa7>
mov    0x2dad(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1040 <gai_strerror@plt>
lea    0xde5(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
jmp    129e <main+0xfe>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xdbb(%rip),%rsi
jmp    129e <main+0xfe>
mov    0x8(%rsp),%rbx
jmp    1254 <main+0xb4>
xchg   %ax,%ax
mov    0x20(%rbx),%rbx
test   %rbx,%rbx
je     128a <main+0xea>
mov    0x1c(%rbx),%edi
mov    0x18(%rbx),%esi
mov    0x10(%rbx),%rdx
call   10c0 <socket@plt>
cmp    $0xffffffff,%eax
je     1250 <main+0xb0>
mov    %eax,%ebp
mov    0x8(%rbx),%rsi
mov    (%rbx),%edx
mov    %eax,%edi
call   1090 <bind@plt>
test   %rax,%rax
je     12bc <main+0x11c>
mov    %ebp,%edi
call   1060 <close@plt>
jmp    1250 <main+0xb0>
mov    0x2d37(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r14),%rdx
lea    0xd83(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2d14(%rip),%rax
mov    (%rax),%eax
add    $0x448,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsp),%rdi
call   10b0 <freeaddrinfo@plt>
mov    0x2cfb(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0x50(%rsp),%rbx
lea    0x10(%rsp),%r14
lea    0x4(%rsp),%r15
nopl   0x0(%rax)
movl   $0x4,0x4(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3e8,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    %r15,%r9
call   1080 <recvfrom@plt>
cmp    $0xffffffff,%eax
je     12f0 <main+0x150>
cltq
movb   $0x0,0x50(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    12f0 <main+0x150>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32*, i64, i32, i32, %struct.addrinfo*, i32*, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [16 x i8] c"Usage: %s port\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [28 x i8] c"Could not bind to port: %s\0A\00"
@.str.3 = [23 x i8] c"Press ^C to terminate\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.addrinfo
%7 = alloca %struct.addrinfo*
%8 = alloca %struct.addrinfo*
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.sockaddr_storage
%12 = alloca i32
%13 = alloca i32
%14 = alloca [1001 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %24
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %3
br label %114
24: ; preds = %2
%25 = call i32 @memset(%struct.addrinfo* %6, i32 0, i32 56)
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 4
store i32 %26, i32* %27
%28 = load i32, i32* @SOCK_DGRAM
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 3
store i32 %28, i32* %29
%30 = load i32, i32* @AI_PASSIVE
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 7
store i32 %30, i32* %31
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 2
store i64 0, i64* %32
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 6
store i32* null, i32** %33
%34 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 1
store i32* null, i32** %34
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 5
store %struct.addrinfo* null, %struct.addrinfo** %35
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @getaddrinfo(i32* null, i8* %38, %struct.addrinfo* %6, %struct.addrinfo** %7)
store i32 %39, i32* %10
%40 = load i32, i32* %10
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %24
%43 = load i32, i32* @stderr
%44 = load i32, i32* %10
%45 = call i8* @gai_strerror(i32 %44)
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %45)
%47 = load i32, i32* @EXIT_FAILURE
store i32 %47, i32* %3
br label %114
48: ; preds = %24
%49 = load %struct.addrinfo*, %struct.addrinfo** %7
store %struct.addrinfo* %49, %struct.addrinfo** %8
br label %50
50: ; preds = %81, %48
%51 = load %struct.addrinfo*, %struct.addrinfo** %8
%52 = icmp ne %struct.addrinfo* %51, null
br i1 %52, label %53, label %85
53: ; preds = %50
%54 = load %struct.addrinfo*, %struct.addrinfo** %8
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 4
%56 = load i32, i32* %55
%57 = load %struct.addrinfo*, %struct.addrinfo** %8
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %57, i32 0, i32 3
%59 = load i32, i32* %58
%60 = load %struct.addrinfo*, %struct.addrinfo** %8
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i32 0, i32 2
%62 = load i64, i64* %61
%63 = call i32 @socket(i32 %56, i32 %59, i64 %62)
store i32 %63, i32* %9
%64 = load i32, i32* %9
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %67
66: ; preds = %53
br label %81
67: ; preds = %53
%68 = load i32, i32* %9
%69 = load %struct.addrinfo*, %struct.addrinfo** %8
%70 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %69, i32 0, i32 1
%71 = load i32*, i32** %70
%72 = load %struct.addrinfo*, %struct.addrinfo** %8
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %72, i32 0, i32 0
%74 = load i32, i32* %73
%75 = call i64 @bind(i32 %68, i32* %71, i32 %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %67
br label %85
78: ; preds = %67
%79 = load i32, i32* %9
%80 = call i32 @close(i32 %79)
br label %81
81: ; preds = %78, %66
%82 = load %struct.addrinfo*, %struct.addrinfo** %8
%83 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %82, i32 0, i32 5
%84 = load %struct.addrinfo*, %struct.addrinfo** %83
store %struct.addrinfo* %84, %struct.addrinfo** %8
br label %50
85: ; preds = %77, %50
%86 = load %struct.addrinfo*, %struct.addrinfo** %8
%87 = icmp eq %struct.addrinfo* %86, null
br i1 %87, label %88, label %95
88: ; preds = %85
%89 = load i32, i32* @stderr
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 1
%92 = load i8*, i8** %91
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %92)
%94 = load i32, i32* @EXIT_FAILURE
store i32 %94, i32* %3
br label %114
95: ; preds = %85
%96 = load %struct.addrinfo*, %struct.addrinfo** %7
%97 = call i32 @freeaddrinfo(%struct.addrinfo* %96)
%98 = load i32, i32* @stderr
%99 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %100
100: ; preds = %108, %107, %95
store i32 4, i32* %12
%101 = load i32, i32* %9
%102 = getelementptr inbounds [1001 x i8], [1001 x i8]* %14, i64 0, i64 0
%103 = bitcast %struct.sockaddr_storage* %11 to %struct.sockaddr*
%104 = call i32 @recvfrom(i32 %101, i8* %102, i32 1000, i32 0, %struct.sockaddr* %103, i32* %12)
store i32 %104, i32* %13
%105 = load i32, i32* %13
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %108
107: ; preds = %100
br label %100
108: ; preds = %100
%109 = load i32, i32* %13
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [1001 x i8], [1001 x i8]* %14, i64 0, i64 %110
store i8 0, i8* %111
%112 = getelementptr inbounds [1001 x i8], [1001 x i8]* %14, i64 0, i64 0
%113 = call i32 @puts(i8* %112)
br label %100
114: ; preds = %88, %42, %17
%115 = load i32, i32* %3
ret i32 %115
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32*, i64, i32, i32, %struct.addrinfo*, i32*, i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [16 x i8] c"Usage: %s port\0A\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [28 x i8] c"Could not bind to port: %s\0A\00"
@.str.3 = [23 x i8] c"Press ^C to terminate\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca %struct.sockaddr_storage
%6 = alloca i32
%7 = alloca [1001 x i8]
%8 = bitcast %struct.addrinfo* %3 to i8*
%9 = bitcast %struct.addrinfo** %4 to i8*
%10 = bitcast %struct.sockaddr_storage* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = getelementptr inbounds [1001 x i8], [1001 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 2
br i1 %13, label %18, label %14
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %82
18: ; preds = %2
%19 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 56)
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %20, i32* %21
%22 = load i32, i32* @SOCK_DGRAM
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %22, i32* %23
%24 = load i32, i32* @AI_PASSIVE
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 7
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 1
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = bitcast i32** %26 to i8*
%30 = bitcast %struct.addrinfo** %27 to i8*
%31 = load i8*, i8** %28
%32 = call i32 @getaddrinfo(i32* null, i8* %31, %struct.addrinfo* %3, %struct.addrinfo** %4)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %18
%35 = load %struct.addrinfo*, %struct.addrinfo** %4
%36 = icmp eq %struct.addrinfo* %35, null
br i1 %36, label %64, label %41
37: ; preds = %18
%38 = load i32, i32* @stderr
%39 = call i8* @gai_strerror(i32 %32)
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %39)
br label %82
41: ; preds = %34, %60
%42 = phi %struct.addrinfo* [ %62, %60 ], [ %35, %34 ]
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 4
%44 = load i32, i32* %43
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 3
%46 = load i32, i32* %45
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 2
%48 = load i64, i64* %47
%49 = call i32 @socket(i32 %44, i32 %46, i64 %48)
%50 = icmp eq i32 %49, -1
br i1 %50, label %60, label %51
51: ; preds = %41
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 1
%53 = load i32*, i32** %52
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 0
%55 = load i32, i32* %54
%56 = call i64 @bind(i32 %49, i32* %53, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %68, label %58
58: ; preds = %51
%59 = call i32 @close(i32 %49)
br label %60
60: ; preds = %41, %58
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i64 0, i32 5
%62 = load %struct.addrinfo*, %struct.addrinfo** %61
%63 = icmp eq %struct.addrinfo* %62, null
br i1 %63, label %64, label %41
64: ; preds = %60, %34
%65 = load i32, i32* @stderr
%66 = load i8*, i8** %28
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %66)
br label %82
68: ; preds = %51
%69 = load %struct.addrinfo*, %struct.addrinfo** %4
%70 = call i32 @freeaddrinfo(%struct.addrinfo* %69)
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%73 = bitcast %struct.sockaddr_storage* %5 to %struct.sockaddr*
br label %74
74: ; preds = %81, %68
store i32 4, i32* %6
%75 = call i32 @recvfrom(i32 %49, i8* %12, i32 1000, i32 0, %struct.sockaddr* %73, i32* %6)
%76 = icmp eq i32 %75, -1
br i1 %76, label %81, label %77
77: ; preds = %74
%78 = sext i32 %75 to i64
%79 = getelementptr inbounds [1001 x i8], [1001 x i8]* %7, i64 0, i64 %78
store i8 0, i8* %79
%80 = call i32 @puts(i8* %12)
br label %81
81: ; preds = %77, %74
br label %74
82: ; preds = %64, %37, %14
%83 = load i32, i32* @EXIT_FAILURE
ret i32 %83
}