#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 addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int getopt(int, char **, char *);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
char *optarg;
char optopt;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int sendto(int, char *, scalar_t__, int /*<<< orphan*/, int /*<<< orphan*/,
           int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  char *server_port = "1234";
  char *server_ip = "127.0.0.1";
  char *message = "Hello World (from udp)";
  int sockfd, rc;
  struct addrinfo hints, *server;
  int o;
  while ((o = getopt(argc, argv, "p:h:m:")) != -1) {
    switch (o) {
    case 'p':
      server_port = optarg;
      break;
    case 'h':
      server_ip = optarg;
      break;
    case 'm':
      message = optarg;
      break;
    case '?':
      if (optopt == 'p' || optopt == 'h') {
        fprintf(stderr, "Option %c requires an argument.\n", optopt);
      } else {
        fprintf(stderr, "Unknown argument: %c.\n", optopt);
      }
      break;
    }
  }
  printf("server_ip: %s   port: %s\n", server_ip, server_port);
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_DGRAM;
  if ((rc = getaddrinfo(server_ip, server_port, &hints, &server)) != 0) {
    perror(gai_strerror(rc));
    exit(-1);
  }
  sockfd = socket(server->ai_family, server->ai_socktype, server->ai_protocol);
  if (sockfd == -1) {
    perror("ERROR opening socket");
    exit(-1);
  }
  rc = sendto(sockfd, message, strlen(message) + 1, 0, server->ai_addr,
              server->ai_addrlen);
  if (rc < 0) {
    perror("ERROR on sendto");
    exit(-1);
  }
out:
  freeaddrinfo(server);
  close(sockfd);
  printf("Done.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe13(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe0d(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe0c(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe11(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
je     1319 <main+0x149>
mov    -0x54(%rbp),%eax
mov    %eax,-0x58(%rbp)
sub    $0x3f,%eax
je     12a6 <main+0xd6>
jmp    123a <main+0x6a>
mov    -0x58(%rbp),%eax
sub    $0x68,%eax
je     1280 <main+0xb0>
jmp    124b <main+0x7b>
mov    -0x58(%rbp),%eax
sub    $0x6d,%eax
je     1293 <main+0xc3>
jmp    125c <main+0x8c>
mov    -0x58(%rbp),%eax
sub    $0x70,%eax
jne    1314 <main+0x144>
jmp    126d <main+0x9d>
mov    0x2d84(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1314 <main+0x144>
mov    0x2d71(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1314 <main+0x144>
mov    0x2d5e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1314 <main+0x144>
mov    0x2d2b(%rip),%rax
movsbl (%rax),%eax
cmp    $0x70,%eax
je     12cc <main+0xfc>
mov    0x2d18(%rip),%rax
movsbl (%rax),%eax
cmp    $0x68,%eax
jne    12f0 <main+0x120>
mov    0x2ced(%rip),%rax
mov    (%rax),%edi
lea    0xd51(%rip),%rsi
mov    0x2cf5(%rip),%rax
movsbl (%rax),%edx
call   1090 <fprintf@plt>
jmp    130f <main+0x13f>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
lea    0xd4e(%rip),%rsi
mov    0x2cd1(%rip),%rax
movsbl (%rax),%edx
call   1090 <fprintf@plt>
jmp    1314 <main+0x144>
jmp    1207 <main+0x37>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
mov    0x2c9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x50(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
je     1392 <main+0x1c2>
mov    -0x30(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    %rax,%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x50(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x50(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x50(%rbp),%rax
mov    0x8(%rax),%edx
call   10f0 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    13cf <main+0x1ff>
lea    0xcbf(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x50(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x50(%rbp),%rax
mov    (%rax),%r9d
xor    %ecx,%ecx
call   1070 <sendto@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    142d <main+0x25d>
lea    0xc76(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
jmp    1432 <main+0x262>
mov    -0x50(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
lea    0xc5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe06(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xdff(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xdfd(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xe08(%rip),%r13
mov    0x2db3(%rip),%r12
mov    0x2d94(%rip),%r15
lea    0xdfa(%rip),%r14
jmp    124b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%edi
mov    %r14,%rsi
call   10a0 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10c0 <getopt@plt>
cmp    $0x67,%eax
jg     1290 <main+0xb0>
cmp    $0x3f,%eax
jne    12b0 <main+0xd0>
movzbl (%r12),%eax
movsbl %al,%edx
cmp    $0x70,%al
je     1240 <main+0x60>
cmp    $0x68,%al
je     1240 <main+0x60>
mov    (%r15),%edi
lea    0xdd2(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    124b <main+0x6b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x68,%eax
je     12b7 <main+0xd7>
cmp    $0x6d,%eax
je     12c8 <main+0xe8>
cmp    $0x70,%eax
jne    124b <main+0x6b>
mov    0x2d52(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
jmp    124b <main+0x6b>
cmp    $0xffffffff,%eax
jne    124b <main+0x6b>
jmp    12dc <main+0xfc>
mov    0x2d3a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
jmp    124b <main+0x6b>
mov    0x2d29(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
jmp    124b <main+0x6b>
lea    0xd82(%rip),%rdi
mov    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
mov    0x2ccb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2cae(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10e0 <getaddrinfo@plt>
test   %eax,%eax
jne    13af <main+0x1cf>
mov    (%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     13bb <main+0x1db>
mov    %eax,%ebx
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    (%rsp),%rax
mov    (%rax),%r9d
mov    0x4(%rax),%r8d
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
call   1080 <sendto@plt>
test   %eax,%eax
js     13c4 <main+0x1e4>
mov    (%rsp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    %ebx,%edi
call   1090 <close@plt>
lea    0xd0b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%edi
call   1060 <gai_strerror@plt>
mov    %rax,%rdi
jmp    13cb <main+0x1eb>
lea    0xcbd(%rip),%rdi
jmp    13cb <main+0x1eb>
lea    0xcc9(%rip),%rdi
call   10b0 <perror@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [5 x i8] c"1234\00"
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [23 x i8] c"Hello World (from udp)\00"
@.str.3 = [7 x i8] c"p:h:m:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.4 = [33 x i8] c"Option %c requires an argument.\0A\00"
@.str.5 = [23 x i8] c"Unknown argument: %c.\0A\00"
@.str.6 = [26 x i8] c"server_ip: %s port: %s\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.7 = [21 x i8] c"ERROR opening socket\00"
@.str.8 = [16 x i8] c"ERROR on sendto\00"
@.str.9 = [7 x i8] c"Done.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.addrinfo
%12 = alloca %struct.addrinfo*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8** %8
br label %14
14: ; preds = %44, %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @getopt(i32 %15, i8** %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 %17, i32* %13
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %45
19: ; preds = %14
%20 = load i32, i32* %13
switch i32 %20, label %44 [
i32 112, label %21
i32 104, label %23
i32 109, label %25
i32 63, label %27
]
21: ; preds = %19
%22 = load i8*, i8** @optarg
store i8* %22, i8** %6
br label %44
23: ; preds = %19
%24 = load i8*, i8** @optarg
store i8* %24, i8** %7
br label %44
25: ; preds = %19
%26 = load i8*, i8** @optarg
store i8* %26, i8** %8
br label %44
27: ; preds = %19
%28 = load i8, i8* @optopt
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 112
br i1 %30, label %35, label %31
31: ; preds = %27
%32 = load i8, i8* @optopt
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 104
br i1 %34, label %35, label %39
35: ; preds = %31, %27
%36 = load i32, i32* @stderr
%37 = load i8, i8* @optopt
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8 signext %37)
br label %43
39: ; preds = %31
%40 = load i32, i32* @stderr
%41 = load i8, i8* @optopt
%42 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8 signext %41)
br label %43
43: ; preds = %39, %35
br label %44
44: ; preds = %19, %43, %25, %23, %21
br label %14
45: ; preds = %14
%46 = load i8*, i8** %7
%47 = load i8*, i8** %6
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %46, i8* %47)
%49 = call i32 @memset(%struct.addrinfo* %11, i32 0, i32 20)
%50 = load i32, i32* @AF_INET
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 4
store i32 %50, i32* %51
%52 = load i32, i32* @SOCK_DGRAM
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 3
store i32 %52, i32* %53
%54 = load i8*, i8** %7
%55 = load i8*, i8** %6
%56 = call i32 @getaddrinfo(i8* %54, i8* %55, %struct.addrinfo* %11, %struct.addrinfo** %12)
store i32 %56, i32* %10
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %45
%59 = load i32, i32* %10
%60 = call i8* @gai_strerror(i32 %59)
%61 = call i32 @perror(i8* %60)
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %45
%64 = load %struct.addrinfo*, %struct.addrinfo** %12
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i32 0, i32 4
%66 = load i32, i32* %65
%67 = load %struct.addrinfo*, %struct.addrinfo** %12
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %67, i32 0, i32 3
%69 = load i32, i32* %68
%70 = load %struct.addrinfo*, %struct.addrinfo** %12
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i32 0, i32 2
%72 = load i32, i32* %71
%73 = call i32 @socket(i32 %66, i32 %69, i32 %72)
store i32 %73, i32* %9
%74 = load i32, i32* %9
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %79
76: ; preds = %63
%77 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%78 = call i32 @exit(i32 -1)
unreachable
79: ; preds = %63
%80 = load i32, i32* %9
%81 = load i8*, i8** %8
%82 = load i8*, i8** %8
%83 = call i64 @strlen(i8* %82)
%84 = add nsw i64 %83, 1
%85 = load %struct.addrinfo*, %struct.addrinfo** %12
%86 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %85, i32 0, i32 1
%87 = load i32, i32* %86
%88 = load %struct.addrinfo*, %struct.addrinfo** %12
%89 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %88, i32 0, i32 0
%90 = load i32, i32* %89
%91 = call i32 @sendto(i32 %80, i8* %81, i64 %84, i32 0, i32 %87, i32 %90)
store i32 %91, i32* %10
%92 = load i32, i32* %10
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %79
%95 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%96 = call i32 @exit(i32 -1)
unreachable
97: ; preds = %79
br label %98
98: ; preds = %97
%99 = load %struct.addrinfo*, %struct.addrinfo** %12
%100 = call i32 @freeaddrinfo(%struct.addrinfo* %99)
%101 = load i32, i32* %9
%102 = call i32 @close(i32 %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [5 x i8] c"1234\00"
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [23 x i8] c"Hello World (from udp)\00"
@.str.3 = [7 x i8] c"p:h:m:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.4 = [33 x i8] c"Option %c requires an argument.\0A\00"
@.str.5 = [23 x i8] c"Unknown argument: %c.\0A\00"
@.str.6 = [26 x i8] c"server_ip: %s port: %s\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.7 = [21 x i8] c"ERROR opening socket\00"
@.str.8 = [16 x i8] c"ERROR on sendto\00"
@str = [6 x i8] c"Done.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = bitcast %struct.addrinfo* %3 to i8*
%6 = bitcast %struct.addrinfo** %4 to i8*
br label %7
7: ; preds = %23, %2
%8 = phi i8* [ %24, %23 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), %2 ]
%9 = phi i8* [ %12, %23 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %2 ]
%10 = phi i8* [ %15, %23 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ]
br label %11
11: ; preds = %7, %21
%12 = phi i8* [ %9, %7 ], [ %22, %21 ]
%13 = phi i8* [ %10, %7 ], [ %15, %21 ]
br label %14
14: ; preds = %11, %19
%15 = phi i8* [ %13, %11 ], [ %20, %19 ]
br label %16
16: ; preds = %18, %14
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
switch i32 %17, label %18 [
i32 -1, label %33
i32 112, label %19
i32 104, label %21
i32 109, label %23
i32 63, label %25
]
18: ; preds = %16, %27, %30
br label %16
19: ; preds = %16
%20 = load i8*, i8** @optarg
br label %14
21: ; preds = %16
%22 = load i8*, i8** @optarg
br label %11
23: ; preds = %16
%24 = load i8*, i8** @optarg
br label %7
25: ; preds = %16
%26 = load i8, i8* @optopt
switch i8 %26, label %30 [
i8 112, label %27
i8 104, label %27
]
27: ; preds = %25, %25
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8 signext %26)
br label %18
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = tail call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8 signext %26)
br label %18
33: ; preds = %16
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %12, i8* %15)
%35 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 20)
%36 = load i32, i32* @AF_INET
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %36, i32* %37
%38 = load i32, i32* @SOCK_DGRAM
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %38, i32* %39
%40 = call i32 @getaddrinfo(i8* %12, i8* %15, %struct.addrinfo* %3, %struct.addrinfo** %4)
%41 = icmp eq i32 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %33
%43 = call i8* @gai_strerror(i32 %40)
%44 = call i32 @perror(i8* %43)
%45 = call i32 @exit(i32 -1)
unreachable
46: ; preds = %33
%47 = load %struct.addrinfo*, %struct.addrinfo** %4
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %47, i64 0, i32 4
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %47, i64 0, i32 3
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %47, i64 0, i32 2
%53 = load i32, i32* %52
%54 = call i32 @socket(i32 %49, i32 %51, i32 %53)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %59
56: ; preds = %46
%57 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%58 = call i32 @exit(i32 -1)
unreachable
59: ; preds = %46
%60 = call i64 @strlen(i8* dereferenceable(1) %8)
%61 = add nsw i64 %60, 1
%62 = load %struct.addrinfo*, %struct.addrinfo** %4
%63 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %62, i64 0, i32 1
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %62, i64 0, i32 0
%66 = load i32, i32* %65
%67 = call i32 @sendto(i32 %54, i8* %8, i64 %61, i32 0, i32 %64, i32 %66)
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %59
%70 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%71 = call i32 @exit(i32 -1)
unreachable
72: ; preds = %59
%73 = load %struct.addrinfo*, %struct.addrinfo** %4
%74 = call i32 @freeaddrinfo(%struct.addrinfo* %73)
%75 = call i32 @close(i32 %54)
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}