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

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ IPPROTO_UDP;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ bind(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(struct addrinfo *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
struct sockaddr *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
             int /*<<< orphan*/ *);
scalar_t__ sendto(int, char **, int, int /*<<< orphan*/, struct sockaddr *,
                  int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  struct addrinfo hints, *res, *ressave;
  char *host, *port, buf[256];
  int sockfd, size, status;
  socklen_t addrlen;
  struct sockaddr *cliaddr;
  if (argc == 3) {
    host = argv[1];
    port = argv[2];
  } else {
    printf("usage: echo_server <local-address> <local-port>\n");
    return -1;
  }
  bzero(&hints, sizeof(struct addrinfo));
  hints.ai_flags = AI_PASSIVE;
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_DGRAM;
  hints.ai_protocol = IPPROTO_UDP;
  if ((status = getaddrinfo(host, port, &hints, &res)) != 0) {
    perror("getaddrinfo");
    return -1;
  }
  ressave = res;
  while (res) {
    sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
    if (sockfd >= 0 && !bind(sockfd, res->ai_addr, res->ai_addrlen))
      break;
    if (sockfd >= 0)
      close(sockfd);
    res = res->ai_next;
  }
  if (!res) {
    fprintf(stderr, "Can't bind to: %s %s\n", host, port);
    return -1;
  }
  addrlen = res->ai_addrlen;
  freeaddrinfo(ressave);
  cliaddr = malloc(addrlen);
  while (1) {
    size = recvfrom(sockfd, buf, 256, 0, cliaddr, &addrlen);
    if (size < 0) {
      perror("recvfrom");
      return -1;
    }
    printf("%s", buf);
    fflush(stdout);
    if (sendto(sockfd, &buf, size, 0, cliaddr, addrlen) < 0) {
      perror("sendto");
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1210 <main+0x40>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    122a <main+0x5a>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <main+0x282>
lea    -0x38(%rbp),%rdi
mov    $0x28,%esi
call   10c0 <bzero@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    %eax,-0x16c(%rbp)
cmp    $0x0,%eax
je     12a4 <main+0xd4>
lea    0xd9e(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <main+0x282>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1333 <main+0x163>
mov    -0x40(%rbp),%rax
mov    0x1c(%rax),%edi
mov    -0x40(%rbp),%rax
mov    0x18(%rax),%esi
mov    -0x40(%rbp),%rax
mov    0x14(%rax),%edx
call   10f0 <socket@plt>
mov    %eax,-0x164(%rbp)
cmpl   $0x0,-0x164(%rbp)
jl     130a <main+0x13a>
mov    -0x164(%rbp),%edi
mov    -0x40(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x40(%rbp),%rax
mov    (%rax),%edx
call   10a0 <bind@plt>
cmp    $0x0,%eax
jne    130a <main+0x13a>
jmp    1333 <main+0x163>
cmpl   $0x0,-0x164(%rbp)
jl     1322 <main+0x152>
mov    -0x164(%rbp),%edi
call   1050 <close@plt>
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    12ac <main+0xdc>
cmpq   $0x0,-0x40(%rbp)
jne    1367 <main+0x197>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
mov    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
lea    0xce7(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <main+0x282>
mov    -0x40(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x170(%rbp)
mov    -0x48(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    -0x170(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x178(%rbp)
mov    -0x164(%rbp),%edi
lea    -0x160(%rbp),%rsi
mov    -0x178(%rbp),%r8
mov    $0x100,%edx
xor    %ecx,%ecx
lea    -0x170(%rbp),%r9
call   1090 <recvfrom@plt>
mov    %eax,-0x168(%rbp)
cmpl   $0x0,-0x168(%rbp)
jge    13e0 <main+0x210>
lea    0xc84(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <main+0x282>
lea    -0x160(%rbp),%rsi
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x164(%rbp),%edi
lea    -0x160(%rbp),%rsi
mov    -0x168(%rbp),%edx
mov    -0x178(%rbp),%r8
mov    -0x170(%rbp),%r9d
xor    %ecx,%ecx
call   1040 <sendto@plt>
cmp    $0x0,%rax
jge    144d <main+0x27d>
lea    0xc23(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1452 <main+0x282>
jmp    138e <main+0x1be>
mov    -0x4(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
cmp    $0x3,%edi
jne    12ea <main+0x10a>
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%r14
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x28,%esi
call   10d0 <bzero@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x34(%rsp)
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2d6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
lea    0x8(%rsp),%rcx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10e0 <getaddrinfo@plt>
test   %eax,%eax
jne    130d <main+0x12d>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     12cd <main+0xed>
mov    %rbx,%rax
jmp    129a <main+0xba>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
call   1060 <close@plt>
mov    0x8(%rsp),%rax
mov    0x8(%rax),%rax
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     12cd <main+0xed>
mov    0x1c(%rax),%edi
mov    0x14(%rax),%edx
mov    0x18(%rax),%esi
call   1100 <socket@plt>
test   %eax,%eax
js     1287 <main+0xa7>
mov    %eax,%ebp
mov    0x8(%rsp),%rax
mov    (%rax),%edx
mov    0x10(%rax),%esi
mov    %ebp,%edi
call   10b0 <bind@plt>
test   %eax,%eax
jne    1280 <main+0xa0>
mov    0x8(%rsp),%rax
test   %rax,%rax
jne    131b <main+0x13b>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
lea    0xd2f(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1070 <fprintf@plt>
jmp    12f6 <main+0x116>
lea    0xd44(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcec(%rip),%rdi
call   10c0 <perror@plt>
jmp    12f6 <main+0x116>
mov    (%rax),%r14d
mov    %r14d,0x14(%rsp)
mov    %rbx,%rdi
call   10f0 <freeaddrinfo@plt>
mov    %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,%r13
lea    0x40(%rsp),%r14
lea    0xce9(%rip),%r12
mov    0x2c77(%rip),%r15
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
mov    %r13,%r8
lea    0x14(%rsp),%r9
call   10a0 <recvfrom@plt>
test   %eax,%eax
js     13ab <main+0x1cb>
mov    %eax,%ebx
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    0x14(%rsp),%r9d
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
mov    %r13,%r8
call   1050 <sendto@plt>
test   %rax,%rax
jns    1350 <main+0x170>
lea    0xc88(%rip),%rdi
jmp    1314 <main+0x134>
lea    0xc70(%rip),%rdi
jmp    1314 <main+0x134>

LLVM IR (-O0):
%struct.addrinfo = type { i32, %struct.addrinfo*, i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [49 x i8] c"usage: echo_server <local-address> <local-port>\0A\00"
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.1 = [12 x i8] c"getaddrinfo\00"
@stderr = global i32 0
@.str.2 = [22 x i8] c"Can't bind to: %s %s\0A\00"
@.str.3 = [9 x i8] c"recvfrom\00"
@.str.4 = [3 x i8] c"%s\00"
@stdout = global i32 0
@.str.5 = [7 x i8] c"sendto\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 i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.sockaddr*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 3
br i1 %18, label %19, label %26
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %9
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
store i8* %25, i8** %10
br label %28
26: ; preds = %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %123
28: ; preds = %19
%29 = call i32 @bzero(%struct.addrinfo* %6, i32 40)
%30 = load i32, i32* @AI_PASSIVE
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 6
store i32 %30, i32* %31
%32 = load i32, i32* @AF_UNSPEC
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 5
store i32 %32, i32* %33
%34 = load i32, i32* @SOCK_DGRAM
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 4
store i32 %34, i32* %35
%36 = load i32, i32* @IPPROTO_UDP
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 3
store i32 %36, i32* %37
%38 = load i8*, i8** %9
%39 = load i8*, i8** %10
%40 = call i32 @getaddrinfo(i8* %38, i8* %39, %struct.addrinfo* %6, %struct.addrinfo** %7)
store i32 %40, i32* %14
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %28
%43 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %123
44: ; preds = %28
%45 = load %struct.addrinfo*, %struct.addrinfo** %7
store %struct.addrinfo* %45, %struct.addrinfo** %8
br label %46
46: ; preds = %79, %44
%47 = load %struct.addrinfo*, %struct.addrinfo** %7
%48 = icmp ne %struct.addrinfo* %47, null
br i1 %48, label %49, label %83
49: ; preds = %46
%50 = load %struct.addrinfo*, %struct.addrinfo** %7
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %50, i32 0, i32 5
%52 = load i32, i32* %51
%53 = load %struct.addrinfo*, %struct.addrinfo** %7
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %53, i32 0, i32 4
%55 = load i32, i32* %54
%56 = load %struct.addrinfo*, %struct.addrinfo** %7
%57 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %56, i32 0, i32 3
%58 = load i32, i32* %57
%59 = call i32 @socket(i32 %52, i32 %55, i32 %58)
store i32 %59, i32* %12
%60 = load i32, i32* %12
%61 = icmp sge i32 %60, 0
br i1 %61, label %62, label %73
62: ; preds = %49
%63 = load i32, i32* %12
%64 = load %struct.addrinfo*, %struct.addrinfo** %7
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i32 0, i32 2
%66 = load i32, i32* %65
%67 = load %struct.addrinfo*, %struct.addrinfo** %7
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %67, i32 0, i32 0
%69 = load i32, i32* %68
%70 = call i32 @bind(i32 %63, i32 %66, i32 %69)
%71 = icmp ne i32 %70, 0
br i1 %71, label %73, label %72
72: ; preds = %62
br label %83
73: ; preds = %62, %49
%74 = load i32, i32* %12
%75 = icmp sge i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = load i32, i32* %12
%78 = call i32 @close(i32 %77)
br label %79
79: ; preds = %76, %73
%80 = load %struct.addrinfo*, %struct.addrinfo** %7
%81 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %80, i32 0, i32 1
%82 = load %struct.addrinfo*, %struct.addrinfo** %81
store %struct.addrinfo* %82, %struct.addrinfo** %7
br label %46
83: ; preds = %72, %46
%84 = load %struct.addrinfo*, %struct.addrinfo** %7
%85 = icmp ne %struct.addrinfo* %84, null
br i1 %85, label %91, label %86
86: ; preds = %83
%87 = load i32, i32* @stderr
%88 = load i8*, i8** %9
%89 = load i8*, i8** %10
%90 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %88, i8* %89)
store i32 -1, i32* %3
br label %123
91: ; preds = %83
%92 = load %struct.addrinfo*, %struct.addrinfo** %7
%93 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %92, i32 0, i32 0
%94 = load i32, i32* %93
store i32 %94, i32* %15
%95 = load %struct.addrinfo*, %struct.addrinfo** %8
%96 = call i32 @freeaddrinfo(%struct.addrinfo* %95)
%97 = load i32, i32* %15
%98 = call %struct.sockaddr* @malloc(i32 %97)
store %struct.sockaddr* %98, %struct.sockaddr** %16
br label %99
99: ; preds = %91, %122
%100 = load i32, i32* %12
%101 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%102 = load %struct.sockaddr*, %struct.sockaddr** %16
%103 = call i32 @recvfrom(i32 %100, i8* %101, i32 256, i32 0, %struct.sockaddr* %102, i32* %15)
store i32 %103, i32* %13
%104 = load i32, i32* %13
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %99
%107 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %123
108: ; preds = %99
%109 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %109)
%111 = load i32, i32* @stdout
%112 = call i32 @fflush(i32 %111)
%113 = load i32, i32* %12
%114 = bitcast [256 x i8]* %11 to i8**
%115 = load i32, i32* %13
%116 = load %struct.sockaddr*, %struct.sockaddr** %16
%117 = load i32, i32* %15
%118 = call i64 @sendto(i32 %113, i8** %114, i32 %115, i32 0, %struct.sockaddr* %116, i32 %117)
%119 = icmp slt i64 %118, 0
br i1 %119, label %120, label %122
120: ; preds = %108
%121 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %123
122: ; preds = %108
br label %99
123: ; preds = %120, %106, %86, %42, %26
%124 = load i32, i32* %3
ret i32 %124
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, %struct.addrinfo*, i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AI_PASSIVE = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_DGRAM = global i32 0
@IPPROTO_UDP = global i32 0
@.str.1 = [12 x i8] c"getaddrinfo\00"
@stderr = global i32 0
@.str.2 = [22 x i8] c"Can't bind to: %s %s\0A\00"
@.str.3 = [9 x i8] c"recvfrom\00"
@.str.4 = [3 x i8] c"%s\00"
@stdout = global i32 0
@.str.5 = [7 x i8] c"sendto\00"
@str = [48 x i8] c"usage: echo_server <local-address> <local-port>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = bitcast %struct.addrinfo* %3 to i8*
%8 = bitcast %struct.addrinfo** %4 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 3
br i1 %11, label %12, label %28
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @bzero(%struct.addrinfo* %3, i32 40)
%18 = load i32, i32* @AI_PASSIVE
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 6
store i32 %18, i32* %19
%20 = load i32, i32* @AF_UNSPEC
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 5
store i32 %20, i32* %21
%22 = load i32, i32* @SOCK_DGRAM
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %22, i32* %23
%24 = load i32, i32* @IPPROTO_UDP
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %24, i32* %25
%26 = call i32 @getaddrinfo(i8* %14, i8* %16, %struct.addrinfo* %3, %struct.addrinfo** %4)
%27 = icmp eq i32 %26, 0
br i1 %27, label %32, label %30
28: ; preds = %2
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %86
30: ; preds = %12
%31 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %86
32: ; preds = %12
%33 = load %struct.addrinfo*, %struct.addrinfo** %4
%34 = icmp eq %struct.addrinfo* %33, null
br i1 %34, label %63, label %35
35: ; preds = %32, %55
%36 = phi %struct.addrinfo* [ %58, %55 ], [ %33, %32 ]
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 5
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 4
%40 = load i32, i32* %39
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 3
%42 = load i32, i32* %41
%43 = call i32 @socket(i32 %38, i32 %40, i32 %42)
%44 = icmp sgt i32 %43, -1
br i1 %44, label %45, label %55
45: ; preds = %35
%46 = load %struct.addrinfo*, %struct.addrinfo** %4
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %46, i64 0, i32 2
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %46, i64 0, i32 0
%50 = load i32, i32* %49
%51 = call i32 @bind(i32 %43, i32 %48, i32 %50)
%52 = icmp eq i32 %51, 0
br i1 %52, label %60, label %53
53: ; preds = %45
%54 = call i32 @close(i32 %43)
br label %55
55: ; preds = %35, %53
%56 = load %struct.addrinfo*, %struct.addrinfo** %4
%57 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %56, i64 0, i32 1
%58 = load %struct.addrinfo*, %struct.addrinfo** %57
store %struct.addrinfo* %58, %struct.addrinfo** %4
%59 = icmp eq %struct.addrinfo* %58, null
br i1 %59, label %63, label %35
60: ; preds = %45
%61 = load %struct.addrinfo*, %struct.addrinfo** %4
%62 = icmp eq %struct.addrinfo* %61, null
br i1 %62, label %63, label %66
63: ; preds = %55, %32, %60
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %16)
br label %86
66: ; preds = %60
%67 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %61, i64 0, i32 0
%68 = load i32, i32* %67
store i32 %68, i32* %6
%69 = call i32 @freeaddrinfo(%struct.addrinfo* %33)
%70 = call %struct.sockaddr* @malloc(i32 %68)
%71 = bitcast [256 x i8]* %5 to i8**
br label %72
72: ; preds = %77, %66
%73 = call i32 @recvfrom(i32 %43, i8* %9, i32 256, i32 0, %struct.sockaddr* %70, i32* %6)
%74 = icmp slt i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %86
77: ; preds = %72
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%79 = load i32, i32* @stdout
%80 = call i32 @fflush(i32 %79)
%81 = load i32, i32* %6
%82 = call i64 @sendto(i32 %43, i8** %71, i32 %73, i32 0, %struct.sockaddr* %70, i32 %81)
%83 = icmp slt i64 %82, 0
br i1 %83, label %84, label %72
84: ; preds = %77
%85 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %86
86: ; preds = %84, %75, %63, %30, %28
ret i32 -1
}