#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;
  int /*<<< orphan*/ ai_flags;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AI_PASSIVE;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    fprintf(stderr, "usage: %s <server-ip> <port>", argv[0]);
    return EXIT_FAILURE;
  }
  char buf[4096];
  int status, sock;
  struct addrinfo hints;
  memset(&hints, 0, sizeof(struct addrinfo));
  struct addrinfo *servinfo;
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  if ((status = getaddrinfo(argv[1], argv[2], &hints, &servinfo)) != 0) {
    fprintf(stderr, "getaddrinfo error: %s \n", gai_strerror(status));
    return EXIT_FAILURE;
  }
  if ((sock = socket(servinfo->ai_family, servinfo->ai_socktype,
                     servinfo->ai_protocol)) == -1) {
    fprintf(stderr, "Socket failed");
    return EXIT_FAILURE;
  }
  if (connect(sock, servinfo->ai_addr, servinfo->ai_addrlen) == -1) {
    fprintf(stderr, "Connect");
    return EXIT_FAILURE;
  }
  char msg[4096];
  fgets(msg, 4096, stdin);
  int bytes_received;
  fprintf(stdout, "Sending %s", msg);
  send(sock, msg, strlen(msg), 0);
  if ((bytes_received = recv(sock, buf, 4096, 0)) > 1) {
    buf[bytes_received] = '\0';
    fprintf(stdout, "Received %s", buf);
  }
  freeaddrinfo(servinfo);
  close(sock);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2060,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1212 <main+0x52>
