#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);
scalar_t__ 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;
    }
  }
  message = "gr8 b8 m8, r8 8/8";
  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>
lea    0xd2a(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xd29(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x48(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1070 <memset@plt>
mov    0x2c7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c53(%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>
cmp    $0x0,%rax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x30(%rbp)
test   $0x1,%al
jne    13a6 <main+0x1c6>
jmp    13c0 <main+0x1e0>
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    13fd <main+0x21d>
lea    0xc98(%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    143d <main+0x25d>
lea    0xc75(%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    148c <main+0x2ac>
lea    0xc2f(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
jmp    1491 <main+0x2b1>
mov    -0x50(%rbp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
lea    0xc11(%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    0xe06(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xdff(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xdfd(%rip),%r12
mov    0x2dbf(%rip),%r15
mov    0x2da8(%rip),%r14
lea    0xdef(%rip),%r13
jmp    123e <main+0x5e>
nopl   0x0(%rax)
mov    (%r14),%edi
movsbl %al,%edx
mov    %r13,%rsi
call   1090 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   10b0 <getopt@plt>
cmp    $0x67,%eax
jg     1280 <main+0xa0>
cmp    $0x3f,%eax
jne    12a0 <main+0xc0>
movzbl (%r15),%eax
cmp    $0x70,%al
je     1230 <main+0x50>
cmp    $0x68,%al
je     1230 <main+0x50>
mov    (%r14),%edi
movsbl %al,%edx
lea    0xdc9(%rip),%rsi
call   1090 <fprintf@plt>
jmp    123e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x68,%eax
je     12a7 <main+0xc7>
cmp    $0x70,%eax
jne    123e <main+0x5e>
mov    0x2d67(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x18(%rsp)
jmp    123e <main+0x5e>
nopl   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
jne    123e <main+0x5e>
jmp    12b8 <main+0xd8>
mov    0x2d4a(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
jmp    123e <main+0x5e>
lea    0xda1(%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    0x2cef(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
mov    0x2cc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   10e0 <getaddrinfo@plt>
test   %rax,%rax
jne    1393 <main+0x1b3>
mov    0x8(%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     13a2 <main+0x1c2>
mov    %eax,%ebx
mov    0x8(%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %ebx,%edi
call   10d0 <connect@plt>
cmp    $0xffffffff,%eax
je     13ab <main+0x1cb>
lea    0xcfb(%rip),%rsi
mov    $0x12,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
call   1040 <send@plt>
test   %eax,%eax
js     13c8 <main+0x1e8>
mov    0x8(%rsp),%rdi
call   10f0 <freeaddrinfo@plt>
mov    %ebx,%edi
call   1080 <close@plt>
lea    0xd31(%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    $0x1,%edi
call   1060 <gai_strerror@plt>
mov    %rax,%rdi
jmp    13cf <main+0x1ef>
lea    0xcd1(%rip),%rdi
jmp    13cf <main+0x1ef>
lea    0xcdd(%rip),%rdi
call   10a0 <perror@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
lea    0xcd1(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <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 = [18 x i8] c"gr8 b8 m8, r8 8/8\00"
@.str.7 = [26 x i8] c"server_ip: %s port: %s\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.8 = [21 x i8] c"ERROR opening socket\00"
@.str.9 = [17 x i8] c"ERROR on connect\00"
@.str.10 = [14 x i8] c"ERROR on send\00"
@.str.11 = [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
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8** %8
%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.7, 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 i64 @getaddrinfo(i8* %54, i8* %55, %struct.addrinfo* %11, %struct.addrinfo** %12)
%57 = icmp ne i64 %56, 0
%58 = zext i1 %57 to i32
store i32 %58, i32* %10
br i1 %57, label %59, label %64
59: ; preds = %45
%60 = load i32, i32* %10
%61 = call i8* @gai_strerror(i32 %60)
%62 = call i32 @perror(i8* %61)
%63 = call i32 @exit(i32 -1)
unreachable
64: ; preds = %45
%65 = load %struct.addrinfo*, %struct.addrinfo** %12
%66 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %65, i32 0, i32 4
%67 = load i32, i32* %66
%68 = load %struct.addrinfo*, %struct.addrinfo** %12
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %68, i32 0, i32 3
%70 = load i32, i32* %69
%71 = load %struct.addrinfo*, %struct.addrinfo** %12
%72 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %71, i32 0, i32 2
%73 = load i32, i32* %72
%74 = call i32 @socket(i32 %67, i32 %70, i32 %73)
store i32 %74, i32* %9
%75 = load i32, i32* %9
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %80
77: ; preds = %64
%78 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%79 = call i32 @exit(i32 -1)
unreachable
80: ; preds = %64
%81 = load i32, i32* %9
%82 = load %struct.addrinfo*, %struct.addrinfo** %12
%83 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %82, i32 0, i32 1
%84 = load i32, i32* %83
%85 = load %struct.addrinfo*, %struct.addrinfo** %12
%86 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %85, i32 0, i32 0
%87 = load i32, i32* %86
%88 = call i32 @connect(i32 %81, i32 %84, i32 %87)
store i32 %88, i32* %10
%89 = load i32, i32* %10
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %96
91: ; preds = %80
%92 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%93 = load i32, i32* %9
%94 = call i32 @close(i32 %93)
%95 = call i32 @exit(i32 -1)
unreachable
96: ; preds = %80
%97 = load i32, i32* %9
%98 = load i8*, i8** %8
%99 = load i8*, i8** %8
%100 = call i64 @strlen(i8* %99)
%101 = add nsw i64 %100, 1
%102 = call i32 @send(i32 %97, i8* %98, i64 %101, i32 0)
store i32 %102, i32* %10
%103 = load i32, i32* %10
%104 = icmp slt i32 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %96
%106 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%107 = call i32 @exit(i32 -1)
unreachable
108: ; preds = %96
br label %109
109: ; preds = %108
%110 = load %struct.addrinfo*, %struct.addrinfo** %12
%111 = call i32 @freeaddrinfo(%struct.addrinfo* %110)
%112 = load i32, i32* %9
%113 = call i32 @close(i32 %112)
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, 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.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 = [18 x i8] c"gr8 b8 m8, r8 8/8\00"
@.str.7 = [26 x i8] c"server_ip: %s port: %s\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.8 = [21 x i8] c"ERROR opening socket\00"
@.str.9 = [17 x i8] c"ERROR on connect\00"
@.str.10 = [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 = %17, %2
%8 = phi i8* [ %18, %17 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %2 ]
%9 = phi i8* [ %11, %17 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %2 ]
br label %10
10: ; preds = %7, %15
%11 = phi i8* [ %9, %7 ], [ %16, %15 ]
br label %12
12: ; preds = %14, %10
%13 = 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 %13, label %14 [
i32 -1, label %27
i32 112, label %15
i32 104, label %17
i32 63, label %19
]
14: ; preds = %12, %21, %24
br label %12
15: ; preds = %12
%16 = load i8*, i8** @optarg
br label %10
17: ; preds = %12
%18 = load i8*, i8** @optarg
br label %7
19: ; preds = %12
%20 = load i8, i8* @optopt
switch i8 %20, label %24 [
i8 112, label %21
i8 104, label %21
]
21: ; preds = %19, %19
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8 signext %20)
br label %14
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = tail call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8 signext %20)
br label %14
27: ; preds = %12
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i8* %8, i8* %11)
%29 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 20)
%30 = load i32, i32* @AF_INET
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %30, i32* %31
%32 = load i32, i32* @SOCK_STREAM
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %32, i32* %33
%34 = call i64 @getaddrinfo(i8* %8, i8* %11, %struct.addrinfo* %3, %struct.addrinfo** %4)
%35 = icmp eq i64 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %27
%37 = call i8* @gai_strerror(i32 1)
%38 = call i32 @perror(i8* %37)
%39 = call i32 @exit(i32 -1)
unreachable
40: ; preds = %27
%41 = load %struct.addrinfo*, %struct.addrinfo** %4
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i64 0, i32 4
%43 = load i32, i32* %42
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i64 0, i32 3
%45 = load i32, i32* %44
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i64 0, i32 2
%47 = load i32, i32* %46
%48 = call i32 @socket(i32 %43, i32 %45, i32 %47)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %53
50: ; preds = %40
%51 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%52 = call i32 @exit(i32 -1)
unreachable
53: ; preds = %40
%54 = load %struct.addrinfo*, %struct.addrinfo** %4
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i64 0, i32 1
%56 = load i32, i32* %55
%57 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i64 0, i32 0
%58 = load i32, i32* %57
%59 = call i32 @connect(i32 %48, i32 %56, i32 %58)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %65
61: ; preds = %53
%62 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%63 = call i32 @close(i32 %48)
%64 = call i32 @exit(i32 -1)
unreachable
65: ; preds = %53
%66 = call i32 @send(i32 %48, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i64 18, i32 0)
%67 = icmp slt i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0))
%70 = call i32 @exit(i32 -1)
unreachable
71: ; preds = %65
%72 = load %struct.addrinfo*, %struct.addrinfo** %4
%73 = call i32 @freeaddrinfo(%struct.addrinfo* %72)
%74 = call i32 @close(i32 %48)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}