#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_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  FILE *fp;
  struct sockaddr_in serv_addr;
  char buf[10240];
  int sock_id;
  int read_len;
  int send_len;
  int serv_addr_len;
  int i_ret;
  int i;
  if (argc != 4) {
    usage(argv[0]);
  }
  if ((fp = fopen(argv[3], "r")) == NULL) {
    perror("Open file failed\n");
    exit(0);
  }
  if ((sock_id = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("Create socket failed");
    exit(0);
  }
  memset(&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_port = htons(atoi(argv[2]));
  inet_pton(AF_INET, argv[1], &serv_addr.sin_addr);
  serv_addr_len = sizeof(serv_addr);
  i_ret =
      connect(sock_id, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr));
  if (-1 == i_ret) {
    perror("Connect socket failed!\n");
    exit(0);
  }
  bzero(buf, 10240);
  while ((read_len = fread(buf, sizeof(char), 10240, fp)) > 0) {
    send_len = send(sock_id, buf, read_len, 0);
    if (send_len < 0) {
      perror("Send data failed\n");
      exit(0);
    }
    bzero(buf, 10240);
  }
  fclose(fp);
  bzero(buf, 10240);
  strcpy(buf, "FILE_TRANSPORT_FINISH");
  buf[strlen(buf)] = '\0';
  for (i = 1000; i > 0; i--) {
    send_len = send(sock_id, buf, strlen(buf) + 1, 0);
    if (send_len < 0) {
      printf("Finish send the end string\n");
      break;
    }
  }
  close(sock_id);
  printf("Send finish\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2860,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     124f <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10d0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xda2(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1284 <main+0x64>
lea    0xd8a(%rip),%rdi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%edi
mov    0x2d4c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x2834(%rbp)
cmp    $0x0,%eax
jge    12bf <main+0x9f>
lea    0xd61(%rip),%rdi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x28(%rbp),%rdx
call   10c0 <inet_pton@plt>
movl   $0xc,-0x2840(%rbp)
mov    -0x2834(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1130 <connect@plt>
mov    %eax,-0x2844(%rbp)
mov    $0xffffffff,%eax
cmp    -0x2844(%rbp),%eax
jne    1354 <main+0x134>
lea    0xce1(%rip),%rdi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>
lea    -0x2830(%rbp),%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
lea    -0x2830(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
mov    $0x2800,%edx
call   1040 <fread@plt>
mov    %eax,-0x2838(%rbp)
cmp    $0x0,%eax
jle    13e4 <main+0x1c4>
mov    -0x2834(%rbp),%edi
lea    -0x2830(%rbp),%rsi
mov    -0x2838(%rbp),%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    %eax,-0x283c(%rbp)
cmpl   $0x0,-0x283c(%rbp)
jge    13ce <main+0x1ae>
lea    0xc7f(%rip),%rdi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>
lea    -0x2830(%rbp),%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
jmp    1365 <main+0x145>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x2830(%rbp),%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
lea    -0x2830(%rbp),%rdi
lea    0xc47(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x2830(%rbp),%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x2830(%rbp,%rax,1)
movl   $0x3e8,-0x2848(%rbp)
cmpl   $0x0,-0x2848(%rbp)
jle    14ba <main+0x29a>
mov    -0x2834(%rbp),%eax
mov    %eax,-0x2854(%rbp)
lea    -0x2830(%rbp),%rax
mov    %rax,-0x2850(%rbp)
lea    -0x2830(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x2854(%rbp),%edi
mov    -0x2850(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
mov    %eax,-0x283c(%rbp)
cmpl   $0x0,-0x283c(%rbp)
jge    14a1 <main+0x281>
lea    0xbd2(%rip),%rdi
call   1090 <printf@plt>
jmp    14ba <main+0x29a>
jmp    14a6 <main+0x286>
mov    -0x2848(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2848(%rbp)
jmp    1431 <main+0x211>
mov    -0x2834(%rbp),%edi
call   10b0 <close@plt>
lea    0xbb9(%rip),%rdi
call   1090 <printf@plt>
xor    %eax,%eax
add    $0x2860,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2818,%rsp
mov    %rsi,%r15
cmp    $0x4,%edi
je     1241 <main+0x21>
mov    (%r15),%rdi
call   10d0 <usage@plt>
mov    0x18(%r15),%rdi
lea    0xdb4(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13fd <main+0x1dd>
mov    %rax,%r14
mov    0x2d84(%rip),%r12
mov    (%r12),%edi
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
test   %eax,%eax
js     1406 <main+0x1e6>
mov    %eax,%r13d
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    (%r12),%eax
mov    %eax,0x8(%rsp)
mov    0x10(%r15),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1080 <htons@plt>
mov    %eax,0x4(%rsp)
mov    (%r12),%edi
mov    0x8(%r15),%rsi
mov    %rbx,%rdx
call   10c0 <inet_pton@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1130 <connect@plt>
cmp    $0xffffffff,%eax
je     140f <main+0x1ef>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2800,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
test   %eax,%eax
jle    134d <main+0x12d>
lea    0x10(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
test   %eax,%eax
js     13ea <main+0x1ca>
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2800,%edx
mov    %r14,%rcx
call   1050 <fread@plt>
test   %eax,%eax
jg     1310 <main+0xf0>
mov    %r14,%rdi
call   1060 <fclose@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
lea    0xce5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
cltq
movb   $0x0,0x10(%rsp,%rax,1)
mov    $0x3e9,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edx
mov    %r13d,%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
call   1090 <send@plt>
test   %eax,%eax
js     13b6 <main+0x196>
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
jae    1390 <main+0x170>
jmp    13c2 <main+0x1a2>
lea    0xcb8(%rip),%rdi
call   1040 <puts@plt>
mov    %r13d,%edi
call   10b0 <close@plt>
lea    0xc98(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x2818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc50(%rip),%rdi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>
lea    0xbfe(%rip),%rdi
jmp    13f1 <main+0x1d1>
lea    0xc07(%rip),%rdi
jmp    13f1 <main+0x1d1>
lea    0xc13(%rip),%rdi
jmp    13f1 <main+0x1d1>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"Open file failed\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.2 = [21 x i8] c"Create socket failed\00"
@.str.3 = [24 x i8] c"Connect socket failed!\0A\00"
@.str.4 = [18 x i8] c"Send data failed\0A\00"
@.str.5 = [22 x i8] c"FILE_TRANSPORT_FINISH\00"
@.str.6 = [28 x i8] c"Finish send the end string\0A\00"
@.str.7 = [13 x i8] c"Send finish\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca %struct.sockaddr_in
%8 = alloca [10240 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 4
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @usage(i8* %20)
br label %22
22: ; preds = %17, %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %26, i32** %6
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 0)
unreachable
31: ; preds = %22
%32 = load i32, i32* @AF_INET
%33 = load i32, i32* @SOCK_DGRAM
%34 = call i32 @socket(i32 %32, i32 %33, i32 0)
store i32 %34, i32* %9
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %31
%37 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @exit(i32 0)
unreachable
39: ; preds = %31
%40 = call i32 @memset(%struct.sockaddr_in* %7, i32 0, i32 12)
%41 = load i32, i32* @AF_INET
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %41, i32* %42
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
%47 = call i32 @htons(i32 %46)
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %47, i32* %48
%49 = load i32, i32* @AF_INET
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%54 = call i32 @inet_pton(i32 %49, i8* %52, i32* %53)
store i32 12, i32* %12
%55 = load i32, i32* %9
%56 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%57 = call i32 @connect(i32 %55, %struct.sockaddr* %56, i32 4)
store i32 %57, i32* %13
%58 = load i32, i32* %13
%59 = icmp eq i32 -1, %58
br i1 %59, label %60, label %63
60: ; preds = %39
%61 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%62 = call i32 @exit(i32 0)
unreachable
63: ; preds = %39
%64 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%65 = call i32 @bzero(i8* %64, i32 10240)
br label %66
66: ; preds = %81, %63
%67 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%68 = load i32*, i32** %6
%69 = call i32 @fread(i8* %67, i32 1, i32 10240, i32* %68)
store i32 %69, i32* %10
%70 = icmp sgt i32 %69, 0
br i1 %70, label %71, label %84
71: ; preds = %66
%72 = load i32, i32* %9
%73 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%74 = load i32, i32* %10
%75 = call i32 @send(i32 %72, i8* %73, i32 %74, i32 0)
store i32 %75, i32* %11
%76 = load i32, i32* %11
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %71
%79 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%80 = call i32 @exit(i32 0)
unreachable
81: ; preds = %71
%82 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%83 = call i32 @bzero(i8* %82, i32 10240)
br label %66
84: ; preds = %66
%85 = load i32*, i32** %6
%86 = call i32 @fclose(i32* %85)
%87 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%88 = call i32 @bzero(i8* %87, i32 10240)
%89 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%90 = call i32 @strcpy(i8* %89, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%91 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%92 = call i32 @strlen(i8* %91)
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 %93
store i8 0, i8* %94
store i32 1000, i32* %14
br label %95
95: ; preds = %110, %84
%96 = load i32, i32* %14
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %113
98: ; preds = %95
%99 = load i32, i32* %9
%100 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%101 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%102 = call i32 @strlen(i8* %101)
%103 = add nsw i32 %102, 1
%104 = call i32 @send(i32 %99, i8* %100, i32 %103, i32 0)
store i32 %104, i32* %11
%105 = load i32, i32* %11
%106 = icmp slt i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %98
%108 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %113
109: ; preds = %98
br label %110
110: ; preds = %109
%111 = load i32, i32* %14
%112 = add nsw i32 %111, -1
store i32 %112, i32* %14
br label %95
113: ; preds = %107, %95
%114 = load i32, i32* %9
%115 = call i32 @close(i32 %114)
%116 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"Open file failed\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.2 = [21 x i8] c"Create socket failed\00"
@.str.3 = [24 x i8] c"Connect socket failed!\0A\00"
@.str.4 = [18 x i8] c"Send data failed\0A\00"
@.str.5 = [22 x i8] c"FILE_TRANSPORT_FINISH\00"
@str = [12 x i8] c"Send finish\00"
@str.8 = [27 x i8] c"Finish send the end string\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [10240 x i8]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = getelementptr inbounds [10240 x i8], [10240 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 4
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 @usage(i8* %9)
br label %11
11: ; preds = %8, %2
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%18 = tail call i32 @exit(i32 0)
unreachable
19: ; preds = %11
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_DGRAM
%22 = tail call i32 @socket(i32 %20, i32 %21, i32 0)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%26 = tail call i32 @exit(i32 0)
unreachable
27: ; preds = %19
%28 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%29 = load i32, i32* @AF_INET
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %29, i32* %30
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = load i8*, i8** %31
%33 = call i32 @atoi(i8* %32)
%34 = call i32 @htons(i32 %33)
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %34, i32* %35
%36 = load i32, i32* @AF_INET
%37 = getelementptr inbounds i8*, i8** %1, i64 1
%38 = load i8*, i8** %37
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%40 = call i32 @inet_pton(i32 %36, i8* %38, i32* %39)
%41 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%42 = call i32 @connect(i32 %22, %struct.sockaddr* %41, i32 4)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %47
44: ; preds = %27
%45 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%46 = call i32 @exit(i32 0)
unreachable
47: ; preds = %27
%48 = call i32 @bzero(i8* %6, i32 10240)
%49 = call i32 @fread(i8* %6, i32 1, i32 10240, i32* %14)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %62
51: ; preds = %47, %58
%52 = phi i32 [ %60, %58 ], [ %49, %47 ]
%53 = call i32 @send(i32 %22, i8* %6, i32 %52, i32 0)
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%57 = call i32 @exit(i32 0)
unreachable
58: ; preds = %51
%59 = call i32 @bzero(i8* %6, i32 10240)
%60 = call i32 @fread(i8* %6, i32 1, i32 10240, i32* %14)
%61 = icmp sgt i32 %60, 0
br i1 %61, label %51, label %62
62: ; preds = %58, %47
%63 = call i32 @fclose(i32* %14)
%64 = call i32 @bzero(i8* %6, i32 10240)
%65 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%66 = call i32 @strlen(i8* %6)
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10240 x i8], [10240 x i8]* %4, i64 0, i64 %67
store i8 0, i8* %68
br label %72
69: ; preds = %72
%70 = add nsw i32 %73, -1
%71 = icmp ugt i32 %73, 1
br i1 %71, label %72, label %80
72: ; preds = %62, %69
%73 = phi i32 [ 1000, %62 ], [ %70, %69 ]
%74 = call i32 @strlen(i8* %6)
%75 = add nsw i32 %74, 1
%76 = call i32 @send(i32 %22, i8* %6, i32 %75, i32 0)
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %69
78: ; preds = %72
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.8, i64 0, i64 0))
br label %80
80: ; preds = %69, %78
%81 = call i32 @close(i32 %22)
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}