#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;
};
typedef int /*<<< orphan*/ bufs;
typedef int /*<<< orphan*/ bufr;

/* Variables and functions */
int /*<<< orphan*/ AF_UNSPEC;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int connect(int, scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *gai_strerror(int);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int getaddrinfo(char *, 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*/ perror(char *);
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*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int sockfd, numbytes;
  char bufr[255];
  char bufs[255];
  struct addrinfo hints, *servinfo, *p;
  int rv;
  char s[INET6_ADDRSTRLEN];
  if (argc != 3) {
    fprintf(stderr, "usage: client hostname\n");
    exit(1);
  }
  memset(&hints, 0, sizeof hints);
  hints.ai_family = AF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  if ((rv = getaddrinfo(argv[1], argv[2], &hints, &servinfo)) != 0) {
    fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
    return 1;
  }
  for (p = servinfo; p != NULL; p = p->ai_next) {
    if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
      perror("client: socket");
      continue;
    }
    if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
      close(sockfd);
      perror("client: connect");
      continue;
    }
    break;
  }
  if (p == NULL) {
    fprintf(stderr, "client: failed to connect\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);
  printf("Please enter the message: ");
  bzero(bufs, 256);
  fgets(bufs, 255, stdin);
  if (send(sockfd, bufs, sizeof(bufs), 0) == -1) {
    perror("send");
  }
  if (recv(sockfd, bufr, sizeof(bufr), 0) == -1) {
    perror("send");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x290,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x280(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x260(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x278(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x268(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1280 <main+0x80>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
lea    0xd91(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x240(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x238(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x22c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x240(%rbp),%rdx
lea    -0x248(%rbp),%rcx
call   1110 <getaddrinfo@plt>
mov    %eax,-0x254(%rbp)
cmp    $0x0,%eax
je     132a <main+0x12a>
mov    0x2cde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x284(%rbp)
mov    -0x254(%rbp),%edi
call   1080 <gai_strerror@plt>
mov    -0x284(%rbp),%edi
mov    %rax,%rdx
lea    0xd0b(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x26c(%rbp)
jmp    150c <main+0x30c>
mov    -0x248(%rbp),%rax
mov    %rax,-0x250(%rbp)
cmpq   $0x0,-0x250(%rbp)
je     13e0 <main+0x1e0>
mov    -0x250(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x250(%rbp),%rax
mov    0x14(%rax),%esi
mov    -0x250(%rbp),%rax
mov    0x10(%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1386 <main+0x186>
lea    0xcad(%rip),%rdi
call   10d0 <perror@plt>
jmp    13c9 <main+0x1c9>
mov    -0x14(%rbp),%edi
mov    -0x250(%rbp),%rax
mov    (%rax),%rsi
mov    -0x250(%rbp),%rax
mov    0xc(%rax),%edx
call   1100 <connect@plt>
cmp    $0xffffffff,%eax
jne    13c4 <main+0x1c4>
mov    -0x14(%rbp),%edi
call   10a0 <close@plt>
lea    0xc7e(%rip),%rdi
call   10d0 <perror@plt>
jmp    13c9 <main+0x1c9>
jmp    13e0 <main+0x1e0>
mov    -0x250(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x250(%rbp)
jmp    1338 <main+0x138>
cmpq   $0x0,-0x250(%rbp)
jne    141b <main+0x21b>
mov    0x2bd3(%rip),%rax
mov    (%rax),%edi
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x26c(%rbp)
jmp    150c <main+0x30c>
mov    -0x250(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x288(%rbp)
mov    -0x250(%rbp),%rax
mov    (%rax),%rdi
call   1050 <get_in_addr@plt>
mov    -0x288(%rbp),%edi
mov    -0x278(%rbp),%rdx
mov    %eax,%esi
mov    -0x280(%rbp),%rax
mov    %eax,%ecx
call   1030 <inet_ntop@plt>
mov    -0x278(%rbp),%rsi
lea    0xbfe(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc0a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x220(%rbp),%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
lea    -0x220(%rbp),%rdi
mov    0x2b3f(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   10b0 <fgets@plt>
mov    -0x14(%rbp),%edi
lea    -0x220(%rbp),%rsi
mov    $0xff,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    14d0 <main+0x2d0>
lea    0xbcd(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x14(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0xff,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
jne    14fb <main+0x2fb>
lea    0xba2(%rip),%rdi
call   10d0 <perror@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x26c(%rbp)
mov    -0x260(%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    $0x238,%rsp
mov    %rsp,%r13
mov    0x2dca(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%r12
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
cmp    $0x3,%edi
jne    1405 <main+0x205>
mov    %rsi,%rbx
lea    -0x58(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1090 <memset@plt>
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
lea    -0x38(%rbp),%rcx
mov    %r15,%rdx
call   1110 <getaddrinfo@plt>
test   %eax,%eax
je     12af <main+0xaf>
mov    0x2d40(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1080 <gai_strerror@plt>
lea    0xd80(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%r14d
jmp    13d4 <main+0x1d4>
mov    %r13,-0x30(%rbp)
mov    -0x38(%rbp),%r13
test   %r13,%r13
je     1310 <main+0x110>
lea    0xd66(%rip),%rbx
mov    0x14(%r13),%esi
mov    0x8(%r13),%edi
mov    0x10(%r13),%edx
call   1120 <socket@plt>
mov    %rbx,%rdi
cmp    $0xffffffff,%eax
je     1302 <main+0x102>
mov    %eax,%r15d
mov    0x0(%r13),%rsi
mov    0xc(%r13),%edx
mov    %eax,%edi
call   1100 <connect@plt>
cmp    $0xffffffff,%eax
jne    1336 <main+0x136>
mov    %r15d,%edi
call   10a0 <close@plt>
lea    0xd36(%rip),%rdi
call   10d0 <perror@plt>
mov    0x18(%r13),%r13
test   %r13,%r13
jne    12c3 <main+0xc3>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
lea    0xd28(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x2,%r14d
mov    -0x30(%rbp),%r13
jmp    13d4 <main+0x1d4>
mov    0x8(%r13),%ebx
mov    0x0(%r13),%rdi
call   1050 <get_in_addr@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %r12,%rdx
mov    %r14d,%ecx
call   1030 <inet_ntop@plt>
lea    0xd0a(%rip),%rdi
xor    %r14d,%r14d
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd10(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    -0x160(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10e0 <bzero@plt>
mov    0x2c49(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   10b0 <fgets@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0xff,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
je     13e9 <main+0x1e9>
lea    -0x260(%rbp),%rsi
mov    %r15d,%edi
mov    $0xff,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
mov    -0x30(%rbp),%r13
je     13f7 <main+0x1f7>
mov    %r13,%rsp
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xca8(%rip),%rdi
call   10d0 <perror@plt>
jmp    13b5 <main+0x1b5>
lea    0xc9a(%rip),%rdi
call   10d0 <perror@plt>
jmp    13d4 <main+0x1d4>
mov    0x2bbc(%rip),%rax
mov    (%rax),%edi
lea    0xbeb(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

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

LLVM IR (-O2):
%struct.addrinfo = type { i64, i32, i32, i32, i32, %struct.addrinfo* }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"usage: client hostname\0A\00"
@AF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [17 x i8] c"getaddrinfo: %s\0A\00"
@.str.2 = [15 x i8] c"client: socket\00"
@.str.3 = [16 x i8] c"client: connect\00"
@.str.4 = [27 x i8] c"client: failed to connect\0A\00"
@.str.5 = [26 x i8] c"client: connecting to %s\0A\00"
@.str.6 = [27 x i8] c"Please enter the message: \00"
@stdin = global i32 0
@.str.7 = [5 x i8] c"send\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [255 x i8]
%4 = alloca [255 x i8]
%5 = alloca %struct.addrinfo
%6 = alloca %struct.addrinfo*
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%9 = bitcast %struct.addrinfo* %5 to i8*
%10 = bitcast %struct.addrinfo** %6 to i8*
%11 = load i32, i32* @INET6_ADDRSTRLEN
%12 = zext i32 %11 to i64
%13 = tail call i8* @llvm.stacksave()
%14 = alloca i8, i64 %12
%15 = icmp eq i32 %0, 3
br i1 %15, label %20, label %16
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = call i32 @memset(%struct.addrinfo* %5, i32 0, i32 32)
%22 = load i32, i32* @AF_UNSPEC
%23 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 1
store i32 %22, i32* %23
%24 = load i32, i32* @SOCK_STREAM
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %5, i64 0, i32 4
store i32 %24, i32* %25
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @getaddrinfo(i8* %27, i8* %29, %struct.addrinfo* %5, %struct.addrinfo** %6)
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %20
%33 = load %struct.addrinfo*, %struct.addrinfo** %6
%34 = icmp eq %struct.addrinfo* %33, null
br i1 %34, label %64, label %39
35: ; preds = %20
%36 = load i32, i32* @stderr
%37 = call i8* @gai_strerror(i32 %30)
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %37)
br label %89
39: ; preds = %32, %58
%40 = phi %struct.addrinfo* [ %62, %58 ], [ %33, %32 ]
%41 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 1
%42 = load i32, i32* %41
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 4
%44 = load i32, i32* %43
%45 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 3
%46 = load i32, i32* %45
%47 = call i32 @socket(i32 %42, i32 %44, i32 %46)
%48 = icmp eq i32 %47, -1
br i1 %48, label %58, label %49
49: ; preds = %39
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 0
%51 = load i64, i64* %50
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 2
%53 = load i32, i32* %52
%54 = call i32 @connect(i32 %47, i64 %51, i32 %53)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %67
56: ; preds = %49
%57 = call i32 @close(i32 %47)
br label %58
58: ; preds = %39, %56
%59 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), %56 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %39 ]
%60 = call i32 @perror(i8* %59)
%61 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 5
%62 = load %struct.addrinfo*, %struct.addrinfo** %61
%63 = icmp eq %struct.addrinfo* %62, null
br i1 %63, label %64, label %39
64: ; preds = %58, %32
%65 = load i32, i32* @stderr
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %89
67: ; preds = %49
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 1
%69 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %40, i64 0, i32 0
%70 = load i32, i32* %68
%71 = load i64, i64* %69
%72 = inttoptr i64 %71 to %struct.sockaddr*
%73 = call i32 @get_in_addr(%struct.sockaddr* %72)
%74 = call i32 @inet_ntop(i32 %70, i32 %73, i8* %14, i32 %11)
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %14)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%77 = call i32 @bzero(i8* %8, i32 256)
%78 = load i32, i32* @stdin
%79 = call i32 @fgets(i8* %8, i32 255, i32 %78)
%80 = call i32 @send(i32 %47, i8* %8, i32 255, i32 0)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %84
82: ; preds = %67
%83 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %84
84: ; preds = %82, %67
%85 = call i32 @recv(i32 %47, i8* %7, i32 255, i32 0)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %89
89: ; preds = %84, %87, %64, %35
%90 = phi i32 [ 1, %35 ], [ 2, %64 ], [ 0, %87 ], [ 0, %84 ]
ret i32 %90
}