#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 hostent {
  int dummy;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_flags;
};
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AI_PASSIVE;
int /*<<< orphan*/ PF_UNSPEC;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int readline(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ usage();
int writen(int, char *, int);
int main(int argc, char *argv[]) {
  int serverSocket, servlen, n, retread, error;
  struct addrinfo hints, *res, *res0;
  char fromServer[80];
  char fromUser[80];
  struct hostent *hp;
  if (argc != 3) {
    usage();
    exit(1);
  }
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = PF_UNSPEC;
  hints.ai_socktype = SOCK_STREAM;
  hints.ai_flags = AI_PASSIVE;
  error = getaddrinfo(argv[1], argv[2], &hints, &res0);
  if (error) {
    perror("error getaddr");
    exit(1);
  }
  for (res = res0; res; res = res->ai_next) {
    if ((serverSocket =
             socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) {
      perror("erreur socket");
      exit(1);
    }
    if (connect(serverSocket, res->ai_addr, res->ai_addrlen) < 0) {
      perror("erreur connect");
      exit(1);
    }
    break;
  }
  while ((retread = readline(serverSocket, fromServer, 80)) > 0) {
    printf("corr: %s", fromServer);
    if (strcmp(fromServer, "Au revoir\n") == 0)
      break;
    printf("vous: ");
    if (fgets(fromUser, 80, stdin) == NULL) {
      perror("erreur fgets \n");
      exit(1);
    }
    if ((n = writen(serverSocket, fromUser, strlen(fromUser))) !=
        strlen(fromUser)) {
      printf("erreur writen");
      exit(1);
    }
  }
  if (retread < 0) {
    perror("erreur readline \n");
  }
  close(serverSocket);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1214 <main+0x34>
mov    $0x0,%al
call   10a0 <usage@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2d91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2d9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   10f0 <getaddrinfo@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1288 <main+0xa8>
lea    0xd87(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     1311 <main+0x131>
mov    -0x58(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x58(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12d7 <main+0xf7>
lea    0xd46(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x58(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x58(%rbp),%rax
mov    (%rax),%edx
call   10e0 <connect@plt>
cmp    $0x0,%rax
jge    130c <main+0x12c>
lea    0xd1f(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1311 <main+0x131>
jmp    1316 <main+0x136>
mov    -0x14(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0x50,%edx
call   1060 <readline@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jle    142e <main+0x24e>
lea    -0xb0(%rbp),%rsi
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rdi
lea    0xcdb(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    136d <main+0x18d>
jmp    142e <main+0x24e>
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
mov    0x2c4f(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
jne    13b5 <main+0x1d5>
lea    0xca0(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x11c(%rbp)
lea    -0x100(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x100(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x11c(%rbp),%edi
mov    -0x118(%rbp),%rsi
mov    %eax,%edx
call   10c0 <writen@plt>
mov    %eax,-0x10c(%rbp)
mov    %eax,-0x1c(%rbp)
lea    -0x100(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10c(%rbp),%eax
cmp    %ecx,%eax
je     1429 <main+0x249>
lea    0xc3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1316 <main+0x136>
cmpl   $0x0,-0x20(%rbp)
jge    1444 <main+0x264>
lea    0xc24(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
cmp    $0x3,%edi
jne    1389 <main+0x1a9>
mov    %rsi,%rbx
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2dae(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    %rsp,%rcx
mov    %rbp,%rdx
call   10f0 <getaddrinfo@plt>
test   %eax,%eax
jne    139a <main+0x1ba>
mov    (%rsp),%rbp
test   %rbp,%rbp
je     1292 <main+0xb2>
mov    0x10(%rbp),%edi
mov    0x8(%rbp),%edx
mov    0xc(%rbp),%esi
call   1100 <socket@plt>
test   %eax,%eax
js     13a3 <main+0x1c3>
mov    %eax,%ebx
mov    0x0(%rbp),%edx
mov    0x4(%rbp),%esi
mov    %eax,%edi
call   10e0 <connect@plt>
test   %rax,%rax
jns    1292 <main+0xb2>
lea    0xd8f(%rip),%rdi
jmp    137a <main+0x19a>
lea    0x80(%rsp),%r14
lea    0xd93(%rip),%r12
mov    0x2d30(%rip),%r13
lea    0x30(%rsp),%rbp
nopl   (%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x50,%edx
call   1060 <readline@plt>
test   %eax,%eax
jle    1348 <main+0x168>
lea    0xd5d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     134a <main+0x16a>
lea    0xd50(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbp,%rdi
mov    $0x50,%esi
call   1080 <fgets@plt>
test   %rax,%rax
je     1373 <main+0x193>
mov    %rbp,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   10c0 <writen@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1030 <strlen@plt>
cmp    %eax,%r15d
je     12b0 <main+0xd0>
lea    0xd1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
js     1365 <main+0x185>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcf7(%rip),%rdi
call   10b0 <perror@plt>
jmp    134a <main+0x16a>
lea    0xccc(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
xor    %eax,%eax
call   10a0 <usage@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xc5f(%rip),%rdi
jmp    137a <main+0x19a>
lea    0xc64(%rip),%rdi
jmp    137a <main+0x19a>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.hostent = type { i32 }
@PF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [14 x i8] c"error getaddr\00"
@.str.1 = [14 x i8] c"erreur socket\00"
@.str.2 = [15 x i8] c"erreur connect\00"
@.str.3 = [9 x i8] c"corr: %s\00"
@.str.4 = [11 x i8] c"Au revoir\0A\00"
@.str.5 = [7 x i8] c"vous: \00"
@stdin = global i32 0
@.str.6 = [15 x i8] c"erreur fgets \0A\00"
@.str.7 = [14 x i8] c"erreur writen\00"
@.str.8 = [18 x i8] c"erreur readline \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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.addrinfo
%12 = alloca %struct.addrinfo*
%13 = alloca %struct.addrinfo*
%14 = alloca [80 x i8]
%15 = alloca [80 x i8]
%16 = alloca %struct.hostent*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 (...) @usage()
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = call i32 @memset(%struct.addrinfo* %11, i32 0, i32 40)
%24 = load i32, i32* @PF_UNSPEC
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 4
store i32 %24, i32* %25
%26 = load i32, i32* @SOCK_STREAM
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 3
store i32 %26, i32* %27
%28 = load i32, i32* @AI_PASSIVE
%29 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %11, i32 0, i32 6
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* %11, %struct.addrinfo** %13)
store i32 %36, i32* %10
%37 = load i32, i32* %10
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %22
%40 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %22
%43 = load %struct.addrinfo*, %struct.addrinfo** %13
store %struct.addrinfo* %43, %struct.addrinfo** %12
br label %44
44: ; preds = %76, %42
%45 = load %struct.addrinfo*, %struct.addrinfo** %12
%46 = icmp ne %struct.addrinfo* %45, null
br i1 %46, label %47, label %80
47: ; preds = %44
%48 = load %struct.addrinfo*, %struct.addrinfo** %12
%49 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %48, i32 0, i32 4
%50 = load i32, i32* %49
%51 = load %struct.addrinfo*, %struct.addrinfo** %12
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i32 0, i32 3
%53 = load i32, i32* %52
%54 = load %struct.addrinfo*, %struct.addrinfo** %12
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 2
%56 = load i32, i32* %55
%57 = call i32 @socket(i32 %50, i32 %53, i32 %56)
store i32 %57, i32* %6
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %47
%60 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %47
%63 = load i32, i32* %6
%64 = load %struct.addrinfo*, %struct.addrinfo** %12
%65 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %64, i32 0, i32 1
%66 = load i32, i32* %65
%67 = load %struct.addrinfo*, %struct.addrinfo** %12
%68 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %67, i32 0, i32 0
%69 = load i32, i32* %68
%70 = call i64 @connect(i32 %63, i32 %66, i32 %69)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %62
%73 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %62
br label %80
76: ; No predecessors!
%77 = load %struct.addrinfo*, %struct.addrinfo** %12
%78 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %77, i32 0, i32 5
%79 = load %struct.addrinfo*, %struct.addrinfo** %78
store %struct.addrinfo* %79, %struct.addrinfo** %12
br label %44
80: ; preds = %75, %44
br label %81
81: ; preds = %114, %80
%82 = load i32, i32* %6
%83 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%84 = call i32 @readline(i32 %82, i8* %83, i32 80)
store i32 %84, i32* %9
%85 = icmp sgt i32 %84, 0
br i1 %85, label %86, label %115
86: ; preds = %81
%87 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %87)
%89 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%90 = call i64 @strcmp(i8* %89, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %93
92: ; preds = %86
br label %115
93: ; preds = %86
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%95 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%96 = load i32, i32* @stdin
%97 = call i32* @fgets(i8* %95, i32 80, i32 %96)
%98 = icmp eq i32* %97, null
br i1 %98, label %99, label %102
99: ; preds = %93
%100 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%101 = call i32 @exit(i32 1)
unreachable
102: ; preds = %93
%103 = load i32, i32* %6
%104 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%105 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%106 = call i32 @strlen(i8* %105)
%107 = call i32 @writen(i32 %103, i8* %104, i32 %106)
store i32 %107, i32* %8
%108 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%109 = call i32 @strlen(i8* %108)
%110 = icmp ne i32 %107, %109
br i1 %110, label %111, label %114
111: ; preds = %102
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %102
br label %81
115: ; preds = %92, %81
%116 = load i32, i32* %9
%117 = icmp slt i32 %116, 0
br i1 %117, label %118, label %120
118: ; preds = %115
%119 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %120
120: ; preds = %118, %115
%121 = load i32, i32* %6
%122 = call i32 @close(i32 %121)
%123 = load i32, i32* %3
ret i32 %123
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32, %struct.addrinfo*, i32 }
%struct.hostent = type { i32 }
@PF_UNSPEC = global i32 0
@SOCK_STREAM = global i32 0
@AI_PASSIVE = global i32 0
@.str = [14 x i8] c"error getaddr\00"
@.str.1 = [14 x i8] c"erreur socket\00"
@.str.2 = [15 x i8] c"erreur connect\00"
@.str.3 = [9 x i8] c"corr: %s\00"
@.str.4 = [11 x i8] c"Au revoir\0A\00"
@.str.5 = [7 x i8] c"vous: \00"
@stdin = global i32 0
@.str.6 = [15 x i8] c"erreur fgets \0A\00"
@.str.7 = [14 x i8] c"erreur writen\00"
@.str.8 = [18 x i8] c"erreur readline \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = bitcast %struct.addrinfo* %3 to i8*
%8 = bitcast %struct.addrinfo** %4 to i8*
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%11 = icmp eq i32 %0, 3
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = tail call i32 (...) @usage()
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 40)
%17 = load i32, i32* @PF_UNSPEC
%18 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %17, i32* %18
%19 = load i32, i32* @SOCK_STREAM
%20 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %19, i32* %20
%21 = load i32, i32* @AI_PASSIVE
%22 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 6
store i32 %21, i32* %22
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @getaddrinfo(i8* %24, i8* %26, %struct.addrinfo* %3, %struct.addrinfo** %4)
%28 = icmp eq i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %15
%30 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %15
%33 = load %struct.addrinfo*, %struct.addrinfo** %4
%34 = icmp eq %struct.addrinfo* %33, null
br i1 %34, label %57, label %35
35: ; preds = %32
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 4
%37 = load i32, i32* %36
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 3
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 2
%41 = load i32, i32* %40
%42 = call i32 @socket(i32 %37, i32 %39, i32 %41)
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %35
%45 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %35
%48 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 1
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %33, i64 0, i32 0
%51 = load i32, i32* %50
%52 = call i64 @connect(i32 %42, i32 %49, i32 %51)
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %47
%55 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%56 = call i32 @exit(i32 1)
unreachable
57: ; preds = %47, %32
%58 = phi i32 [ %42, %47 ], [ undef, %32 ]
br label %59
59: ; preds = %74, %57
%60 = call i32 @readline(i32 %58, i8* %9, i32 80)
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %82
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%64 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %86, label %66
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%68 = load i32, i32* @stdin
%69 = call i32* @fgets(i8* %10, i32 80, i32 %68)
%70 = icmp eq i32* %69, null
br i1 %70, label %71, label %74
71: ; preds = %66
%72 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %66
%75 = call i32 @strlen(i8* %10)
%76 = call i32 @writen(i32 %58, i8* %10, i32 %75)
%77 = call i32 @strlen(i8* %10)
%78 = icmp eq i32 %76, %77
br i1 %78, label %59, label %79
79: ; preds = %74
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %59
%83 = icmp slt i32 %60, 0
br i1 %83, label %84, label %86
84: ; preds = %82
%85 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
br label %86
86: ; preds = %62, %84, %82
%87 = call i32 @close(i32 %58)
ret i32 0
}