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

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int /*<<< orphan*/ getaddrinfo(char *, char *, struct addrinfo *,
                               struct addrinfo **);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                             int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char *argv[]) {
  int sockfd, numbytes;
  char buf[100000];
  struct addrinfo hints, *servinfo, *p;
  int rv;
  char s[INET6_ADDRSTRLEN];
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  getaddrinfo(argv[1], "3491", &hints, &servinfo);
  sockfd =
      socket(servinfo->ai_family, servinfo->ai_socktype, servinfo->ai_protocol);
  connect(sockfd, servinfo->ai_addr, servinfo->ai_addrlen);
  inet_ntop(servinfo->ai_family,
            get_in_addr((struct sockaddr *)servinfo->ai_addr), s, sizeof s);
  printf("client: connecting to %s\n", s);
  freeaddrinfo(servinfo);
  numbytes = recv(sockfd, buf, 100000 - 1, 0);
  buf[numbytes] = '\0';
  printf("client: received '%s'\n", buf);
  send(sockfd, argv[2], strlen(argv[2]), 0);
  char *msg = (char *)malloc(1001);
  for (;;) {
  get_in:
    printf("\n> ");
    fgets(msg, 1001, stdin);
    if ((strlen(msg) > 0) && (msg[strlen(msg) - 1] == '\n'))
      msg[strlen(msg) - 1] = '\0';
    if (send(sockfd, msg, strlen(msg), 0) == -1) {
      printf("error in send");
      goto get_in;
    }
    numbytes = recv(sockfd, buf, 100000 - 1, 0);
    buf[numbytes] = '\0';
    printf("%s", buf);
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x18750,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2df8(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x18728(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x186f8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x18720(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18700(%rbp)
lea    -0x186d8(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x186d0(%rbp)
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x186c4(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd9b(%rip),%rsi
lea    -0x186d8(%rbp),%rdx
lea    -0x186e0(%rbp),%rcx
call   10d0 <getaddrinfo@plt>
mov    -0x186e0(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x186e0(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x186e0(%rbp),%rax
mov    0x10(%rax),%edx
call   10f0 <socket@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x186e0(%rbp),%rax
mov    (%rax),%rsi
mov    -0x186e0(%rbp),%rax
mov    0xc(%rax),%edx
call   10c0 <connect@plt>
mov    -0x186e0(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x1872c(%rbp)
mov    -0x186e0(%rbp),%rax
mov    (%rax),%rdi
call   1050 <get_in_addr@plt>
mov    -0x1872c(%rbp),%edi
mov    -0x18720(%rbp),%rdx
mov    %eax,%esi
mov    -0x18728(%rbp),%rax
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x18720(%rbp),%rsi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x186e0(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
mov    -0x14(%rbp),%edi
lea    -0x186c0(%rbp),%rsi
mov    $0x1869f,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
movb   $0x0,-0x186c0(%rbp,%rax,1)
lea    -0x186c0(%rbp),%rsi
lea    0xcd5(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18714(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18710(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <strlen@plt>
mov    -0x18714(%rbp),%edi
mov    -0x18710(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    $0x3e9,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x18708(%rbp)
jmp    13a2 <main+0x1d2>
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x18708(%rbp),%rdi
mov    0x2c1a(%rip),%rax
mov    (%rax),%edx
mov    $0x3e9,%esi
call   10a0 <fgets@plt>
mov    -0x18708(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%eax
jle    1442 <main+0x272>
mov    -0x18708(%rbp),%rax
mov    %rax,-0x18738(%rbp)
mov    -0x18708(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x18738(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1442 <main+0x272>
mov    -0x18708(%rbp),%rax
mov    %rax,-0x18740(%rbp)
mov    -0x18708(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x18740(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1874c(%rbp)
mov    -0x18708(%rbp),%rax
mov    %rax,-0x18748(%rbp)
mov    -0x18708(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x1874c(%rbp),%edi
mov    -0x18748(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
jne    1497 <main+0x2c7>
lea    0xbaf(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    13a2 <main+0x1d2>
mov    -0x14(%rbp),%edi
lea    -0x186c0(%rbp),%rsi
mov    $0x1869f,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
movb   $0x0,-0x186c0(%rbp,%rax,1)
lea    -0x186c0(%rbp),%rsi
lea    0xb7e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    139d <main+0x1cd>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186c8,%rsp
mov    %rsi,%r15
mov    0x2dfa(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%rbx
mov    %r14,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x48(%rbp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x2dc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x8(%r15),%rdi
lea    0xdc5(%rip),%rsi
lea    -0x30(%rbp),%rcx
mov    %r12,%rdx
call   10d0 <getaddrinfo@plt>
mov    -0x30(%rbp),%rax
mov    0x14(%rax),%esi
mov    0x8(%rax),%edi
mov    0x10(%rax),%edx
call   10f0 <socket@plt>
mov    %eax,%r12d
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
mov    0xc(%rax),%edx
mov    %r12d,%edi
call   10c0 <connect@plt>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%r13d
mov    (%rax),%rdi
call   1050 <get_in_addr@plt>
mov    %r13d,%edi
mov    %eax,%esi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1030 <inet_ntop@plt>
lea    0xd70(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    -0x30(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
lea    -0x186f0(%rbp),%r14
mov    %r12d,%edi
mov    %r14,%rsi
mov    $0x1869f,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cltq
movb   $0x0,-0x186f0(%rbp,%rax,1)
lea    0xd4d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%r15),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
mov    $0x3e9,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbx
lea    0xd2b(%rip),%r15
mov    0x2cc6(%rip),%r13
jmp    136d <main+0x19d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
je     13c0 <main+0x1f0>
mov    %r12d,%edi
mov    %r14,%rsi
mov    $0x1869f,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cltq
movb   $0x0,-0x186f0(%rbp,%rax,1)
lea    0xce5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x3e9,%esi
call   10a0 <fgets@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    1320 <main+0x150>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1320 <main+0x150>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
jmp    1320 <main+0x150>
nopl   (%rax)
lea    0xc73(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    136d <main+0x19d>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str = [5 x i8] c"3491\00"
@.str.1 = [26 x i8] c"client: connecting to %s\0A\00"
@.str.2 = [23 x i8] c"client: received '%s'\0A\00"
@.str.3 = [4 x i8] c"\0A> \00"
@stdin = global i32 0
@.str.4 = [14 x i8] c"error in send\00"
@.str.5 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [100000 x i8]
%9 = alloca %struct.addrinfo
%10 = alloca %struct.addrinfo*
%11 = alloca %struct.addrinfo*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @INET6_ADDRSTRLEN
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %13
%19 = alloca i8, i64 %17
store i64 %17, i64* %14
%20 = call i32 @memset(%struct.addrinfo* %9, i32 0, i32 24)
%21 = load i32, i32* @AF_UNSPEC
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 1
store i32 %21, i32* %22
%23 = load i32, i32* @SOCK_STREAM
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 4
store i32 %23, i32* %24
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @getaddrinfo(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %9, %struct.addrinfo** %10)
%29 = load %struct.addrinfo*, %struct.addrinfo** %10
%30 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = load %struct.addrinfo*, %struct.addrinfo** %10
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %32, i32 0, i32 4
%34 = load i32, i32* %33
%35 = load %struct.addrinfo*, %struct.addrinfo** %10
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i32 0, i32 3
%37 = load i32, i32* %36
%38 = call i32 @socket(i32 %31, i32 %34, i32 %37)
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = load %struct.addrinfo*, %struct.addrinfo** %10
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i32 0, i32 0
%42 = load i64, i64* %41
%43 = load %struct.addrinfo*, %struct.addrinfo** %10
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %43, i32 0, i32 2
%45 = load i32, i32* %44
%46 = call i32 @connect(i32 %39, i64 %42, i32 %45)
%47 = load %struct.addrinfo*, %struct.addrinfo** %10
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %47, i32 0, i32 1
%49 = load i32, i32* %48
%50 = load %struct.addrinfo*, %struct.addrinfo** %10
%51 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %50, i32 0, i32 0
%52 = load i64, i64* %51
%53 = inttoptr i64 %52 to %struct.sockaddr*
%54 = call i32 @get_in_addr(%struct.sockaddr* %53)
%55 = trunc i64 %17 to i32
%56 = call i32 @inet_ntop(i32 %49, i32 %54, i8* %19, i32 %55)
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%58 = load %struct.addrinfo*, %struct.addrinfo** %10
%59 = call i32 @freeaddrinfo(%struct.addrinfo* %58)
%60 = load i32, i32* %6
%61 = getelementptr inbounds [100000 x i8], [100000 x i8]* %8, i64 0, i64 0
%62 = call i32 @recv(i32 %60, i8* %61, i32 99999, i32 0)
store i32 %62, i32* %7
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [100000 x i8], [100000 x i8]* %8, i64 0, i64 %64
store i8 0, i8* %65
%66 = getelementptr inbounds [100000 x i8], [100000 x i8]* %8, i64 0, i64 0
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %66)
%68 = load i32, i32* %6
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 2
%71 = load i8*, i8** %70
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 2
%74 = load i8*, i8** %73
%75 = call i32 @strlen(i8* %74)
%76 = call i32 @send(i32 %68, i8* %71, i32 %75, i32 0)
%77 = call i64 @malloc(i32 1001)
%78 = inttoptr i64 %77 to i8*
store i8* %78, i8** %15
br label %79
79: ; preds = %114, %2
br label %80
80: ; preds = %112, %79
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%82 = load i8*, i8** %15
%83 = load i32, i32* @stdin
%84 = call i32 @fgets(i8* %82, i32 1001, i32 %83)
%85 = load i8*, i8** %15
%86 = call i32 @strlen(i8* %85)
%87 = icmp sgt i32 %86, 0
br i1 %87, label %88, label %105
88: ; preds = %80
%89 = load i8*, i8** %15
%90 = load i8*, i8** %15
%91 = call i32 @strlen(i8* %90)
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %89, i64 %93
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp eq i32 %96, 10
br i1 %97, label %98, label %105
98: ; preds = %88
%99 = load i8*, i8** %15
%100 = load i8*, i8** %15
%101 = call i32 @strlen(i8* %100)
%102 = sub nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %99, i64 %103
store i8 0, i8* %104
br label %105
105: ; preds = %98, %88, %80
%106 = load i32, i32* %6
%107 = load i8*, i8** %15
%108 = load i8*, i8** %15
%109 = call i32 @strlen(i8* %108)
%110 = call i32 @send(i32 %106, i8* %107, i32 %109, i32 0)
%111 = icmp eq i32 %110, -1
br i1 %111, label %112, label %114
112: ; preds = %105
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %80
114: ; preds = %105
%115 = load i32, i32* %6
%116 = getelementptr inbounds [100000 x i8], [100000 x i8]* %8, i64 0, i64 0
%117 = call i32 @recv(i32 %115, i8* %116, i32 99999, i32 0)
store i32 %117, i32* %7
%118 = load i32, i32* %7
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [100000 x i8], [100000 x i8]* %8, i64 0, i64 %119
store i8 0, i8* %120
%121 = getelementptr inbounds [100000 x i8], [100000 x i8]* %8, i64 0, i64 0
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %121)
br label %79
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str = [5 x i8] c"3491\00"
@.str.1 = [26 x i8] c"client: connecting to %s\0A\00"
@.str.2 = [23 x i8] c"client: received '%s'\0A\00"
@.str.3 = [4 x i8] c"\0A> \00"
@stdin = global i32 0
@.str.4 = [14 x i8] c"error in send\00"
@.str.5 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100000 x i8]
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.addrinfo* %4 to i8*
%8 = bitcast %struct.addrinfo** %5 to i8*
%9 = load i32, i32* @INET6_ADDRSTRLEN
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 24)
%13 = load i32, i32* @AF_UNSPEC
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 1
store i32 %13, i32* %14
%15 = load i32, i32* @SOCK_STREAM
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i32 %15, i32* %16
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @getaddrinfo(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %5)
%20 = load %struct.addrinfo*, %struct.addrinfo** %5
%21 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %20, i64 0, i32 1
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %20, i64 0, i32 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %20, i64 0, i32 3
%26 = load i32, i32* %25
%27 = call i32 @socket(i32 %22, i32 %24, i32 %26)
%28 = load %struct.addrinfo*, %struct.addrinfo** %5
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 0
%30 = load i64, i64* %29
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i64 0, i32 2
%32 = load i32, i32* %31
%33 = call i32 @connect(i32 %27, i64 %30, i32 %32)
%34 = load %struct.addrinfo*, %struct.addrinfo** %5
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 1
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %34, i64 0, i32 0
%38 = load i64, i64* %37
%39 = inttoptr i64 %38 to %struct.sockaddr*
%40 = call i32 @get_in_addr(%struct.sockaddr* %39)
%41 = call i32 @inet_ntop(i32 %36, i32 %40, i8* %11, i32 %9)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%43 = load %struct.addrinfo*, %struct.addrinfo** %5
%44 = call i32 @freeaddrinfo(%struct.addrinfo* %43)
%45 = call i32 @recv(i32 %27, i8* %6, i32 99999, i32 0)
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %46
store i8 0, i8* %47
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%49 = getelementptr inbounds i8*, i8** %1, i64 2
%50 = load i8*, i8** %49
%51 = call i32 @strlen(i8* %50)
%52 = call i32 @send(i32 %27, i8* %50, i32 %51, i32 0)
%53 = call i64 @malloc(i32 1001)
%54 = inttoptr i64 %53 to i8*
br label %55
55: ; preds = %79, %2
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%57 = load i32, i32* @stdin
%58 = call i32 @fgets(i8* %54, i32 1001, i32 %57)
%59 = call i32 @strlen(i8* %54)
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %73
61: ; preds = %55
%62 = call i32 @strlen(i8* %54)
%63 = add nsw i32 %62, -1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %54, i64 %64
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 10
br i1 %67, label %68, label %73
68: ; preds = %61
%69 = call i32 @strlen(i8* %54)
%70 = add nsw i32 %69, -1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %54, i64 %71
store i8 0, i8* %72
br label %73
73: ; preds = %68, %61, %55
%74 = call i32 @strlen(i8* %54)
%75 = call i32 @send(i32 %27, i8* %54, i32 %74, i32 0)
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %79
79: ; preds = %77, %80
br label %55
80: ; preds = %73
%81 = call i32 @recv(i32 %27, i8* %6, i32 99999, i32 0)
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %82
store i8 0, i8* %83
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %6)
br label %79
}