#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 in_addr {
  int dummy;
};
struct sockaddr_in {
  struct in_addr sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ serv_addr;

/* Variables and functions */
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
scalar_t__ gethostbyname(char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
char *inet_ntoa(struct in_addr);
int /*<<< orphan*/ memset(char *, 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*/ stderr;
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;
  struct sockaddr_in serv_addr;
  char fromServer[80];
  char fromUser[80];
  struct hostent *hp;
  if (argc != 3) {
    usage();
    exit(1);
  }
  memset((char *)&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = PF_INET;
  serv_addr.sin_port = htons(atoi(argv[2]));
  hp = (struct hostent *)gethostbyname(argv[1]);
  if (hp == NULL) {
    fprintf(stderr, "%s: %s non trouve dans in /etc/hosts ou dans le DNS\n",
            argv[0], argv[1]);
    exit(1);
  }
  serv_addr.sin_addr = *((struct in_addr *)(hp->h_addr));
  printf("IP address: %s\n", inet_ntoa(serv_addr.sin_addr));
  if ((serverSocket = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
    perror("erreur socket");
    exit(1);
  }
  if (connect(serverSocket, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) <
      0) {
    perror("erreur connect");
    exit(1);
  }
  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    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1254 <main+0x34>
mov    $0x0,%al
call   10e0 <usage@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0xd8(%rbp)
cmpq   $0x0,-0xd8(%rbp)
jne    12d7 <main+0xb7>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd38(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0xd8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    133a <main+0x11a>
lea    0xd1a(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
cmp    $0x0,%rax
jge    136b <main+0x14b>
lea    0xcf7(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1370 <main+0x150>
mov    -0x14(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x50,%edx
call   1080 <readline@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jle    147f <main+0x25f>
lea    -0x80(%rbp),%rsi
lea    0xcca(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x80(%rbp),%rdi
lea    0xcc1(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    13be <main+0x19e>
jmp    147f <main+0x25f>
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xd0(%rbp),%rdi
mov    0x2c0e(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
jne    1406 <main+0x1e6>
lea    0xc86(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0xec(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xec(%rbp),%edi
mov    -0xe8(%rbp),%rsi
mov    %eax,%edx
call   1100 <writen@plt>
mov    %eax,-0xdc(%rbp)
mov    %eax,-0x1c(%rbp)
lea    -0xd0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xdc(%rbp),%eax
cmp    %ecx,%eax
je     147a <main+0x25a>
lea    0xc23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1370 <main+0x150>
cmpl   $0x0,-0x20(%rbp)
jge    1495 <main+0x275>
lea    0xc0a(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
cmp    $0x3,%edi
jne    13c9 <main+0x1a9>
mov    %rsi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d75(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    0x10(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,0x4(%rsp)
mov    0x8(%rbx),%rdi
call   10c0 <gethostbyname@plt>
test   %rax,%rax
je     13da <main+0x1ba>
mov    (%rax),%rax
mov    (%rax),%edi
mov    %edi,(%rsp)
call   1030 <inet_ntoa@plt>
lea    0xda1(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x0(%rbp),%edi
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
test   %eax,%eax
js     1400 <main+0x1e0>
mov    %eax,%ebx
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1130 <connect@plt>
test   %rax,%rax
js     1409 <main+0x1e9>
lea    0x60(%rsp),%r14
lea    0xd8c(%rip),%r12
mov    0x2d02(%rip),%r13
lea    0x10(%rsp),%rbp
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x50,%edx
call   1080 <readline@plt>
test   %eax,%eax
jle    1388 <main+0x168>
lea    0xd54(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     138a <main+0x16a>
lea    0xd47(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbp,%rdi
mov    $0x50,%esi
call   10a0 <fgets@plt>
test   %rax,%rax
je     13b3 <main+0x193>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1100 <writen@plt>
mov    %eax,%r15d
mov    %rbp,%rdi
call   1040 <strlen@plt>
cmp    %eax,%r15d
je     12f0 <main+0xd0>
lea    0xd15(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
js     13a5 <main+0x185>
mov    %ebx,%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcee(%rip),%rdi
call   10f0 <perror@plt>
jmp    138a <main+0x16a>
lea    0xcc3(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
xor    %eax,%eax
call   10e0 <usage@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x2bf7(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
mov    0x8(%rbx),%rcx
lea    0xc0f(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    0xc3e(%rip),%rdi
jmp    13ba <main+0x19a>
lea    0xc43(%rip),%rdi
jmp    13ba <main+0x19a>

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

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