#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int s_addr;
};
struct sockaddr_in {
  int sin_family;
  int sin_port;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ send_buffer;
typedef int /*<<< orphan*/ recvBuff;

/* Variables and functions */
int AF_INET;
scalar_t__ EOF;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ connect(int, struct sockaddr *, int);
scalar_t__ fputs(char *, int /*<<< orphan*/);
int htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ inet_pton(int, char *, TYPE_1__ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int ntohs(int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int socket(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sockfd = 0, n = 0;
  char recvBuff[1024];
  struct sockaddr_in serv_addr = {.sin_family = AF_INET,
                                  .sin_port = htons(2081)};
  if (argc != 2) {
    printf("\nUsage: %s <server_ip_address>\n", argv[0]);
    return 1;
  }
  memset(recvBuff, '0', sizeof(recvBuff));
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    printf("\nError: Could not create socket\n");
    return 1;
  }
  if (inet_pton(AF_INET, argv[1], &serv_addr.sin_addr) <= 0) {
    printf("\nError: in inet_pton\n");
    return 1;
  }
  printf("%d %d %d\n", serv_addr.sin_family, serv_addr.sin_addr.s_addr,
         serv_addr.sin_port);
  if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    printf("\nError: Connection failed\n");
    return 1;
  }
  printf("Connected to: %s:%d\n", inet_ntoa(serv_addr.sin_addr),
         ntohs(serv_addr.sin_port));
  char send_buffer[1025];
  bzero(send_buffer, 1025);
  snprintf(send_buffer, sizeof(send_buffer), "%s\n", "urxvt");
  write(sockfd, send_buffer, strlen(send_buffer));
  printf("Command sent: '%s'\n", send_buffer);
  while ((n = read(sockfd, recvBuff, sizeof(recvBuff) - 1)) > 0) {
    recvBuff[n] = 0;
    if (fputs(recvBuff, stdout) == EOF) {
      printf("\nError: Fputs error\n");
    }
  }
  if (n < 0) {
    printf("\nError: Read error\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x860,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2dda(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x430(%rbp)
mov    $0x821,%edi
call   1060 <htons@plt>
mov    %eax,-0x42c(%rbp)
lea    -0x430(%rbp),%rdi
add    $0x8,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   10a0 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
je     1268 <main+0x88>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x2ad>
lea    -0x420(%rbp),%rdi
mov    $0x30,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
mov    0x2d42(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12bd <main+0xdd>
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x2ad>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x430(%rbp),%rdx
add    $0x8,%rdx
call   10c0 <inet_pton@plt>
cmp    $0x0,%rax
jg     1302 <main+0x122>
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x2ad>
mov    -0x430(%rbp),%esi
mov    -0x428(%rbp),%edx
mov    -0x42c(%rbp),%ecx
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
cmp    $0x0,%rax
jge    135a <main+0x17a>
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    148d <main+0x2ad>
mov    -0x428(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x858(%rbp)
mov    -0x42c(%rbp),%edi
call   10d0 <ntohs@plt>
mov    -0x858(%rbp),%rsi
mov    %eax,%edx
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x840(%rbp),%rdi
mov    $0x401,%esi
call   10e0 <bzero@plt>
lea    -0x840(%rbp),%rdi
mov    $0x401,%esi
lea    0xcdf(%rip),%rdx
lea    0xcdc(%rip),%rcx
call   1080 <snprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x84c(%rbp)
lea    -0x840(%rbp),%rax
mov    %rax,-0x848(%rbp)
lea    -0x840(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x84c(%rbp),%edi
mov    -0x848(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    -0x840(%rbp),%rsi
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x3ff,%edx
call   10b0 <read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jle    146e <main+0x28e>
movslq -0x18(%rbp),%rax
movb   $0x0,-0x420(%rbp,%rax,1)
lea    -0x420(%rbp),%rdi
mov    0x2b84(%rip),%rax
mov    (%rax),%esi
call   1090 <fputs@plt>
mov    0x2b8e(%rip),%rcx
cmp    (%rcx),%rax
jne    1469 <main+0x289>
lea    0xc4d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    140a <main+0x22a>
cmpl   $0x0,-0x18(%rbp)
jge    1486 <main+0x2a6>
lea    0xc45(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x820,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2ddd(%rip),%r14
mov    (%r14),%eax
mov    %eax,(%rsp)
mov    $0x821,%edi
call   1070 <htons@plt>
mov    %eax,0x4(%rsp)
movl   $0x0,0x8(%rsp)
cmp    $0x2,%ebp
jne    1395 <main+0x1a5>
lea    0x10(%rsp),%rdi
mov    $0x30,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
mov    (%r14),%edi
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     13a8 <main+0x1b8>
mov    %eax,%ebp
lea    0x8(%rsp),%rdx
mov    (%r14),%edi
mov    0x8(%rbx),%rsi
call   10d0 <inet_pton@plt>
test   %rax,%rax
jle    13c5 <main+0x1d5>
mov    0x8(%rsp),%edx
mov    (%rsp),%esi
mov    0x4(%rsp),%ecx
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rsp,%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1100 <connect@plt>
test   %rax,%rax
js     13ce <main+0x1de>
mov    0x8(%rsp),%edi
call   1050 <inet_ntoa@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%edi
call   10e0 <ntohs@plt>
lea    0xd62(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x410(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x401,%esi
call   10f0 <bzero@plt>
lea    0xd4f(%rip),%rdx
lea    0xd4c(%rip),%rcx
mov    %rbx,%rdi
mov    $0x401,%esi
call   1090 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xd2a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x3ff,%edx
call   10c0 <read@plt>
test   %eax,%eax
jle    13b1 <main+0x1c1>
mov    0x2c83(%rip),%r15
lea    0x10(%rsp),%rbx
mov    0x2c8f(%rip),%r12
lea    0xd18(%rip),%r14
jmp    1373 <main+0x183>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3ff,%edx
call   10c0 <read@plt>
test   %eax,%eax
jle    13b1 <main+0x1c1>
mov    %eax,%eax
movb   $0x0,0x10(%rsp,%rax,1)
mov    (%r15),%esi
mov    %rbx,%rdi
call   10a0 <fputs@plt>
cmp    (%r12),%rax
jne    1360 <main+0x170>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    1360 <main+0x170>
mov    (%rbx),%rsi
lea    0xc61(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    13da <main+0x1ea>
lea    0xd04(%rip),%rdi
jmp    13d5 <main+0x1e5>
test   %eax,%eax
jns    13c1 <main+0x1d1>
lea    0xca1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    13df <main+0x1ef>
lea    0xcd2(%rip),%rdi
jmp    13d5 <main+0x1e5>
lea    0xcaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x820,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@.str = [32 x i8] c"\0AUsage: %s <server_ip_address>\0A\00"
@SOCK_STREAM = global i32 0
@.str.1 = [33 x i8] c"\0AError: Could not create socket\0A\00"
@.str.2 = [22 x i8] c"\0AError: in inet_pton\0A\00"
@.str.3 = [10 x i8] c"%d %d %d\0A\00"
@.str.4 = [27 x i8] c"\0AError: Connection failed\0A\00"
@.str.5 = [21 x i8] c"Connected to: %s:%d\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [6 x i8] c"urxvt\00"
@.str.8 = [20 x i8] c"Command sent: '%s'\0A\00"
@stdout = global i32 0
@EOF = global i64 0
@.str.9 = [21 x i8] c"\0AError: Fputs error\0A\00"
@.str.10 = [20 x i8] c"\0AError: Read error\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 [1024 x i8]
%9 = alloca %struct.sockaddr_in
%10 = alloca [1025 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%12 = load i32, i32* @AF_INET
store i32 %12, i32* %11
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%14 = call i32 @htons(i32 2081)
store i32 %14, i32* %13
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
%16 = bitcast %struct.TYPE_3__* %15 to i8*
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 2
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %22)
store i32 1, i32* %3
br label %101
24: ; preds = %2
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%26 = call i32 @memset(i8* %25, i32 48, i32 1024)
%27 = load i32, i32* @AF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = call i32 @socket(i32 %27, i32 %28, i32 0)
store i32 %29, i32* %6
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %101
33: ; preds = %24
%34 = load i32, i32* @AF_INET
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
%39 = call i64 @inet_pton(i32 %34, i8* %37, %struct.TYPE_3__* %38)
%40 = icmp sle i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %33
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %101
43: ; preds = %33
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%45 = load i32, i32* %44
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
%47 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %46, i32 0, i32 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%50 = load i32, i32* %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %45, i32 %48, i32 %50)
%52 = load i32, i32* %6
%53 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%54 = call i64 @connect(i32 %52, %struct.sockaddr* %53, i32 12)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %43
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %101
58: ; preds = %43
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
%60 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %59, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i8* @inet_ntoa(i32 %61)
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%64 = load i32, i32* %63
%65 = call i32 @ntohs(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %62, i32 %65)
%67 = getelementptr inbounds [1025 x i8], [1025 x i8]* %10, i64 0, i64 0
%68 = call i32 @bzero(i8* %67, i32 1025)
%69 = getelementptr inbounds [1025 x i8], [1025 x i8]* %10, i64 0, i64 0
%70 = call i32 @snprintf(i8* %69, i32 1025, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%71 = load i32, i32* %6
%72 = getelementptr inbounds [1025 x i8], [1025 x i8]* %10, i64 0, i64 0
%73 = getelementptr inbounds [1025 x i8], [1025 x i8]* %10, i64 0, i64 0
%74 = call i32 @strlen(i8* %73)
%75 = call i32 @write(i32 %71, i8* %72, i32 %74)
%76 = getelementptr inbounds [1025 x i8], [1025 x i8]* %10, i64 0, i64 0
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %94, %58
%79 = load i32, i32* %6
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%81 = call i32 @read(i32 %79, i8* %80, i32 1023)
store i32 %81, i32* %7
%82 = icmp sgt i32 %81, 0
br i1 %82, label %83, label %95
83: ; preds = %78
%84 = load i32, i32* %7
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 %85
store i8 0, i8* %86
%87 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%88 = load i32, i32* @stdout
%89 = call i64 @fputs(i8* %87, i32 %88)
%90 = load i64, i64* @EOF
%91 = icmp eq i64 %89, %90
br i1 %91, label %92, label %94
92: ; preds = %83
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
br label %94
94: ; preds = %92, %83
br label %78
95: ; preds = %78
%96 = load i32, i32* %7
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %95
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %100
100: ; preds = %98, %95
store i32 0, i32* %3
br label %101
101: ; preds = %100, %56, %41, %31, %19
%102 = load i32, i32* %3
ret i32 %102
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@.str = [32 x i8] c"\0AUsage: %s <server_ip_address>\0A\00"
@SOCK_STREAM = global i32 0
@.str.3 = [10 x i8] c"%d %d %d\0A\00"
@.str.5 = [21 x i8] c"Connected to: %s:%d\0A\00"
@.str.6 = [4 x i8] c"%s\0A\00"
@.str.7 = [6 x i8] c"urxvt\00"
@.str.8 = [20 x i8] c"Command sent: '%s'\0A\00"
@stdout = global i32 0
@EOF = global i64 0
@str = [19 x i8] c"\0AError: Read error\00"
@str.11 = [20 x i8] c"\0AError: Fputs error\00"
@str.12 = [26 x i8] c"\0AError: Connection failed\00"
@str.13 = [21 x i8] c"\0AError: in inet_pton\00"
@str.14 = [32 x i8] c"\0AError: Could not create socket\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.sockaddr_in
%5 = alloca [1025 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = bitcast %struct.sockaddr_in* %4 to i8*
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%9 = load i32, i32* @AF_INET
store i32 %9, i32* %8
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
%11 = tail call i32 @htons(i32 2081)
store i32 %11, i32* %10
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %12, i64 0, i32 0
store i32 0, i32* %13
%14 = icmp eq i32 %0, 2
br i1 %14, label %18, label %15
15: ; preds = %2
%16 = load i8*, i8** %1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %77
18: ; preds = %2
%19 = call i32 @memset(i8* %6, i32 48, i32 1024)
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = call i32 @socket(i32 %20, i32 %21, i32 0)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.14, i64 0, i64 0))
br label %77
26: ; preds = %18
%27 = load i32, i32* @AF_INET
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @inet_pton(i32 %27, i8* %29, %struct.TYPE_3__* %12)
%31 = icmp slt i64 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
br label %77
34: ; preds = %26
%35 = load i32, i32* %8
%36 = load i32, i32* %13
%37 = load i32, i32* %10
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %35, i32 %36, i32 %37)
%39 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%40 = call i64 @connect(i32 %22, %struct.sockaddr* %39, i32 12)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.12, i64 0, i64 0))
br label %77
44: ; preds = %34
%45 = load i32, i32* %13
%46 = call i8* @inet_ntoa(i32 %45)
%47 = load i32, i32* %10
%48 = call i32 @ntohs(i32 %47)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %46, i32 %48)
%50 = getelementptr inbounds [1025 x i8], [1025 x i8]* %5, i64 0, i64 0
%51 = call i32 @bzero(i8* %50, i32 1025)
%52 = call i32 @snprintf(i8* %50, i32 1025, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%53 = call i32 @strlen(i8* %50)
%54 = call i32 @write(i32 %22, i8* %50, i32 %53)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i8* %50)
%56 = call i32 @read(i32 %22, i8* %6, i32 1023)
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %71
58: ; preds = %44, %68
%59 = phi i32 [ %69, %68 ], [ %56, %44 ]
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 %60
store i8 0, i8* %61
%62 = load i32, i32* @stdout
%63 = call i64 @fputs(i8* %6, i32 %62)
%64 = load i64, i64* @EOF
%65 = icmp eq i64 %63, %64
br i1 %65, label %66, label %68
66: ; preds = %58
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.11, i64 0, i64 0))
br label %68
68: ; preds = %66, %58
%69 = call i32 @read(i32 %22, i8* %6, i32 1023)
%70 = icmp sgt i32 %69, 0
br i1 %70, label %58, label %71
71: ; preds = %68, %44
%72 = phi i32 [ %56, %44 ], [ %69, %68 ]
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %76
76: ; preds = %74, %71
br label %77
77: ; preds = %76, %42, %32, %24, %15
%78 = phi i32 [ 1, %15 ], [ 1, %24 ], [ 1, %32 ], [ 1, %42 ], [ 0, %76 ]
ret i32 %78
}