#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*/ free(char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
scalar_t__ getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int getopt(int, char **, char *);
char *marshal_msg(char *, char *, char *);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
char *optarg;
char optopt;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ read_get_msg(int);
int /*<<< orphan*/ send_msg(int, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *server_port = "80";
  char *server_ip = "google.com";
  int sockfd, rc, o;
  struct addrinfo hints, *server;
  char *cmd;
  char *key;
  char *value;
  char *temp;
  while ((o = getopt(argc, argv, "p:h:c:k:v:")) != -1) {
    switch (o) {
    case 'p':
      server_port = optarg;
      break;
    case 'h':
      server_ip = optarg;
      break;
    case 'c':
      cmd = optarg;
      break;
    case 'k':
      key = optarg;
      break;
    case 'v':
      value = 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;
    }
  }
  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);
  }
  temp = marshal_msg(cmd, key, value);
  send_msg(sockfd, temp);
  if (cmd[0] == 'g') {
    read_get_msg(sockfd);
  }
  free(temp);
out:
  freeaddrinfo(server);
  close(sockfd);
  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    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xec4(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     1336 <main+0x146>
mov    -0x2c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x70(%rbp)
sub    $0x37,%eax
ja     1331 <main+0x141>
mov    -0x70(%rbp),%rax
lea    0xda5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d8d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1331 <main+0x141>
mov    0x2d7a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1331 <main+0x141>
mov    0x2d67(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1331 <main+0x141>
mov    0x2d54(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    1331 <main+0x141>
mov    0x2d41(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
jmp    1331 <main+0x141>
mov    0x2d0e(%rip),%rax
movsbl (%rax),%eax
cmp    $0x70,%eax
je     12e9 <main+0xf9>
mov    0x2cfb(%rip),%rax
movsbl (%rax),%eax
cmp    $0x68,%eax
jne    130d <main+0x11d>
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
lea    0xe00(%rip),%rsi
mov    0x2cd8(%rip),%rax
movsbl (%rax),%edx
call   1080 <fprintf@plt>
jmp    132c <main+0x13c>
mov    0x2cb4(%rip),%rax
mov    (%rax),%edi
lea    0xdfd(%rip),%rsi
mov    0x2cb4(%rip),%rax
movsbl (%rax),%edx
call   1080 <fprintf@plt>
jmp    1331 <main+0x141>
jmp    121c <main+0x2c>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
mov    0x2c93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x28(%rbp)
test   $0x1,%al
jne    1392 <main+0x1a2>
jmp    13ac <main+0x1bc>
mov    -0x28(%rbp),%edi
call   1050 <gai_strerror@plt>
mov    %rax,%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x48(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%edx
call   1110 <socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    13e9 <main+0x1f9>
lea    0xd57(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x24(%rbp),%edi
mov    -0x48(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
call   10e0 <connect@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    1429 <main+0x239>
lea    0xd34(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x60(%rbp),%rdx
call   1090 <marshal_msg@plt>
mov    %rax,-0x68(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x68(%rbp),%rsi
call   10b0 <send_msg@plt>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x67,%eax
jne    1462 <main+0x272>
mov    -0x24(%rbp),%edi
call   1040 <read_get_msg@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
mov    -0x24(%rbp),%edi
call   1070 <close@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    $0x48,%rsp
mov    %rsi,%rbp
mov    %edi,%r14d
lea    0xed5(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xecc(%rip),%rbx
lea    0xed0(%rip),%r15
lea    0xddb(%rip),%r12
mov    0x2dcc(%rip),%r13
jmp    1240 <main+0x50>
mov    0x0(%r13),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
call   10c0 <getopt@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x37,%ecx
ja     12b7 <main+0xc7>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    0x2d72(%rip),%rax
movzbl (%rax),%eax
movsbl %al,%edx
cmp    $0x70,%al
je     1274 <main+0x84>
cmp    $0x68,%al
jne    12be <main+0xce>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1240 <main+0x50>
mov    0x0(%r13),%rax
mov    %rax,0x10(%rsp)
jmp    1240 <main+0x50>
mov    0x0(%r13),%rax
mov    %rax,0x28(%rsp)
jmp    1240 <main+0x50>
mov    0x0(%r13),%rax
mov    %rax,0x20(%rsp)
jmp    1240 <main+0x50>
mov    0x0(%r13),%rax
mov    %rax,0x18(%rsp)
jmp    1240 <main+0x50>
cmp    $0xffffffff,%eax
jne    1240 <main+0x50>
jmp    12d8 <main+0xe8>
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
call   1080 <fprintf@plt>
jmp    1240 <main+0x50>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
mov    0x2ced(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x40(%rsp)
mov    0x2cc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x3c(%rsp)
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
mov    %rbp,%rdx
call   10f0 <getaddrinfo@plt>
test   %rax,%rax
jne    13bb <main+0x1cb>
mov    0x8(%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   1110 <socket@plt>
cmp    $0xffffffff,%eax
je     13ca <main+0x1da>
mov    %eax,%r14d
mov    0x8(%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %r14d,%edi
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
je     13e0 <main+0x1f0>
mov    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rdx
call   1090 <marshal_msg@plt>
mov    %rax,%rbp
mov    %r14d,%edi
mov    %rax,%rsi
call   10b0 <send_msg@plt>
cmpb   $0x67,(%rbx)
jne    1390 <main+0x1a0>
mov    %r14d,%edi
call   1040 <read_get_msg@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1100 <freeaddrinfo@plt>
mov    %r14d,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1050 <gai_strerror@plt>
mov    %rax,%rdi
jmp    13d1 <main+0x1e1>
lea    0xd60(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>
lea    0xd5f(%rip),%rdi
call   10a0 <perror@plt>
mov    %r14d,%edi
call   1070 <close@plt>
mov    $0xffffffff,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"80\00"
@.str.1 = [11 x i8] c"google.com\00"
@.str.2 = [11 x i8] c"p:h:c:k:v:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.3 = [33 x i8] c"Option %c requires an argument.\0A\00"
@.str.4 = [23 x i8] c"Unknown argument: %c.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [21 x i8] c"ERROR opening socket\00"
@.str.6 = [17 x i8] c"ERROR on connect\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.addrinfo
%12 = alloca %struct.addrinfo*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %7
br label %17
17: ; preds = %51, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt(i32 %18, i8** %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
store i32 %20, i32* %10
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %52
22: ; preds = %17
%23 = load i32, i32* %10
switch i32 %23, label %51 [
i32 112, label %24
i32 104, label %26
i32 99, label %28
i32 107, label %30
i32 118, label %32
i32 63, label %34
]
24: ; preds = %22
%25 = load i8*, i8** @optarg
store i8* %25, i8** %6
br label %51
26: ; preds = %22
%27 = load i8*, i8** @optarg
store i8* %27, i8** %7
br label %51
28: ; preds = %22
%29 = load i8*, i8** @optarg
store i8* %29, i8** %13
br label %51
30: ; preds = %22
%31 = load i8*, i8** @optarg
store i8* %31, i8** %14
br label %51
32: ; preds = %22
%33 = load i8*, i8** @optarg
store i8* %33, i8** %15
br label %51
34: ; preds = %22
%35 = load i8, i8* @optopt
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 112
br i1 %37, label %42, label %38
38: ; preds = %34
%39 = load i8, i8* @optopt
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 104
br i1 %41, label %42, label %46
42: ; preds = %38, %34
%43 = load i32, i32* @stderr
%44 = load i8, i8* @optopt
%45 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8 signext %44)
br label %50
46: ; preds = %38
%47 = load i32, i32* @stderr
%48 = load i8, i8* @optopt
%49 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8 signext %48)
br label %50
50: ; preds = %46, %42
br label %51
51: ; preds = %22, %50, %32, %30, %28, %26, %24
br label %17
52: ; preds = %17
%53 = call i32 @memset(%struct.addrinfo* %11, i32 0, i32 20)
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 4
store i32 %54, i32* %55
%56 = load i32, i32* @SOCK_STREAM
%57 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 3
store i32 %56, i32* %57
%58 = load i8*, i8** %7
%59 = load i8*, i8** %6
%60 = call i64 @getaddrinfo(i8* %58, i8* %59, %struct.addrinfo* %11, %struct.addrinfo** %12)
%61 = icmp ne i64 %60, 0
%62 = zext i1 %61 to i32
store i32 %62, i32* %9
br i1 %61, label %63, label %68
63: ; preds = %52
%64 = load i32, i32* %9
%65 = call i8* @gai_strerror(i32 %64)
%66 = call i32 @perror(i8* %65)
%67 = call i32 @exit(i32 -1)
unreachable
68: ; preds = %52
%69 = load %struct.addrinfo*, %struct.addrinfo** %12
%70 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %69, i32 0, i32 4
%71 = load i32, i32* %70
%72 = load %struct.addrinfo*, %struct.addrinfo** %12
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %72, i32 0, i32 3
%74 = load i32, i32* %73
%75 = load %struct.addrinfo*, %struct.addrinfo** %12
%76 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %75, i32 0, i32 2
%77 = load i32, i32* %76
%78 = call i32 @socket(i32 %71, i32 %74, i32 %77)
store i32 %78, i32* %8
%79 = load i32, i32* %8
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %68
%82 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%83 = call i32 @exit(i32 -1)
unreachable
84: ; preds = %68
%85 = load i32, i32* %8
%86 = load %struct.addrinfo*, %struct.addrinfo** %12
%87 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %86, i32 0, i32 1
%88 = load i32, i32* %87
%89 = load %struct.addrinfo*, %struct.addrinfo** %12
%90 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %89, i32 0, i32 0
%91 = load i32, i32* %90
%92 = call i32 @connect(i32 %85, i32 %88, i32 %91)
store i32 %92, i32* %9
%93 = load i32, i32* %9
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %100
95: ; preds = %84
%96 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%97 = load i32, i32* %8
%98 = call i32 @close(i32 %97)
%99 = call i32 @exit(i32 -1)
unreachable
100: ; preds = %84
%101 = load i8*, i8** %13
%102 = load i8*, i8** %14
%103 = load i8*, i8** %15
%104 = call i8* @marshal_msg(i8* %101, i8* %102, i8* %103)
store i8* %104, i8** %16
%105 = load i32, i32* %8
%106 = load i8*, i8** %16
%107 = call i32 @send_msg(i32 %105, i8* %106)
%108 = load i8*, i8** %13
%109 = getelementptr inbounds i8, i8* %108, i64 0
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 103
br i1 %112, label %113, label %116
113: ; preds = %100
%114 = load i32, i32* %8
%115 = call i32 @read_get_msg(i32 %114)
br label %116
116: ; preds = %113, %100
%117 = load i8*, i8** %16
%118 = call i32 @free(i8* %117)
br label %119
119: ; preds = %116
%120 = load %struct.addrinfo*, %struct.addrinfo** %12
%121 = call i32 @freeaddrinfo(%struct.addrinfo* %120)
%122 = load i32, i32* %8
%123 = call i32 @close(i32 %122)
ret i32 0
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [3 x i8] c"80\00"
@.str.1 = [11 x i8] c"google.com\00"
@.str.2 = [11 x i8] c"p:h:c:k:v:\00"
@optarg = global i8* null
@optopt = global i8 0
@stderr = global i32 0
@.str.3 = [33 x i8] c"Option %c requires an argument.\0A\00"
@.str.4 = [23 x i8] c"Unknown argument: %c.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [21 x i8] c"ERROR opening socket\00"
@.str.6 = [17 x i8] c"ERROR on connect\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 = %14, %2
%8 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %15, %14 ]
%9 = phi i8* [ undef, %2 ], [ %16, %14 ]
%10 = phi i8* [ undef, %2 ], [ %17, %14 ]
%11 = phi i8* [ undef, %2 ], [ %18, %14 ]
%12 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %2 ], [ %19, %14 ]
%13 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
switch i32 %13, label %14 [
i32 -1, label %38
i32 112, label %20
i32 104, label %22
i32 99, label %24
i32 107, label %26
i32 118, label %28
i32 63, label %30
]
14: ; preds = %7, %32, %35, %28, %26, %24, %22, %20
%15 = phi i8* [ %8, %32 ], [ %8, %35 ], [ %8, %28 ], [ %8, %26 ], [ %8, %24 ], [ %23, %22 ], [ %8, %20 ], [ %8, %7 ]
%16 = phi i8* [ %9, %32 ], [ %9, %35 ], [ %9, %28 ], [ %9, %26 ], [ %25, %24 ], [ %9, %22 ], [ %9, %20 ], [ %9, %7 ]
%17 = phi i8* [ %10, %32 ], [ %10, %35 ], [ %10, %28 ], [ %27, %26 ], [ %10, %24 ], [ %10, %22 ], [ %10, %20 ], [ %10, %7 ]
%18 = phi i8* [ %11, %32 ], [ %11, %35 ], [ %29, %28 ], [ %11, %26 ], [ %11, %24 ], [ %11, %22 ], [ %11, %20 ], [ %11, %7 ]
%19 = phi i8* [ %12, %32 ], [ %12, %35 ], [ %12, %28 ], [ %12, %26 ], [ %12, %24 ], [ %12, %22 ], [ %21, %20 ], [ %12, %7 ]
br label %7
20: ; preds = %7
%21 = load i8*, i8** @optarg
br label %14
22: ; preds = %7
%23 = load i8*, i8** @optarg
br label %14
24: ; preds = %7
%25 = load i8*, i8** @optarg
br label %14
26: ; preds = %7
%27 = load i8*, i8** @optarg
br label %14
28: ; preds = %7
%29 = load i8*, i8** @optarg
br label %14
30: ; preds = %7
%31 = load i8, i8* @optopt
switch i8 %31, label %35 [
i8 112, label %32
i8 104, label %32
]
32: ; preds = %30, %30
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8 signext %31)
br label %14
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = tail call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8 signext %31)
br label %14
38: ; preds = %7
%39 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 20)
%40 = load i32, i32* @AF_INET
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %40, i32* %41
%42 = load i32, i32* @SOCK_STREAM
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %42, i32* %43
%44 = call i64 @getaddrinfo(i8* %8, i8* %12, %struct.addrinfo* %3, %struct.addrinfo** %4)
%45 = icmp eq i64 %44, 0
br i1 %45, label %50, label %46
46: ; preds = %38
%47 = call i8* @gai_strerror(i32 1)
%48 = call i32 @perror(i8* %47)
%49 = call i32 @exit(i32 -1)
unreachable
50: ; preds = %38
%51 = load %struct.addrinfo*, %struct.addrinfo** %4
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i64 0, i32 4
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i64 0, i32 3
%55 = load i32, i32* %54
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i64 0, i32 2
%57 = load i32, i32* %56
%58 = call i32 @socket(i32 %53, i32 %55, i32 %57)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %63
60: ; preds = %50
%61 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %50
%64 = load %struct.addrinfo*, %struct.addrinfo** %4
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i64 0, i32 1
%66 = load i32, i32* %65
%67 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i64 0, i32 0
%68 = load i32, i32* %67
%69 = call i32 @connect(i32 %58, i32 %66, i32 %68)
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %75
71: ; preds = %63
%72 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%73 = call i32 @close(i32 %58)
%74 = call i32 @exit(i32 -1)
unreachable
75: ; preds = %63
%76 = call i8* @marshal_msg(i8* %9, i8* %10, i8* %11)
%77 = call i32 @send_msg(i32 %58, i8* %76)
%78 = load i8, i8* %9
%79 = icmp eq i8 %78, 103
br i1 %79, label %80, label %82
80: ; preds = %75
%81 = call i32 @read_get_msg(i32 %58)
br label %82
82: ; preds = %80, %75
%83 = call i32 @free(i8* %76)
%84 = load %struct.addrinfo*, %struct.addrinfo** %4
%85 = call i32 @freeaddrinfo(%struct.addrinfo* %84)
%86 = call i32 @close(i32 %58)
ret i32 0
}