#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef size_t ssize_t;
typedef int /*<<< orphan*/ servAddr;
typedef int /*<<< orphan*/ in_port_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
size_t recv(int, char *, int, int /*<<< orphan*/);
size_t send(int, char *, size_t, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
size_t strlen(char *);
int /*<<< orphan*/ sysError(char *);
int /*<<< orphan*/ usrError(char *);
int main(int argc, char **argv) {
  if (argc != 4)
    usrError("Usage:\t<Address> <Port> <String>");
  char *servIP = argv[1];
  in_port_t servPort = atoi(argv[2]);
  char *echoString = argv[3];
  int servSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (servSock < 0)
    sysError("failed to create socket");
  struct sockaddr_in servAddr;
  memset(&servAddr, 0, sizeof(servAddr));
  servAddr.sin_family = AF_INET;
  int ret = inet_pton(AF_INET, servIP, &servAddr.sin_addr.s_addr);
  if (ret < 0)
    sysError("invalid address family");
  else if (ret == 0)
    usrError("invalid address type");
  servAddr.sin_port = htons(servPort);
  if (connect(servSock, (struct sockaddr *)&servAddr, sizeof(servAddr)) < 0)
    sysError("socket stream connection failed");
  size_t echoStringLen = strlen(echoString);
  ssize_t numBytesSent = 0;
  numBytesSent = send(servSock, echoString, echoStringLen, 0);
  if (numBytesSent < 0)
    sysError("failed to send data to socket stream");
  else if (numBytesSent != echoStringLen)
    sysError("sent unexpected amount of data");
  ssize_t totalBytesRcvd = 0;
  while (totalBytesRcvd < echoStringLen) {
    char buff[1000];
    ssize_t numBytesRcvd = recv(servSock, buff, 1000, 0);
    if (numBytesRcvd < 0)
      sysError("failed to receive data from socket stream");
    else if (numBytesRcvd == 0)
      sysError("connection died prematurely");
    totalBytesRcvd += numBytesRcvd;
    buff[totalBytesRcvd] = '\0';
    fprintf(stdout, "received: %s", buff);
  }
  fprintf(stdout, "\n");
  close(servSock);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11ff <main+0x2f>
lea    0xe06(%rip),%rdi
call   1060 <usrError@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
mov    0x2da0(%rip),%rax
mov    (%rax),%edx
call   10f0 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1260 <main+0x90>
lea    0xdc6(%rip),%rdi
call   1040 <sysError@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
lea    -0x38(%rbp),%rdx
add    $0x4,%rdx
call   10c0 <inet_pton@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jge    12b4 <main+0xe4>
lea    0xd8f(%rip),%rdi
call   1040 <sysError@plt>
jmp    12cf <main+0xff>
cmpl   $0x0,-0x3c(%rbp)
jne    12ca <main+0xfa>
lea    0xd8b(%rip),%rdi
call   1060 <usrError@plt>
jmp    12cf <main+0xff>
mov    -0x1c(%rbp),%edi
call   1070 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <connect@plt>
cmp    $0x0,%rax
jge    1301 <main+0x131>
lea    0xd69(%rip),%rdi
call   1040 <sysError@plt>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x48(%rbp),%rdx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jae    1348 <main+0x178>
lea    0xd47(%rip),%rdi
call   1040 <sysError@plt>
jmp    1367 <main+0x197>
mov    -0x50(%rbp),%rax
cmp    -0x48(%rbp),%rax
je     1362 <main+0x192>
lea    0xd4d(%rip),%rdi
call   1040 <sysError@plt>
jmp    1367 <main+0x197>
movq   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmp    -0x48(%rbp),%rax
jae    1416 <main+0x246>
mov    -0x2c(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x3e8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
jae    13b9 <main+0x1e9>
lea    0xd1a(%rip),%rdi
call   1040 <sysError@plt>
jmp    13d8 <main+0x208>
cmpq   $0x0,-0x448(%rbp)
jne    13d3 <main+0x203>
lea    0xd25(%rip),%rdi
call   1040 <sysError@plt>
jmp    13d8 <main+0x208>
mov    -0x448(%rbp),%rax
add    -0x58(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
movb   $0x0,-0x440(%rbp,%rax,1)
mov    0x2bce(%rip),%rax
mov    (%rax),%edi
lea    -0x440(%rbp),%rdx
lea    0xd05(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    136f <main+0x19f>
mov    0x2bab(%rip),%rax
mov    (%rax),%edi
lea    0xcf6(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
je     11f5 <main+0x25>
lea    0xe10(%rip),%rdi
call   1060 <usrError@plt>
mov    0x8(%rbx),%rbp
mov    0x10(%rbx),%rdi
call   10d0 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%r14
mov    0x2dd8(%rip),%rbx
mov    (%rbx),%edi
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
mov    0x2dbe(%rip),%rax
mov    (%rax),%edx
call   10f0 <socket@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
jns    123d <main+0x6d>
lea    0xde9(%rip),%rdi
call   1040 <sysError@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    (%rbx),%edi
mov    %edi,0x18(%rsp)
lea    0x14(%rsp),%rdx
mov    %rbp,%rsi
call   10c0 <inet_pton@plt>
test   %eax,%eax
js     1279 <main+0xa9>
mov    0xc(%rsp),%ebp
jne    1289 <main+0xb9>
lea    0xdde(%rip),%rdi
call   1060 <usrError@plt>
jmp    1289 <main+0xb9>
lea    0xdb9(%rip),%rdi
call   1040 <sysError@plt>
mov    0xc(%rsp),%ebp
mov    %r15d,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   10e0 <connect@plt>
test   %rax,%rax
jns    12b7 <main+0xe7>
lea    0xdb3(%rip),%rdi
call   1040 <sysError@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rax,%r13
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1080 <send@plt>
cmp    %r13,%rax
je     12e2 <main+0x112>
lea    0xda8(%rip),%rdi
call   1040 <sysError@plt>
test   %r13,%r13
je     1349 <main+0x179>
lea    0x20(%rsp),%rbx
mov    0x2cd5(%rip),%r14
lea    0xdc6(%rip),%r15
xor    %r12d,%r12d
jmp    1322 <main+0x152>
nop
add    %rbp,%r12
movb   $0x0,0x20(%rsp,%r12,1)
mov    (%r14),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
cmp    %r13,%r12
mov    0xc(%rsp),%ebp
jae    1349 <main+0x179>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3e8,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1300 <main+0x130>
lea    0xd62(%rip),%rdi
call   1040 <sysError@plt>
jmp    1300 <main+0x130>
mov    0x2c78(%rip),%rax
mov    (%rax),%edi
lea    0xd74(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %ebp,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [33 x i8] c"Usage:\09<Address> <Port> <String>\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.1 = [24 x i8] c"failed to create socket\00"
@.str.2 = [23 x i8] c"invalid address family\00"
@.str.3 = [21 x i8] c"invalid address type\00"
@.str.4 = [32 x i8] c"socket stream connection failed\00"
@.str.5 = [37 x i8] c"failed to send data to socket stream\00"
@.str.6 = [31 x i8] c"sent unexpected amount of data\00"
@.str.7 = [42 x i8] c"failed to receive data from socket stream\00"
@.str.8 = [28 x i8] c"connection died prematurely\00"
@stdout = global i32 0
@.str.9 = [13 x i8] c"received: %s\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca [1000 x i8]
%16 = alloca i64
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, 4
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 @usrError(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
store i32 %28, i32* %7
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
store i8* %31, i8** %8
%32 = load i32, i32* @AF_INET
%33 = load i32, i32* @SOCK_STREAM
%34 = load i32, i32* @IPPROTO_TCP
%35 = call i32 @socket(i32 %32, i32 %33, i32 %34)
store i32 %35, i32* %9
%36 = load i32, i32* %9
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %21
%39 = call i32 @sysError(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %21
%41 = call i32 @memset(%struct.sockaddr_in* %10, i32 0, i32 12)
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %42, i32* %43
%44 = load i32, i32* @AF_INET
%45 = load i8*, i8** %6
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%47 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %46, i32 0, i32 0
%48 = call i32 @inet_pton(i32 %44, i8* %45, i32* %47)
store i32 %48, i32* %11
%49 = load i32, i32* %11
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %40
%52 = call i32 @sysError(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %59
53: ; preds = %40
%54 = load i32, i32* %11
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 @usrError(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %58
58: ; preds = %56, %53
br label %59
59: ; preds = %58, %51
%60 = load i32, i32* %7
%61 = call i32 @htons(i32 %60)
%62 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
store i32 %61, i32* %62
%63 = load i32, i32* %9
%64 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%65 = call i64 @connect(i32 %63, %struct.sockaddr* %64, i32 12)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %59
%68 = call i32 @sysError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %69
69: ; preds = %67, %59
%70 = load i8*, i8** %8
%71 = call i64 @strlen(i8* %70)
store i64 %71, i64* %12
store i64 0, i64* %13
%72 = load i32, i32* %9
%73 = load i8*, i8** %8
%74 = load i64, i64* %12
%75 = call i64 @send(i32 %72, i8* %73, i64 %74, i32 0)
store i64 %75, i64* %13
%76 = load i64, i64* %13
%77 = icmp ult i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %69
%79 = call i32 @sysError(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %87
80: ; preds = %69
%81 = load i64, i64* %13
%82 = load i64, i64* %12
%83 = icmp ne i64 %81, %82
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = call i32 @sysError(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %86
86: ; preds = %84, %80
br label %87
87: ; preds = %86, %78
store i64 0, i64* %14
br label %88
88: ; preds = %106, %87
%89 = load i64, i64* %14
%90 = load i64, i64* %12
%91 = icmp ult i64 %89, %90
br i1 %91, label %92, label %115
92: ; preds = %88
%93 = load i32, i32* %9
%94 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%95 = call i64 @recv(i32 %93, i8* %94, i32 1000, i32 0)
store i64 %95, i64* %16
%96 = load i64, i64* %16
%97 = icmp ult i64 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %92
%99 = call i32 @sysError(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %106
100: ; preds = %92
%101 = load i64, i64* %16
%102 = icmp eq i64 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %100
%104 = call i32 @sysError(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %105
105: ; preds = %103, %100
br label %106
106: ; preds = %105, %98
%107 = load i64, i64* %16
%108 = load i64, i64* %14
%109 = add i64 %108, %107
store i64 %109, i64* %14
%110 = load i64, i64* %14
%111 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 %110
store i8 0, i8* %111
%112 = load i32, i32* @stdout
%113 = getelementptr inbounds [1000 x i8], [1000 x i8]* %15, i64 0, i64 0
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %113)
br label %88
115: ; preds = %88
%116 = load i32, i32* @stdout
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%118 = load i32, i32* %9
%119 = call i32 @close(i32 %118)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [33 x i8] c"Usage:\09<Address> <Port> <String>\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.1 = [24 x i8] c"failed to create socket\00"
@.str.2 = [23 x i8] c"invalid address family\00"
@.str.3 = [21 x i8] c"invalid address type\00"
@.str.4 = [32 x i8] c"socket stream connection failed\00"
@.str.6 = [31 x i8] c"sent unexpected amount of data\00"
@.str.8 = [28 x i8] c"connection died prematurely\00"
@stdout = global i32 0
@.str.9 = [13 x i8] c"received: %s\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1000 x i8]
%5 = icmp eq i32 %0, 4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @usrError(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = load i32, i32* @IPPROTO_TCP
%19 = tail call i32 @socket(i32 %16, i32 %17, i32 %18)
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %8
%22 = tail call i32 @sysError(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %8
%24 = bitcast %struct.sockaddr_in* %3 to i8*
%25 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %26, i32* %27
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%29 = call i32 @inet_pton(i32 %26, i8* %10, i32* %28)
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %23
%32 = call i32 @sysError(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %37
33: ; preds = %23
%34 = icmp eq i32 %29, 0
br i1 %34, label %35, label %37
35: ; preds = %33
%36 = call i32 @usrError(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %33, %35, %31
%38 = call i32 @htons(i32 %13)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %38, i32* %39
%40 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%41 = call i64 @connect(i32 %19, %struct.sockaddr* %40, i32 12)
%42 = icmp slt i64 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %37
%44 = call i32 @sysError(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %43, %37
%46 = call i64 @strlen(i8* dereferenceable(1) %15)
%47 = call i64 @send(i32 %19, i8* %15, i64 %46, i32 0)
%48 = icmp eq i64 %47, %46
br i1 %48, label %51, label %49
49: ; preds = %45
%50 = call i32 @sysError(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %45, %49
%52 = icmp eq i64 %46, 0
br i1 %52, label %67, label %53
53: ; preds = %51
%54 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
br label %55
55: ; preds = %53, %61
%56 = phi i64 [ 0, %53 ], [ %62, %61 ]
%57 = call i64 @recv(i32 %19, i8* %54, i32 1000, i32 0)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = call i32 @sysError(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %61
61: ; preds = %55, %59
%62 = add i64 %57, %56
%63 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %62
store i8 0, i8* %63
%64 = load i32, i32* @stdout
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %54)
%66 = icmp ult i64 %62, %46
br i1 %66, label %55, label %67
67: ; preds = %61, %51
%68 = load i32, i32* @stdout
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%70 = call i32 @close(i32 %19)
ret i32 0
}