#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_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
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 send(int, char *, scalar_t__, 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";
  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_STREAM;
  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 = connect(sockfd, server->ai_addr, server->ai_addrlen);
  if (rc == -1) {
    perror("ERROR on connect");
    close(sockfd);
    exit(-1);
  }
  rc = send(sockfd, message, strlen(message) + 1, 0);
  if (rc < 0) {
    perror("ERROR on send");
    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    0xe03(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xdfd(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xdfc(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf6(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
je     1329 <main+0x149>
mov    -0x54(%rbp),%eax
mov    %eax,-0x58(%rbp)
sub    $0x3f,%eax
je     12b6 <main+0xd6>
jmp    124a <main+0x6a>
mov    -0x58(%rbp),%eax
sub    $0x68,%eax
je     1290 <main+0xb0>
jmp    125b <main+0x7b>
mov    -0x58(%rbp),%eax
sub    $0x6d,%eax
je     12a3 <main+0xc3>
jmp    126c <main+0x8c>
mov    -0x58(%rbp),%eax
sub    $0x70,%eax
jne    1324 <main+0x144>
jmp    127d <main+0x9d>
mov    0x2d74(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1324 <main+0x144>
mov    0x2d61(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1324 <main+0x144>
mov    0x2d4e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1324 <main+0x144>
mov    0x2d1b(%rip),%rax
movsbl (%rax),%eax
cmp    $0x70,%eax
je     12dc <main+0xfc>
mov    0x2d08(%rip),%rax
movsbl (%rax),%eax
cmp    $0x68,%eax
jne    1300 <main+0x120>
mov    0x2ce5(%rip),%rax
mov    (%rax),%edi
lea    0xd36(%rip),%rsi
mov    0x2ce5(%rip),%rax
movsbl (%rax),%edx
call   1090 <fprintf@plt>
jmp    131f <main+0x13f>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edi
lea    0xd33(%rip),%rsi
mov    0x2cc1(%rip),%rax
movsbl (%rax),%edx
call   1090 <fprintf@plt>
jmp    1324 <main+0x144>
jmp    1217 <main+0x37>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
mov    0x2c8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c5e(%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   10e0 <getaddrinfo@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
je     13a2 <main+0x1c2>
mov    -0x30(%rbp),%edi
call   1060 <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   1100 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    13df <main+0x1ff>
lea    0xca4(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x2c(%rbp),%edi
mov    -0x50(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x50(%rbp),%rax
mov    (%rax),%edx
call   10d0 <connect@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    141f <main+0x23f>
lea    0xc81(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@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
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    146e <main+0x28e>
lea    0xc3b(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
jmp    1473 <main+0x293>
mov    -0x50(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
lea    0xc1d(%rip),%rdi
mov    $0x0,%al
call   1050 <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    0xdf6(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xdef(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xded(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xded(%rip),%r13
mov    0x2da3(%rip),%r12
mov    0x2d8c(%rip),%r15
lea    0xddf(%rip),%r14
jmp    125e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%edi
movsbl %al,%edx
mov    %r14,%rsi
call   10a0 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   10c0 <getopt@plt>
cmp    $0x67,%eax
jg     12a0 <main+0xb0>
cmp    $0x3f,%eax
jne    12c0 <main+0xd0>
movzbl (%r12),%eax
cmp    $0x70,%al
je     1250 <main+0x60>
cmp    $0x68,%al
je     1250 <main+0x60>
mov    (%r15),%edi
movsbl %al,%edx
lea    0xdb4(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    125e <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x68,%eax
je     12c7 <main+0xd7>
cmp    $0x6d,%eax
je     12d8 <main+0xe8>
cmp    $0x70,%eax
jne    125e <main+0x6e>
mov    0x2d42(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
jmp    125e <main+0x6e>
cmp    $0xffffffff,%eax
jne    125e <main+0x6e>
jmp    12ec <main+0xfc>
mov    0x2d2a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
jmp    125e <main+0x6e>
mov    0x2d19(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rsp)
jmp    125e <main+0x6e>
lea    0xd67(%rip),%rdi
mov    0x10(%rsp),%rbx
mov    %rbx,%rsi
mov    0x18(%rsp),%rbp
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1080 <memset@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2c8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10f0 <getaddrinfo@plt>
test   %eax,%eax
jne    13c9 <main+0x1d9>
mov    (%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   1110 <socket@plt>
cmp    $0xffffffff,%eax
je     13d5 <main+0x1e5>
mov    %eax,%ebx
mov    (%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %ebx,%edi
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
je     13de <main+0x1ee>
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
call   1050 <send@plt>
test   %eax,%eax
js     13fb <main+0x20b>
mov    (%rsp),%rdi
call   1100 <freeaddrinfo@plt>
mov    %ebx,%edi
call   1090 <close@plt>
lea    0xcf5(%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   1070 <gai_strerror@plt>
mov    %rax,%rdi
jmp    1402 <main+0x212>
lea    0xc98(%rip),%rdi
jmp    1402 <main+0x212>
lea    0xca4(%rip),%rdi
call   10b0 <perror@plt>
mov    %ebx,%edi
call   1090 <close@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    0xc98(%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 = [12 x i8] c"Hello World\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_STREAM = global i32 0
@.str.7 = [21 x i8] c"ERROR opening socket\00"
@.str.8 = [17 x i8] c"ERROR on connect\00"
@.str.9 = [14 x i8] c"ERROR on send\00"
@.str.10 = [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 ([12 x i8], [12 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_STREAM
%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 %struct.addrinfo*, %struct.addrinfo** %12
%82 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %81, i32 0, i32 1
%83 = load i32, i32* %82
%84 = load %struct.addrinfo*, %struct.addrinfo** %12
%85 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %84, i32 0, i32 0
%86 = load i32, i32* %85
%87 = call i32 @connect(i32 %80, i32 %83, i32 %86)
store i32 %87, i32* %10
%88 = load i32, i32* %10
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %95
90: ; preds = %79
%91 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%92 = load i32, i32* %9
%93 = call i32 @close(i32 %92)
%94 = call i32 @exit(i32 -1)
unreachable
95: ; preds = %79
%96 = load i32, i32* %9
%97 = load i8*, i8** %8
%98 = load i8*, i8** %8
%99 = call i64 @strlen(i8* %98)
%100 = add nsw i64 %99, 1
%101 = call i32 @send(i32 %96, i8* %97, i64 %100, i32 0)
store i32 %101, i32* %10
%102 = load i32, i32* %10
%103 = icmp slt i32 %102, 0
br i1 %103, label %104, label %107
104: ; preds = %95
%105 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%106 = call i32 @exit(i32 -1)
unreachable
107: ; preds = %95
br label %108
108: ; preds = %107
%109 = load %struct.addrinfo*, %struct.addrinfo** %12
%110 = call i32 @freeaddrinfo(%struct.addrinfo* %109)
%111 = load i32, i32* %9
%112 = call i32 @close(i32 %111)
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, 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 = [12 x i8] c"Hello World\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_STREAM = global i32 0
@.str.7 = [21 x i8] c"ERROR opening socket\00"
@.str.8 = [17 x i8] c"ERROR on connect\00"
@.str.9 = [14 x i8] c"ERROR on send\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 ([12 x i8], [12 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_STREAM
%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 = load %struct.addrinfo*, %struct.addrinfo** %4
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i64 0, i32 1
%62 = load i32, i32* %61
%63 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %60, i64 0, i32 0
%64 = load i32, i32* %63
%65 = call i32 @connect(i32 %54, i32 %62, i32 %64)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %71
67: ; preds = %59
%68 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%69 = call i32 @close(i32 %54)
%70 = call i32 @exit(i32 -1)
unreachable
71: ; preds = %59
%72 = call i64 @strlen(i8* dereferenceable(1) %8)
%73 = add nsw i64 %72, 1
%74 = call i32 @send(i32 %54, i8* %8, i64 %73, i32 0)
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
%78 = call i32 @exit(i32 -1)
unreachable
79: ; preds = %71
%80 = load %struct.addrinfo*, %struct.addrinfo** %4
%81 = call i32 @freeaddrinfo(%struct.addrinfo* %80)
%82 = call i32 @close(i32 %54)
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}