mov    0x2dde(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe06(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145b <main+0x29b>
lea    -0x1030(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1020(%rbp)
mov    0x2d85(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1024(%rbp)
mov    0x2d9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x101c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x1030(%rbp),%rdx
lea    -0x1038(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0x1014(%rbp)
cmp    $0x0,%eax
je     12c6 <main+0x106>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2048(%rbp)
mov    -0x1014(%rbp),%edi
call   1060 <gai_strerror@plt>
mov    -0x2048(%rbp),%edi
mov    %rax,%rdx
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2cfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145b <main+0x29b>
mov    -0x1038(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x1038(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x1038(%rbp),%rax
mov    0x8(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x1018(%rbp)
cmp    $0xffffffff,%eax
jne    1320 <main+0x160>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
lea    0xd2d(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145b <main+0x29b>
mov    -0x1018(%rbp),%edi
mov    -0x1038(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x1038(%rbp),%rax
mov    (%rax),%edx
call   10b0 <connect@plt>
cmp    $0xffffffff,%eax
jne    136f <main+0x1af>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
lea    0xcec(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2c53(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    145b <main+0x29b>
lea    -0x2040(%rbp),%rdi
mov    0x2c5b(%rip),%rax
mov    (%rax),%edx
mov    $0x1000,%esi
call   1090 <fgets@plt>
mov    0x2c20(%rip),%rax
mov    (%rax),%edi
lea    -0x2040(%rbp),%rdx
lea    0xcab(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x1018(%rbp),%eax
mov    %eax,-0x2054(%rbp)
lea    -0x2040(%rbp),%rax
mov    %rax,-0x2050(%rbp)
lea    -0x2040(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2054(%rbp),%edi
mov    -0x2050(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    -0x1018(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x2044(%rbp)
cmp    $0x1,%eax
jle    1438 <main+0x278>
movslq -0x2044(%rbp),%rax
movb   $0x0,-0x1010(%rbp,%rax,1)
mov    0x2b8f(%rip),%rax
mov    (%rax),%edi
lea    -0x1010(%rbp),%rdx
lea    0xc25(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x1038(%rbp),%rdi
call   10d0 <freeaddrinfo@plt>
mov    -0x1018(%rbp),%edi
call   1080 <close@plt>
mov    0x2b52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x2020,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1244 <main+0x84>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    %rsp,%rcx
mov    %r14,%rdx
call   10c0 <getaddrinfo@plt>
test   %eax,%eax
je     1274 <main+0xb4>
mov    0x2d9b(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1060 <gai_strerror@plt>
lea    0xde0(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
jmp    1257 <main+0x97>
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xda9(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%eax
add    $0x2020,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    (%rsp),%rax
mov    0x10(%rax),%edi
mov    0x8(%rax),%edx
mov    0xc(%rax),%esi
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     134a <main+0x18a>
mov    %eax,%ebx
mov    (%rsp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%esi
mov    %ebx,%edi
call   10b0 <connect@plt>
cmp    $0xffffffff,%eax
je     135c <main+0x19c>
mov    0x2d27(%rip),%rax
mov    (%rax),%edx
lea    0x1020(%rsp),%r14
mov    %r14,%rdi
mov    $0x1000,%esi
call   1090 <fgets@plt>
mov    0x2ce1(%rip),%r15
mov    (%r15),%edi
lea    0xd72(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
lea    0x20(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x2,%eax
jl     132e <main+0x16e>
mov    %eax,%eax
movb   $0x0,0x20(%rsp,%rax,1)
mov    (%r15),%edi
lea    0xd34(%rip),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    (%rsp),%rdi
call   10d0 <freeaddrinfo@plt>
mov    %ebx,%edi
call   1080 <close@plt>
mov    0x2c63(%rip),%rax
jmp    1265 <main+0xa5>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
lea    0xcdb(%rip),%rsi
jmp    136c <main+0x1ac>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
lea    0xcd7(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    125e <main+0x9e>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s <server-ip> <port>\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.1 = [24 x i8] c"getaddrinfo error: %s \0A\00"
@.str.2 = [14 x i8] c"Socket failed\00"
@.str.3 = [8 x i8] c"Connect\00"
@stdin = global i32 0
@stdout = global i32 0
@.str.4 = [11 x i8] c"Sending %s\00"
@.str.5 = [12 x i8] c"Received %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.addrinfo
%10 = alloca %struct.addrinfo*
%11 = alloca [4096 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %3
br label %103
22: ; preds = %2
%23 = call i32 @memset(%struct.addrinfo* %9, i32 0, i32 24)
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 4
store i32 %24, i32* %25
%26 = load i32, i32* @SOCK_STREAM
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 3
store i32 %26, i32* %27
%28 = load i32, i32* @AI_PASSIVE
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 5
store i32 %28, i32* %29
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 @getaddrinfo(i8* %32, i8* %35, %struct.addrinfo* %9, %struct.addrinfo** %10)
store i32 %36, i32* %7
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %22
%39 = load i32, i32* @stderr
%40 = load i32, i32* %7
%41 = call i8* @gai_strerror(i32 %40)
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = load i32, i32* @EXIT_FAILURE
store i32 %43, i32* %3
br label %103
44: ; preds = %22
%45 = load %struct.addrinfo*, %struct.addrinfo** %10
%46 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %45, i32 0, i32 4
%47 = load i32, i32* %46
%48 = load %struct.addrinfo*, %struct.addrinfo** %10
%49 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %48, i32 0, i32 3
%50 = load i32, i32* %49
%51 = load %struct.addrinfo*, %struct.addrinfo** %10
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i32 0, i32 2
%53 = load i32, i32* %52
%54 = call i32 @socket(i32 %47, i32 %50, i32 %53)
store i32 %54, i32* %8
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %60
56: ; preds = %44
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%59 = load i32, i32* @EXIT_FAILURE
store i32 %59, i32* %3
br label %103
60: ; preds = %44
%61 = load i32, i32* %8
%62 = load %struct.addrinfo*, %struct.addrinfo** %10
%63 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %62, i32 0, i32 1
%64 = load i32, i32* %63
%65 = load %struct.addrinfo*, %struct.addrinfo** %10
%66 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %65, i32 0, i32 0
%67 = load i32, i32* %66
%68 = call i32 @connect(i32 %61, i32 %64, i32 %67)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %74
70: ; preds = %60
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%73 = load i32, i32* @EXIT_FAILURE
store i32 %73, i32* %3
br label %103
74: ; preds = %60
%75 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%76 = load i32, i32* @stdin
%77 = call i32 @fgets(i8* %75, i32 4096, i32 %76)
%78 = load i32, i32* @stdout
%79 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %79)
%81 = load i32, i32* %8
%82 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%83 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%84 = call i32 @strlen(i8* %83)
%85 = call i32 @send(i32 %81, i8* %82, i32 %84, i32 0)
%86 = load i32, i32* %8
%87 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%88 = call i32 @recv(i32 %86, i8* %87, i32 4096, i32 0)
store i32 %88, i32* %12
%89 = icmp sgt i32 %88, 1
br i1 %89, label %90, label %97
90: ; preds = %74
%91 = load i32, i32* %12
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %92
store i8 0, i8* %93
%94 = load i32, i32* @stdout
%95 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %95)
br label %97
97: ; preds = %90, %74
%98 = load %struct.addrinfo*, %struct.addrinfo** %10
%99 = call i32 @freeaddrinfo(%struct.addrinfo* %98)
%100 = load i32, i32* %8
%101 = call i32 @close(i32 %100)
%102 = load i32, i32* @EXIT_SUCCESS
store i32 %102, i32* %3
br label %103
103: ; preds = %97, %70, %56, %38, %15
%104 = load i32, i32* %3
ret i32 %104
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [29 x i8] c"usage: %s <server-ip> <port>\00"
@EXIT_FAILURE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str.1 = [24 x i8] c"getaddrinfo error: %s \0A\00"
@.str.2 = [14 x i8] c"Socket failed\00"
@.str.3 = [8 x i8] c"Connect\00"
@stdin = global i32 0
@stdout = global i32 0
@.str.4 = [11 x i8] c"Sending %s\00"
@.str.5 = [12 x i8] c"Received %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = alloca [4096 x i8]
%7 = icmp eq i32 %0, 3
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
br label %83
13: ; preds = %2
%14 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%15 = bitcast %struct.addrinfo* %4 to i8*
%16 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 24)
%17 = bitcast %struct.addrinfo** %5 to i8*
%18 = load i32, i32* @AF_INET
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i32 %18, i32* %19
%20 = load i32, i32* @SOCK_STREAM
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 3
store i32 %20, i32* %21
%22 = load i32, i32* @AI_PASSIVE
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 5
store i32 %22, i32* %23
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @getaddrinfo(i8* %25, i8* %27, %struct.addrinfo* %4, %struct.addrinfo** %5)
%29 = icmp eq i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %13
%31 = load i32, i32* @stderr
%32 = call i8* @gai_strerror(i32 %28)
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
br label %81
35: ; preds = %13
%36 = load %struct.addrinfo*, %struct.addrinfo** %5
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 4
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 3
%40 = load i32, i32* %39
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i64 0, i32 2
%42 = load i32, i32* %41
%43 = call i32 @socket(i32 %38, i32 %40, i32 %42)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %49
45: ; preds = %35
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%48 = load i32, i32* @EXIT_FAILURE
br label %81
49: ; preds = %35
%50 = load %struct.addrinfo*, %struct.addrinfo** %5
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %50, i64 0, i32 1
%52 = load i32, i32* %51
%53 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %50, i64 0, i32 0
%54 = load i32, i32* %53
%55 = call i32 @connect(i32 %43, i32 %52, i32 %54)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %61
57: ; preds = %49
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
br label %81
61: ; preds = %49
%62 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%63 = load i32, i32* @stdin
%64 = call i32 @fgets(i8* %62, i32 4096, i32 %63)
%65 = load i32, i32* @stdout
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %62)
%67 = call i32 @strlen(i8* %62)
%68 = call i32 @send(i32 %43, i8* %62, i32 %67, i32 0)
%69 = call i32 @recv(i32 %43, i8* %14, i32 4096, i32 0)
%70 = icmp sgt i32 %69, 1
br i1 %70, label %71, label %76
71: ; preds = %61
%72 = zext i32 %69 to i64
%73 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %72
store i8 0, i8* %73
%74 = load i32, i32* @stdout
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %14)
br label %76
76: ; preds = %71, %61
%77 = load %struct.addrinfo*, %struct.addrinfo** %5
%78 = call i32 @freeaddrinfo(%struct.addrinfo* %77)
%79 = call i32 @close(i32 %43)
%80 = load i32, i32* @EXIT_SUCCESS
br label %81
81: ; preds = %76, %57, %45, %30
%82 = phi i32 [ %34, %30 ], [ %48, %45 ], [ %60, %57 ], [ %80, %76 ]
br label %83
83: ; preds = %81, %8
%84 = phi i32 [ %12, %8 ], [ %82, %81 ]
ret i32 %84
}