#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*/ size;
typedef int /*<<< orphan*/ r;
typedef int /*<<< orphan*/ len;
typedef int /*<<< orphan*/ dr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_aton(char *, int /*<<< orphan*/ *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int read(int, char *, int);
int send(int, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int strlen(char *);
int main() {
  int sfd;
  int ffd;
  int r;
  int size;
  int len;
  char buf[128];
  struct sockaddr_in dr;
  char filename[] = "Makefile_";
  sfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sfd == -1) {
    printf("create socket error:%m\n");
    exit(-1);
  }
  printf("create socket success.....\n");
  dr.sin_family = AF_INET;
  dr.sin_port = htons(8888);
  inet_aton("192.168.137.3", &dr.sin_addr);
  r = connect(sfd, (struct sockaddr *)&dr, sizeof(dr));
  if (r == -1) {
    printf("connect socket error:%m\n");
    exit(-1);
  }
  printf("connect socket success.....\n");
  ffd = open(filename, O_RDONLY);
  if (ffd == -1) {
    printf("open file error:%m\n");
    exit(-1);
  }
  printf("open file success.....\n");
  len = strlen(filename);
  r = send(sfd, &len, sizeof(len), 0);
  if (r == -1) {
    printf("send filename len error:%m\n");
    exit(-1);
  }
  r = send(sfd, filename, len, 0);
  if (r == -1) {
    printf("send filename error:%m\n");
    exit(-1);
  }
  printf("send filename success.....\n");
  while (1) {
    size = read(ffd, buf, 128);
    if (size == -1) {
      printf("read file error:%m\n");
      break;
    }
    if (size == 0) {
      break;
    }
    if (size > 0) {
      r = send(sfd, &size, sizeof(r), 0);
      if (r == -1) {
        printf("send filesize error:%m\n");
        break;
      }
      send(sfd, buf, size, 0);
      if (r == -1) {
        printf("send file error:%m\n");
        break;
      }
    }
  }
  size = 0;
  r = send(sfd, &size, sizeof(size), 0);
  close(ffd);
  close(sfd);
  printf("file send success!!!!!!!!!!!!!!!!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe37(%rip),%rax
mov    %rax,-0xba(%rbp)
mov    0xe31(%rip),%ax
mov    %ax,-0xb2(%rbp)
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    121a <main+0x6a>
lea    0xdff(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0xe01(%rip),%rdi
call   1060 <printf@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    $0x22b8,%edi
call   1040 <htons@plt>
mov    %eax,-0xac(%rbp)
lea    -0xb0(%rbp),%rsi
lea    0xdeb(%rip),%rdi
call   1090 <inet_aton@plt>
mov    -0x8(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    128f <main+0xdf>
lea    0xdcc(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0xdcf(%rip),%rdi
call   1060 <printf@plt>
lea    -0xba(%rbp),%rdi
mov    0x2d37(%rip),%rax
mov    (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    12d3 <main+0x123>
lea    0xdbe(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0xdbc(%rip),%rdi
call   1060 <printf@plt>
lea    -0xba(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1050 <send@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1326 <main+0x176>
lea    0xd97(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x8(%rbp),%edi
lea    -0xba(%rbp),%rsi
mov    -0x18(%rbp),%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1050 <send@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    135f <main+0x1af>
lea    0xd7a(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    0xd7c(%rip),%rdi
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x80,%edx
call   1080 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    139d <main+0x1ed>
lea    0xd6b(%rip),%rdi
call   1060 <printf@plt>
jmp    1424 <main+0x274>
cmpl   $0x0,-0x14(%rbp)
jne    13ac <main+0x1fc>
jmp    1424 <main+0x274>
cmpl   $0x0,-0x14(%rbp)
jle    141f <main+0x26f>
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1050 <send@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    13e9 <main+0x239>
lea    0xd33(%rip),%rdi
call   1060 <printf@plt>
jmp    1424 <main+0x274>
mov    -0x8(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1050 <send@plt>
cmpl   $0xffffffff,-0x10(%rbp)
jne    141a <main+0x26a>
lea    0xd1a(%rip),%rdi
call   1060 <printf@plt>
jmp    1424 <main+0x274>
jmp    141f <main+0x26f>
jmp    136b <main+0x1bb>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1050 <send@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
lea    0xce4(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movabs $0x656c6966656b614d,%rax
69 6c 65
mov    %rax,0x10(%rsp)
movw   $0x5f,0x18(%rsp)
mov    0x2dfa(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dd8(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     13a2 <main+0x1e2>
mov    %eax,%ebx
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x28(%rsp)
mov    $0x22b8,%edi
call   1050 <htons@plt>
mov    %eax,0x24(%rsp)
lea    0xdee(%rip),%rdi
lea    0x20(%rsp),%rbp
mov    %rbp,%rsi
call   10a0 <inet_aton@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   10d0 <connect@plt>
cmp    $0xffffffff,%eax
je     13ab <main+0x1eb>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     13b4 <main+0x1f4>
mov    %eax,%r15d
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
call   1040 <strlen@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <send@plt>
cmp    $0xffffffff,%eax
je     13bd <main+0x1fd>
mov    0xc(%rsp),%edx
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <send@plt>
cmp    $0xffffffff,%eax
je     13c6 <main+0x206>
lea    0xe2b(%rip),%rdi
call   1030 <puts@plt>
lea    0x30(%rsp),%rbp
lea    0xda0(%rip),%r14
lea    0x8(%rsp),%r12
lea    0xda8(%rip),%r13
nopl   (%rax)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x80,%edx
call   1090 <read@plt>
mov    %eax,0x8(%rsp)
cmp    $0xffffffff,%eax
je     134e <main+0x18e>
test   %eax,%eax
je     1356 <main+0x196>
jle    1300 <main+0x140>
mov    $0x4,%edx
mov    %ebx,%edi
mov    %r12,%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <send@plt>
cmp    $0xffffffff,%eax
je     134b <main+0x18b>
mov    0x8(%rsp),%edx
mov    %ebx,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <send@plt>
jmp    1300 <main+0x140>
mov    %r13,%r14
mov    %r14,%rdi
call   1070 <printf@plt>
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
mov    %ebx,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1060 <send@plt>
mov    %r15d,%edi
call   1080 <close@plt>
mov    %ebx,%edi
call   1080 <close@plt>
lea    0xd9d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc61(%rip),%rdi
jmp    13cd <main+0x20d>
lea    0xc7e(%rip),%rdi
jmp    13cd <main+0x20d>
lea    0xc8e(%rip),%rdi
jmp    13cd <main+0x20d>
lea    0xc99(%rip),%rdi
jmp    13cd <main+0x20d>
lea    0xcac(%rip),%rdi
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@__const.main.filename = [10 x i8] c"Makefile_\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"create socket error:%m\0A\00"
@.str.1 = [28 x i8] c"create socket success.....\0A\00"
@.str.2 = [14 x i8] c"192.168.137.3\00"
@.str.3 = [25 x i8] c"connect socket error:%m\0A\00"
@.str.4 = [29 x i8] c"connect socket success.....\0A\00"
@O_RDONLY = global i32 0
@.str.5 = [20 x i8] c"open file error:%m\0A\00"
@.str.6 = [24 x i8] c"open file success.....\0A\00"
@.str.7 = [28 x i8] c"send filename len error:%m\0A\00"
@.str.8 = [24 x i8] c"send filename error:%m\0A\00"
@.str.9 = [28 x i8] c"send filename success.....\0A\00"
@.str.10 = [20 x i8] c"read file error:%m\0A\00"
@.str.11 = [24 x i8] c"send filesize error:%m\0A\00"
@.str.12 = [20 x i8] c"send file error:%m\0A\00"
@.str.13 = [35 x i8] c"file send success!!!!!!!!!!!!!!!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [128 x i8]
%8 = alloca %struct.sockaddr_in
%9 = alloca [10 x i8]
store i32 0, i32* %1
%10 = bitcast [10 x i8]* %9 to i8*
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = call i32 @socket(i32 %11, i32 %12, i32 0)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %21, i32* %22
%23 = call i32 @htons(i32 8888)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %23, i32* %24
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%26 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* %25)
%27 = load i32, i32* %2
%28 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%29 = call i32 @connect(i32 %27, %struct.sockaddr* %28, i32 12)
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %35
32: ; preds = %19
%33 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %19
%36 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%38 = load i32, i32* @O_RDONLY
%39 = call i32 @open(i8* %37, i32 %38)
store i32 %39, i32* %3
%40 = load i32, i32* %3
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%44 = call i32 @exit(i32 -1)
unreachable
45: ; preds = %35
%46 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
store i32 %48, i32* %6
%49 = load i32, i32* %2
%50 = call i32 (i32, ...) @send(i32 %49, i32* %6, i64 4, i32 0)
store i32 %50, i32* %4
%51 = load i32, i32* %4
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %56
53: ; preds = %45
%54 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%55 = call i32 @exit(i32 -1)
unreachable
56: ; preds = %45
%57 = load i32, i32* %2
%58 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%59 = load i32, i32* %6
%60 = call i32 (i32, ...) @send(i32 %57, i8* %58, i32 %59, i32 0)
store i32 %60, i32* %4
%61 = load i32, i32* %4
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %66
63: ; preds = %56
%64 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%65 = call i32 @exit(i32 -1)
unreachable
66: ; preds = %56
%67 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
br label %68
68: ; preds = %66, %100
%69 = load i32, i32* %3
%70 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%71 = call i32 @read(i32 %69, i8* %70, i32 128)
store i32 %71, i32* %5
%72 = load i32, i32* %5
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %101
76: ; preds = %68
%77 = load i32, i32* %5
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %76
br label %101
80: ; preds = %76
%81 = load i32, i32* %5
%82 = icmp sgt i32 %81, 0
br i1 %82, label %83, label %100
83: ; preds = %80
%84 = load i32, i32* %2
%85 = call i32 (i32, ...) @send(i32 %84, i32* %5, i64 4, i32 0)
store i32 %85, i32* %4
%86 = load i32, i32* %4
%87 = icmp eq i32 %86, -1
br i1 %87, label %88, label %90
88: ; preds = %83
%89 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0))
br label %101
90: ; preds = %83
%91 = load i32, i32* %2
%92 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%93 = load i32, i32* %5
%94 = call i32 (i32, ...) @send(i32 %91, i8* %92, i32 %93, i32 0)
%95 = load i32, i32* %4
%96 = icmp eq i32 %95, -1
br i1 %96, label %97, label %99
97: ; preds = %90
%98 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %101
99: ; preds = %90
br label %100
100: ; preds = %99, %80
br label %68
101: ; preds = %97, %88, %79, %74
store i32 0, i32* %5
%102 = load i32, i32* %2
%103 = call i32 (i32, ...) @send(i32 %102, i32* %5, i64 4, i32 0)
store i32 %103, i32* %4
%104 = load i32, i32* %3
%105 = call i32 @close(i32 %104)
%106 = load i32, i32* %2
%107 = call i32 @close(i32 %106)
%108 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@__const.main.filename = [10 x i8] c"Makefile_\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [24 x i8] c"create socket error:%m\0A\00"
@.str.2 = [14 x i8] c"192.168.137.3\00"
@.str.3 = [25 x i8] c"connect socket error:%m\0A\00"
@O_RDONLY = global i32 0
@.str.5 = [20 x i8] c"open file error:%m\0A\00"
@.str.7 = [28 x i8] c"send filename len error:%m\0A\00"
@.str.8 = [24 x i8] c"send filename error:%m\0A\00"
@.str.10 = [20 x i8] c"read file error:%m\0A\00"
@.str.11 = [24 x i8] c"send filesize error:%m\0A\00"
@str = [27 x i8] c"create socket success.....\00"
@str.14 = [28 x i8] c"connect socket success.....\00"
@str.15 = [23 x i8] c"open file success.....\00"
@str.16 = [27 x i8] c"send filename success.....\00"
@str.17 = [34 x i8] c"file send success!!!!!!!!!!!!!!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca %struct.sockaddr_in
%5 = alloca [10 x i8]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @exit(i32 -1)
unreachable
18: ; preds = %0
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %20, i32* %21
%22 = tail call i32 @htons(i32 8888)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %22, i32* %23
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%25 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32* %24)
%26 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%27 = call i32 @connect(i32 %13, %struct.sockaddr* %26, i32 12)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %18
%30 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %18
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
%34 = load i32, i32* @O_RDONLY
%35 = call i32 @open(i8* %10, i32 %34)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @exit(i32 -1)
unreachable
40: ; preds = %32
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%42 = call i32 @strlen(i8* %10)
store i32 %42, i32* %2
%43 = call i32 (i32, ...) @send(i32 %13, i32* %2, i64 4, i32 0)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%47 = call i32 @exit(i32 -1)
unreachable
48: ; preds = %40
%49 = load i32, i32* %2
%50 = call i32 (i32, ...) @send(i32 %13, i8* %10, i32 %49, i32 0)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%54 = call i32 @exit(i32 -1)
unreachable
55: ; preds = %48
%56 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.16, i64 0, i64 0))
br label %57
57: ; preds = %67, %55
%58 = call i32 @read(i32 %35, i8* %8, i32 128)
store i32 %58, i32* %1
switch i32 %58, label %59 [
i32 -1, label %68
i32 0, label %71
]
59: ; preds = %57
%60 = icmp sgt i32 %58, 0
br i1 %60, label %61, label %67
61: ; preds = %59
%62 = call i32 (i32, ...) @send(i32 %13, i32* %1, i64 4, i32 0)
%63 = icmp eq i32 %62, -1
br i1 %63, label %68, label %64
64: ; preds = %61
%65 = load i32, i32* %1
%66 = call i32 (i32, ...) @send(i32 %13, i8* %8, i32 %65, i32 0)
br label %67
67: ; preds = %64, %59
br label %57
68: ; preds = %61, %57
%69 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), %57 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i64 0, i64 0), %61 ]
%70 = call i32 @printf(i8* dereferenceable(1) %69)
br label %71
71: ; preds = %57, %68
store i32 0, i32* %1
%72 = call i32 (i32, ...) @send(i32 %13, i32* %1, i64 4, i32 0)
%73 = call i32 @close(i32 %35)
%74 = call i32 @close(i32 %13)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.17, i64 0, i64 0))
ret i32 0
}