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

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ die(char *, int, struct addrinfo *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(void) {
  struct addrinfo hints, *res;
  struct sockaddr_in *tmp;
  int sd, bytes, error;
  char buf[1024];
  char msg[1024];
  strncpy(msg,
          "GET / HTTP/1.1\r\nHost: localhost:6301\r\nUser-Agent: cClient\r\n",
          1024);
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  if ((error = getaddrinfo("127.0.0.1", "6301", &hints, &res)) != 0) {
    fprintf(stderr, "getaddrinfo() error: %s\n", gai_strerror(error));
    return 2;
  }
  if ((sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1)
    die("socket() error", 0, res);
  if (connect(sd, res->ai_addr, res->ai_addrlen) == -1)
    die("connect() error", sd, res);
  tmp = (struct sockaddr_in *)res->ai_addr;
  printf("Client has received connection from (%s)\n",
         inet_ntoa(tmp->sin_addr));
  freeaddrinfo(res);
  if (send(sd, msg, strlen(msg), 0) == -1)
    die("send() error", sd, NULL);
  if ((bytes = recv(sd, buf, 1024 - 1, 0)) == -1)
    die("recv() error", sd, NULL);
  else
    buf[bytes] = '\0';
  printf("Received (%i) bytes:\n%s", bytes, buf);
  close(sd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x840(%rbp),%rdi
lea    0xdf0(%rip),%rsi
mov    $0x400,%edx
call   1040 <strncpy@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10a0 <memset@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
lea    0xdf3(%rip),%rdi
lea    0xdf6(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
je     12a1 <main+0xb1>
mov    0x2d68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x844(%rbp)
mov    -0x3c(%rbp),%edi
call   1090 <gai_strerror@plt>
mov    -0x844(%rbp),%edi
mov    %rax,%rdx
lea    0xdbb(%rip),%rsi
call   10c0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    13fd <main+0x20d>
mov    -0x28(%rbp),%rax
mov    0x14(%rax),%edi
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%esi
mov    -0x28(%rbp),%rax
mov    0xc(%rax),%edx
call   1110 <socket@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
jne    12d9 <main+0xe9>
mov    -0x28(%rbp),%rdx
lea    0xd92(%rip),%rdi
xor    %esi,%esi
call   10d0 <die@plt>
mov    -0x34(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%edx
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
jne    130b <main+0x11b>
mov    -0x34(%rbp),%esi
mov    -0x28(%rbp),%rdx
lea    0xd6d(%rip),%rdi
call   10d0 <die@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%edi
call   1050 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1100 <freeaddrinfo@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x854(%rbp)
lea    -0x840(%rbp),%rax
mov    %rax,-0x850(%rbp)
lea    -0x840(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x854(%rbp),%edi
mov    -0x850(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
jne    1390 <main+0x1a0>
mov    -0x34(%rbp),%esi
lea    0xd26(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
call   10d0 <die@plt>
mov    -0x34(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x38(%rbp)
cmp    $0xffffffff,%eax
jne    13ca <main+0x1da>
mov    -0x34(%rbp),%esi
lea    0xcfe(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
call   10d0 <die@plt>
jmp    13d6 <main+0x1e6>
movslq -0x38(%rbp),%rax
movb   $0x0,-0x440(%rbp,%rax,1)
mov    -0x38(%rbp),%esi
lea    -0x440(%rbp),%rdx
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x34(%rbp),%edi
call   10b0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x820,%rsp
lea    0xdfe(%rip),%rsi
lea    0x420(%rsp),%rdi
mov    $0x400,%edx
call   1040 <strncpy@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10a0 <memset@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2d94(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
lea    0xdf3(%rip),%rdi
lea    0xdf6(%rip),%rsi
mov    %rsp,%rcx
mov    %rbx,%rdx
call   10f0 <getaddrinfo@plt>
test   %eax,%eax
je     128a <main+0x9a>
mov    0x2d72(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1090 <gai_strerror@plt>
lea    0xdd5(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   10c0 <fprintf@plt>
mov    $0x2,%ebx
jmp    1392 <main+0x1a2>
mov    (%rsp),%rax
mov    0x14(%rax),%edi
mov    0xc(%rax),%edx
mov    0x10(%rax),%esi
call   1110 <socket@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
jne    12b6 <main+0xc6>
mov    (%rsp),%rdx
lea    0xdb5(%rip),%rdi
xor    %esi,%esi
call   10d0 <die@plt>
mov    (%rsp),%rax
mov    (%rax),%rsi
mov    0x8(%rax),%edx
mov    %r14d,%edi
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
jne    12e0 <main+0xf0>
mov    (%rsp),%rdx
lea    0xd9b(%rip),%rdi
mov    %r14d,%esi
call   10d0 <die@plt>
mov    (%rsp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1050 <inet_ntoa@plt>
lea    0xd8e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%rsp),%rdi
call   1100 <freeaddrinfo@plt>
lea    0x420(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
jne    133d <main+0x14d>
lea    0xd7a(%rip),%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   10d0 <die@plt>
lea    0x20(%rsp),%rsi
mov    %r14d,%edi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1362 <main+0x172>
movslq %ebp,%rax
movb   $0x0,0x20(%rsp,%rax,1)
jmp    1373 <main+0x183>
lea    0xd51(%rip),%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   10d0 <die@plt>
lea    0xd4d(%rip),%rdi
xor    %ebx,%ebx
lea    0x20(%rsp),%rdx
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
mov    %ebx,%eax
add    $0x820,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i32, i32 }
%struct.sockaddr_in = type { i32 }
@.str = [60 x i8] c"GET / HTTP/1.1\0D\0AHost: localhost:6301\0D\0AUser-Agent: cClient\0D\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [5 x i8] c"6301\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"getaddrinfo() error: %s\0A\00"
@.str.4 = [15 x i8] c"socket() error\00"
@.str.5 = [16 x i8] c"connect() error\00"
@.str.6 = [42 x i8] c"Client has received connection from (%s)\0A\00"
@.str.7 = [13 x i8] c"send() error\00"
@.str.8 = [13 x i8] c"recv() error\00"
@.str.9 = [24 x i8] c"Received (%i) bytes:\0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.addrinfo
%3 = alloca %struct.addrinfo*
%4 = alloca %struct.sockaddr_in*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
store i32 0, i32* %1
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%11 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 1024)
%12 = call i32 @memset(%struct.addrinfo* %2, i32 0, i32 24)
%13 = load i32, i32* @AF_UNSPEC
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 4
store i32 %13, i32* %14
%15 = load i32, i32* @SOCK_STREAM
%16 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i32 0, i32 3
store i32 %15, i32* %16
%17 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %2, %struct.addrinfo** %3)
store i32 %17, i32* %7
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %0
%20 = load i32, i32* @stderr
%21 = load i32, i32* %7
%22 = call i8* @gai_strerror(i32 %21)
%23 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %22)
store i32 2, i32* %1
br label %92
24: ; preds = %0
%25 = load %struct.addrinfo*, %struct.addrinfo** %3
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %25, i32 0, i32 4
%27 = load i32, i32* %26
%28 = load %struct.addrinfo*, %struct.addrinfo** %3
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %28, i32 0, i32 3
%30 = load i32, i32* %29
%31 = load %struct.addrinfo*, %struct.addrinfo** %3
%32 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %31, i32 0, i32 2
%33 = load i32, i32* %32
%34 = call i32 @socket(i32 %27, i32 %30, i32 %33)
store i32 %34, i32* %5
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %24
%37 = load %struct.addrinfo*, %struct.addrinfo** %3
%38 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 0, %struct.addrinfo* %37)
br label %39
39: ; preds = %36, %24
%40 = load i32, i32* %5
%41 = load %struct.addrinfo*, %struct.addrinfo** %3
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %41, i32 0, i32 0
%43 = load i64, i64* %42
%44 = load %struct.addrinfo*, %struct.addrinfo** %3
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %44, i32 0, i32 1
%46 = load i32, i32* %45
%47 = call i32 @connect(i32 %40, i64 %43, i32 %46)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %53
49: ; preds = %39
%50 = load i32, i32* %5
%51 = load %struct.addrinfo*, %struct.addrinfo** %3
%52 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %50, %struct.addrinfo* %51)
br label %53
53: ; preds = %49, %39
%54 = load %struct.addrinfo*, %struct.addrinfo** %3
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 0
%56 = load i64, i64* %55
%57 = inttoptr i64 %56 to %struct.sockaddr_in*
store %struct.sockaddr_in* %57, %struct.sockaddr_in** %4
%58 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %58, i32 0, i32 0
%60 = load i32, i32* %59
%61 = call i8* @inet_ntoa(i32 %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %61)
%63 = load %struct.addrinfo*, %struct.addrinfo** %3
%64 = call i32 @freeaddrinfo(%struct.addrinfo* %63)
%65 = load i32, i32* %5
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%68 = call i32 @strlen(i8* %67)
%69 = call i32 @send(i32 %65, i8* %66, i32 %68, i32 0)
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %74
71: ; preds = %53
%72 = load i32, i32* %5
%73 = call i32 @die(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %72, %struct.addrinfo* null)
br label %74
74: ; preds = %71, %53
%75 = load i32, i32* %5
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%77 = call i32 @recv(i32 %75, i8* %76, i32 1023, i32 0)
store i32 %77, i32* %6
%78 = icmp eq i32 %77, -1
br i1 %78, label %79, label %82
79: ; preds = %74
%80 = load i32, i32* %5
%81 = call i32 @die(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %80, %struct.addrinfo* null)
br label %86
82: ; preds = %74
%83 = load i32, i32* %6
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %84
store i8 0, i8* %85
br label %86
86: ; preds = %82, %79
%87 = load i32, i32* %6
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 %87, i8* %88)
%90 = load i32, i32* %5
%91 = call i32 @close(i32 %90)
store i32 0, i32* %1
br label %92
92: ; preds = %86, %19
%93 = load i32, i32* %1
ret i32 %93
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32 }
%struct.sockaddr_in = type { i32 }
@.str = [60 x i8] c"GET / HTTP/1.1\0D\0AHost: localhost:6301\0D\0AUser-Agent: cClient\0D\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [5 x i8] c"6301\00"
@stderr = global i32 0
@.str.3 = [25 x i8] c"getaddrinfo() error: %s\0A\00"
@.str.4 = [15 x i8] c"socket() error\00"
@.str.5 = [16 x i8] c"connect() error\00"
@.str.6 = [42 x i8] c"Client has received connection from (%s)\0A\00"
@.str.7 = [13 x i8] c"send() error\00"
@.str.8 = [13 x i8] c"recv() error\00"
@.str.9 = [24 x i8] c"Received (%i) bytes:\0A%s\00"
define i32 @main() {
%1 = alloca %struct.addrinfo
%2 = alloca %struct.addrinfo*
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = bitcast %struct.addrinfo* %1 to i8*
%6 = bitcast %struct.addrinfo** %2 to i8*
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = call i32 @strncpy(i8* %8, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 1024)
%10 = call i32 @memset(%struct.addrinfo* %1, i32 0, i32 24)
%11 = load i32, i32* @AF_UNSPEC
%12 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 4
store i32 %11, i32* %12
%13 = load i32, i32* @SOCK_STREAM
%14 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %1, i64 0, i32 3
store i32 %13, i32* %14
%15 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %1, %struct.addrinfo** %2)
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %0
%18 = load i32, i32* @stderr
%19 = call i8* @gai_strerror(i32 %15)
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %19)
br label %72
21: ; preds = %0
%22 = load %struct.addrinfo*, %struct.addrinfo** %2
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 3
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %22, i64 0, i32 2
%28 = load i32, i32* %27
%29 = call i32 @socket(i32 %24, i32 %26, i32 %28)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %34
31: ; preds = %21
%32 = load %struct.addrinfo*, %struct.addrinfo** %2
%33 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 0, %struct.addrinfo* %32)
br label %34
34: ; preds = %31, %21
%35 = load %struct.addrinfo*, %struct.addrinfo** %2
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i64 0, i32 0
%37 = load i64, i64* %36
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %35, i64 0, i32 1
%39 = load i32, i32* %38
%40 = call i32 @connect(i32 %29, i64 %37, i32 %39)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %45
42: ; preds = %34
%43 = load %struct.addrinfo*, %struct.addrinfo** %2
%44 = call i32 @die(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %29, %struct.addrinfo* %43)
br label %45
45: ; preds = %42, %34
%46 = load %struct.addrinfo*, %struct.addrinfo** %2
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %46, i64 0, i32 0
%48 = load i64, i64* %47
%49 = inttoptr i64 %48 to %struct.sockaddr_in*
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %49, i64 0, i32 0
%51 = load i32, i32* %50
%52 = call i8* @inet_ntoa(i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i8* %52)
%54 = load %struct.addrinfo*, %struct.addrinfo** %2
%55 = call i32 @freeaddrinfo(%struct.addrinfo* %54)
%56 = call i32 @strlen(i8* %8)
%57 = call i32 @send(i32 %29, i8* %8, i32 %56, i32 0)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %61
59: ; preds = %45
%60 = call i32 @die(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %29, %struct.addrinfo* null)
br label %61
61: ; preds = %59, %45
%62 = call i32 @recv(i32 %29, i8* %7, i32 1023, i32 0)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i32 @die(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %29, %struct.addrinfo* null)
br label %69
66: ; preds = %61
%67 = sext i32 %62 to i64
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %67
store i8 0, i8* %68
br label %69
69: ; preds = %66, %64
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0), i32 %62, i8* %7)
%71 = call i32 @close(i32 %29)
br label %72
72: ; preds = %69, %17
%73 = phi i32 [ 2, %17 ], [ 0, %69 ]
ret i32 %73
}