#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_addr;
  int /*<<< orphan*/ ai_addrlen;
  struct addrinfo *ai_next;
  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*/ bzero(struct addrinfo *, 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*/ memcpy(struct sockaddr *, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int sendto(int, char **, scalar_t__, int /*<<< orphan*/, struct sockaddr *,
           int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  struct addrinfo hints, *res, *ressave;
  char *host, *port, in_buf[32], out_buf[] = ".";
  int sockfd, size, status;
  socklen_t addrlen;
  struct sockaddr *serveraddr;
  if (argc == 3) {
    host = argv[1];
    port = argv[2];
  } else {
    printf("usage: echo_client <remote-host-name-ip> <remote-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)
      break;
    res = res->ai_next;
  }
  if (sockfd < 0) {
    fprintf(stderr, "Can't create socket for remote: %s %s\n", host, port);
    return -1;
  }
  addrlen = res->ai_addrlen;
  serveraddr = malloc(addrlen);
  memcpy(serveraddr, res->ai_addr, addrlen);
  freeaddrinfo(ressave);
  while (1) {
    size =
        sendto(sockfd, &out_buf, strlen(out_buf) + 1, 0, serveraddr, addrlen);
    if (size < 0) {
      perror("sendto");
      return -1;
    }
    size = recv(sockfd, in_buf, 32, 0);
    if (size < 0) {
      perror("recvfrom");
      return -1;
    }
    printf("%s", in_buf);
    fflush(stdout);
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe00(%rip),%ax
mov    %ax,-0x72(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    122b <main+0x4b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1245 <main+0x65>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1451 <main+0x271>
lea    -0x30(%rbp),%rdi
mov    $0x20,%esi
call   10c0 <bzero@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    %eax,-0x80(%rbp)
cmp    $0x0,%eax
je     12bc <main+0xdc>
lea    0xd8f(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1451 <main+0x271>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     130c <main+0x12c>
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%edi
mov    -0x38(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%edx
call   1100 <socket@plt>
mov    %eax,-0x78(%rbp)
cmpl   $0x0,-0x78(%rbp)
jl     12fb <main+0x11b>
jmp    130c <main+0x12c>
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    12c4 <main+0xe4>
cmpl   $0x0,-0x78(%rbp)
jge    133f <main+0x15f>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
lea    0xd18(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1451 <main+0x271>
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
mov    -0x84(%rbp),%edx
call   1080 <memcpy@plt>
mov    -0x40(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    -0x78(%rbp),%eax
mov    %eax,-0x9c(%rbp)
lea    -0x72(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x72(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x90(%rbp),%r8
mov    -0x84(%rbp),%r9d
xor    %ecx,%ecx
call   1060 <sendto@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    13ea <main+0x20a>
lea    0xc94(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1451 <main+0x271>
mov    -0x78(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    1422 <main+0x242>
lea    0xc63(%rip),%rdi
call   10b0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1451 <main+0x271>
lea    -0x70(%rbp),%rsi
lea    0xc50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2b85(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
jmp    137f <main+0x19f>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movw   $0x2e,0x6(%rsp)
cmp    $0x3,%edi
jne    12c2 <main+0xd2>
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%r14
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   10d0 <bzero@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    0x2d5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
lea    0x8(%rsp),%rcx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10e0 <getaddrinfo@plt>
test   %eax,%eax
jne    12e2 <main+0xf2>
mov    0x8(%rsp),%r12
test   %r12,%r12
je     12a5 <main+0xb5>
mov    %r12,%rax
mov    0x18(%rax),%edi
mov    0x10(%rax),%edx
mov    0x14(%rax),%esi
call   1110 <socket@plt>
mov    0x8(%rsp),%rbp
test   %eax,%eax
jns    12f0 <main+0x100>
mov    0x8(%rbp),%rax
mov    %rax,0x8(%rsp)
test   %rax,%rax
jne    1280 <main+0x90>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
lea    0xd57(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1080 <fprintf@plt>
jmp    12ce <main+0xde>
lea    0xd7d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd17(%rip),%rdi
call   10c0 <perror@plt>
jmp    12ce <main+0xde>
mov    %eax,%ebx
mov    0x4(%rbp),%r14d
mov    %r14d,%edi
call   10a0 <malloc@plt>
mov    %rax,%r15
mov    0x0(%rbp),%esi
mov    %rax,%rdi
mov    %r14d,%edx
call   1090 <memcpy@plt>
mov    %r12,%rdi
call   1100 <freeaddrinfo@plt>
lea    0x6(%rsp),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
mov    %r15,%r8
mov    %r14d,%r9d
call   1070 <sendto@plt>
test   %eax,%eax
js     13ab <main+0x1bb>
lea    0x30(%rsp),%r13
mov    0x2c76(%rip),%r12
lea    0x6(%rsp),%rbp
nop
mov    %ebx,%edi
mov    %r13,%rsi
mov    $0x20,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     13bc <main+0x1cc>
lea    0xcd7(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%r12),%edi
call   10b0 <fflush@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
mov    %r15,%r8
mov    %r14d,%r9d
call   1070 <sendto@plt>
test   %eax,%eax
jns    1350 <main+0x160>
lea    0xc81(%rip),%rdi
call   10c0 <perror@plt>
jmp    12ce <main+0xde>
lea    0xc77(%rip),%rdi
call   10c0 <perror@plt>
jmp    12ce <main+0xde>

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

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, %struct.addrinfo*, 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 = [39 x i8] c"Can't create socket for remote: %s %s\0A\00"
@.str.3 = [7 x i8] c"sendto\00"
@.str.4 = [9 x i8] c"recvfrom\00"
@.str.5 = [3 x i8] c"%s\00"
@stdout = global i32 0
@str = [55 x i8] c"usage: echo_client <remote-host-name-ip> <remote-port>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca [32 x i8]
%6 = alloca i16
%7 = bitcast %struct.addrinfo* %3 to i8*
%8 = bitcast %struct.addrinfo** %4 to i8*
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%10 = bitcast i16* %6 to i8*
store i16 46, i16* %6
%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 32)
%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 ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
br label %82
30: ; preds = %12
%31 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %82
32: ; preds = %12
%33 = load %struct.addrinfo*, %struct.addrinfo** %4
%34 = icmp eq %struct.addrinfo* %33, null
br i1 %34, label %50, label %35
35: ; preds = %32, %46
%36 = phi %struct.addrinfo* [ %48, %46 ], [ %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
%45 = load %struct.addrinfo*, %struct.addrinfo** %4
br i1 %44, label %53, label %46
46: ; preds = %35
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i64 0, i32 2
%48 = load %struct.addrinfo*, %struct.addrinfo** %47
store %struct.addrinfo* %48, %struct.addrinfo** %4
%49 = icmp eq %struct.addrinfo* %48, null
br i1 %49, label %50, label %35
50: ; preds = %46, %32
%51 = load i32, i32* @stderr
%52 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %16)
br label %82
53: ; preds = %35
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i64 0, i32 1
%55 = load i32, i32* %54
%56 = call %struct.sockaddr* @malloc(i32 %55)
%57 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i64 0, i32 0
%58 = load i32, i32* %57
%59 = call i32 @memcpy(%struct.sockaddr* %56, i32 %58, i32 %55)
%60 = call i32 @freeaddrinfo(%struct.addrinfo* %33)
%61 = bitcast i16* %6 to i8**
%62 = call i64 @strlen(i8* %10)
%63 = add nsw i64 %62, 1
%64 = call i32 @sendto(i32 %43, i8** %61, i64 %63, i32 0, %struct.sockaddr* %56, i32 %55)
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %73, %53
%67 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %82
68: ; preds = %53, %73
%69 = call i32 @recv(i32 %43, i8* %9, i32 32, i32 0)
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %82
73: ; preds = %68
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%75 = load i32, i32* @stdout
%76 = call i32 @fflush(i32 %75)
%77 = call i32 @sleep(i32 1)
%78 = call i64 @strlen(i8* %10)
%79 = add nsw i64 %78, 1
%80 = call i32 @sendto(i32 %43, i8** %61, i64 %79, i32 0, %struct.sockaddr* %56, i32 %55)
%81 = icmp slt i32 %80, 0
br i1 %81, label %66, label %68
82: ; preds = %71, %66, %50, %30, %28
ret i32 -1
}