#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;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
};
typedef int /*<<< orphan*/ s;
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int /*<<< orphan*/ AI_PASSIVE;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int getaddrinfo(int /*<<< orphan*/ *, char *, struct addrinfo *,
                struct addrinfo **);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                             int);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sockfd, numbytes;
  char buf[100];
  struct addrinfo hints, *servinfo, *p;
  int status;
  char s[INET6_ADDRSTRLEN];
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  if ((status = getaddrinfo(NULL, "6000", &hints, &servinfo)) != 0) {
    printf("Server: getaddrinfo() error: %s\n", gai_strerror(status));
    exit(1);
  }
  for (p = servinfo; p != NULL; p = p->ai_next) {
    if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      printf("Client: Error creating Socket Descriptor\n");
      continue;
    }
    if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
      printf("Client: Error connecting to server\n");
      close(sockfd);
      continue;
    }
    break;
  }
  if (p == NULL) {
    printf("Client: Failed to connect to a server\n");
    return 2;
  }
  inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), s,
            sizeof(s));
  printf("Client: Connecting to %s\n", s);
  freeaddrinfo(servinfo);
  if ((numbytes = recv(sockfd, buf, 100 - 1, 0)) == -1) {
    printf("Client: Error receiving messages from server");
    exit(1);
  }
  buf[numbytes] = '\0';
  printf("Client: Received '%s' from server\n", buf);
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e08(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0xe8(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0xc8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xd0(%rbp)
lea    -0xa8(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1080 <memset@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    0x2d8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    0x2d93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xda0(%rip),%rsi
lea    -0xa8(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0xbc(%rbp)
cmp    $0x0,%eax
je     12a8 <main+0xe8>
mov    -0xbc(%rbp),%edi
call   1070 <gai_strerror@plt>
mov    %rax,%rsi
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0xb0(%rbp),%rax
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0xb8(%rbp)
je     1362 <main+0x1a2>
mov    -0xb8(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0xb8(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0xb8(%rbp),%rax
mov    0x10(%rax),%edx
call   10e0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1306 <main+0x146>
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    134b <main+0x18b>
mov    -0x14(%rbp),%edi
mov    -0xb8(%rbp),%rax
mov    (%rax),%rsi
mov    -0xb8(%rbp),%rax
mov    0xc(%rax),%edx
call   10b0 <connect@plt>
cmp    $0xffffffff,%eax
jne    1346 <main+0x186>
lea    0xd1e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
jmp    134b <main+0x18b>
jmp    1362 <main+0x1a2>
mov    -0xb8(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0xb8(%rbp)
jmp    12b6 <main+0xf6>
cmpq   $0x0,-0xb8(%rbp)
jne    1394 <main+0x1d4>
lea    0xcfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0xd4(%rbp)
jmp    145c <main+0x29c>
mov    -0xb8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xec(%rbp)
mov    -0xb8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <get_in_addr@plt>
mov    -0xec(%rbp),%edi
mov    -0xe0(%rbp),%rdx
mov    %eax,%esi
mov    -0xe8(%rbp),%rax
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0xe0(%rbp),%rsi
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xb0(%rbp),%rdi
call   10d0 <freeaddrinfo@plt>
mov    -0x14(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x63,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
jne    1428 <main+0x268>
lea    0xc9e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
movslq -0x18(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rsi
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xd4(%rbp)
mov    -0xc8(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %rsp,-0x30(%rbp)
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
mov    %rax,-0x40(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    -0x68(%rbp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1090 <memset@plt>
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2d9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
lea    0xdbc(%rip),%rsi
lea    -0x38(%rbp),%rcx
xor    %edi,%edi
mov    %rbx,%rdx
call   10d0 <getaddrinfo@plt>
test   %eax,%eax
jne    1374 <main+0x1a4>
mov    -0x38(%rbp),%r14
test   %r14,%r14
je     12cd <main+0xfd>
lea    0xe6f(%rip),%r12
lea    0xe45(%rip),%r13
jmp    1291 <main+0xc1>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1060 <puts@plt>
mov    0x18(%r14),%r14
test   %r14,%r14
je     12cd <main+0xfd>
mov    0x14(%r14),%esi
mov    0x8(%r14),%edi
mov    0x10(%r14),%edx
call   10f0 <socket@plt>
cmp    $0xffffffff,%eax
je     1280 <main+0xb0>
mov    %eax,%ebx
mov    (%r14),%rsi
mov    0xc(%r14),%edx
mov    %eax,%edi
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
jne    12e1 <main+0x111>
mov    %r13,%rdi
call   1060 <puts@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
jmp    1288 <main+0xb8>
lea    0xdbc(%rip),%rdi
call   1060 <puts@plt>
mov    $0x2,%r14d
jmp    135b <main+0x18b>
mov    0x8(%r14),%r12d
mov    (%r14),%rdi
call   1050 <get_in_addr@plt>
mov    %r12d,%edi
mov    %eax,%esi
mov    %r15,%rdx
mov    -0x40(%rbp),%rcx
call   1030 <inet_ntop@plt>
lea    0xd21(%rip),%rdi
xor    %r14d,%r14d
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x38(%rbp),%rdi
call   10e0 <freeaddrinfo@plt>
lea    -0xd0(%rbp),%rsi
mov    %ebx,%edi
mov    $0x63,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
je     1396 <main+0x1c6>
cltq
movb   $0x0,-0xd0(%rbp,%rax,1)
lea    0xd27(%rip),%rdi
lea    -0xd0(%rbp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%edi
call   1080 <gai_strerror@plt>
lea    0xc83(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xca3(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"6000\00"
@.str.1 = [33 x i8] c"Server: getaddrinfo() error: %s\0A\00"
@.str.2 = [42 x i8] c"Client: Error creating Socket Descriptor\0A\00"
@.str.3 = [36 x i8] c"Client: Error connecting to server\0A\00"
@.str.4 = [39 x i8] c"Client: Failed to connect to a server\0A\00"
@.str.5 = [26 x i8] c"Client: Connecting to %s\0A\00"
@.str.6 = [45 x i8] c"Client: Error receiving messages from server\00"
@.str.7 = [35 x i8] c"Client: Received '%s' from server\0A\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 [100 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 i32
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 40)
%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 i32, i32* @AI_PASSIVE
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %9, i32 0, i32 6
store i32 %25, i32* %26
%27 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %9, %struct.addrinfo** %10)
store i32 %27, i32* %12
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %2
%30 = load i32, i32* %12
%31 = call i8* @gai_strerror(i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %2
%35 = load %struct.addrinfo*, %struct.addrinfo** %10
store %struct.addrinfo* %35, %struct.addrinfo** %11
br label %36
36: ; preds = %68, %34
%37 = load %struct.addrinfo*, %struct.addrinfo** %11
%38 = icmp ne %struct.addrinfo* %37, null
br i1 %38, label %39, label %72
39: ; preds = %36
%40 = load %struct.addrinfo*, %struct.addrinfo** %11
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i32 0, i32 1
%42 = load i32, i32* %41
%43 = load %struct.addrinfo*, %struct.addrinfo** %11
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %43, i32 0, i32 4
%45 = load i32, i32* %44
%46 = load %struct.addrinfo*, %struct.addrinfo** %11
%47 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %46, i32 0, i32 3
%48 = load i32, i32* %47
%49 = call i32 @socket(i32 %42, i32 %45, i32 %48)
store i32 %49, i32* %6
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %53
51: ; preds = %39
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %68
53: ; preds = %39
%54 = load i32, i32* %6
%55 = load %struct.addrinfo*, %struct.addrinfo** %11
%56 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %55, i32 0, i32 0
%57 = load i64, i64* %56
%58 = load %struct.addrinfo*, %struct.addrinfo** %11
%59 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %58, i32 0, i32 2
%60 = load i32, i32* %59
%61 = call i32 @connect(i32 %54, i64 %57, i32 %60)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %67
63: ; preds = %53
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%65 = load i32, i32* %6
%66 = call i32 @close(i32 %65)
br label %68
67: ; preds = %53
br label %72
68: ; preds = %63, %51
%69 = load %struct.addrinfo*, %struct.addrinfo** %11
%70 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %69, i32 0, i32 5
%71 = load %struct.addrinfo*, %struct.addrinfo** %70
store %struct.addrinfo* %71, %struct.addrinfo** %11
br label %36
72: ; preds = %67, %36
%73 = load %struct.addrinfo*, %struct.addrinfo** %11
%74 = icmp eq %struct.addrinfo* %73, null
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
store i32 2, i32* %3
store i32 1, i32* %15
br label %106
77: ; preds = %72
%78 = load %struct.addrinfo*, %struct.addrinfo** %11
%79 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %78, i32 0, i32 1
%80 = load i32, i32* %79
%81 = load %struct.addrinfo*, %struct.addrinfo** %11
%82 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %81, i32 0, i32 0
%83 = load i64, i64* %82
%84 = inttoptr i64 %83 to %struct.sockaddr*
%85 = call i32 @get_in_addr(%struct.sockaddr* %84)
%86 = trunc i64 %17 to i32
%87 = call i32 @inet_ntop(i32 %80, i32 %85, i8* %19, i32 %86)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%89 = load %struct.addrinfo*, %struct.addrinfo** %10
%90 = call i32 @freeaddrinfo(%struct.addrinfo* %89)
%91 = load i32, i32* %6
%92 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%93 = call i32 @recv(i32 %91, i8* %92, i32 99, i32 0)
store i32 %93, i32* %7
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %98
95: ; preds = %77
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %77
%99 = load i32, i32* %7
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 %100
store i8 0, i8* %101
%102 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %102)
%104 = load i32, i32* %6
%105 = call i32 @close(i32 %104)
store i32 0, i32* %3
store i32 1, i32* %15
br label %106
106: ; preds = %98, %75
%107 = load i8*, i8** %13
%108 = load i32, i32* %3
ret i32 %108
}

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [5 x i8] c"6000\00"
@.str.1 = [33 x i8] c"Server: getaddrinfo() error: %s\0A\00"
@.str.5 = [26 x i8] c"Client: Connecting to %s\0A\00"
@.str.6 = [45 x i8] c"Client: Error receiving messages from server\00"
@.str.7 = [35 x i8] c"Client: Received '%s' from server\0A\00"
@str = [38 x i8] c"Client: Failed to connect to a server\00"
@str.8 = [35 x i8] c"Client: Error connecting to server\00"
@str.9 = [41 x i8] c"Client: Error creating Socket Descriptor\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca %struct.addrinfo
%5 = alloca %struct.addrinfo*
%6 = getelementptr inbounds [100 x i8], [100 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 = tail call i8* @llvm.stacksave()
%12 = alloca i8, i64 %10
%13 = call i32 @memset(%struct.addrinfo* %4, i32 0, i32 40)
%14 = load i32, i32* @AF_UNSPEC
%15 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 1
store i32 %14, i32* %15
%16 = load i32, i32* @SOCK_STREAM
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 4
store i32 %16, i32* %17
%18 = load i32, i32* @AI_PASSIVE
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %4, i64 0, i32 6
store i32 %18, i32* %19
%20 = call i32 @getaddrinfo(i32* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.addrinfo* %4, %struct.addrinfo** %5)
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %2
%23 = load %struct.addrinfo*, %struct.addrinfo** %5
%24 = icmp eq %struct.addrinfo* %23, null
br i1 %24, label %55, label %29
25: ; preds = %2
%26 = call i8* @gai_strerror(i32 %20)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %22, %51
%30 = phi %struct.addrinfo* [ %53, %51 ], [ %23, %22 ]
%31 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 1
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 4
%34 = load i32, i32* %33
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 3
%36 = load i32, i32* %35
%37 = call i32 @socket(i32 %32, i32 %34, i32 %36)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %29
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.9, i64 0, i64 0))
br label %51
41: ; preds = %29
%42 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 0
%43 = load i64, i64* %42
%44 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 2
%45 = load i32, i32* %44
%46 = call i32 @connect(i32 %37, i64 %43, i32 %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %57
48: ; preds = %41
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
%50 = call i32 @close(i32 %37)
br label %51
51: ; preds = %48, %39
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 5
%53 = load %struct.addrinfo*, %struct.addrinfo** %52
%54 = icmp eq %struct.addrinfo* %53, null
br i1 %54, label %55, label %29
55: ; preds = %51, %22
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %78
57: ; preds = %41
%58 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 1
%59 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %30, i64 0, i32 0
%60 = load i32, i32* %58
%61 = load i64, i64* %59
%62 = inttoptr i64 %61 to %struct.sockaddr*
%63 = call i32 @get_in_addr(%struct.sockaddr* %62)
%64 = call i32 @inet_ntop(i32 %60, i32 %63, i8* %12, i32 %9)
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %12)
%66 = load %struct.addrinfo*, %struct.addrinfo** %5
%67 = call i32 @freeaddrinfo(%struct.addrinfo* %66)
%68 = call i32 @recv(i32 %37, i8* %6, i32 99, i32 0)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %73
70: ; preds = %57
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %57
%74 = sext i32 %68 to i64
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %74
store i8 0, i8* %75
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %6)
%77 = call i32 @close(i32 %37)
br label %78
78: ; preds = %73, %55
%79 = phi i32 [ 2, %55 ], [ 0, %73 ]
ret i32 %79
}