#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 int socklen_t;
typedef int /*<<< orphan*/ serv_adr;
typedef int /*<<< orphan*/ clnt_adr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SHUT_WR;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ error_handling(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(void *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int serv_sd, clnt_sd;
  char buf[1024];
  int read_cnt;
  struct sockaddr_in serv_adr;
  struct sockaddr_in clnt_adr;
  socklen_t clnt_adr_sz;
  FILE *fp;
  if (argc != 2) {
    printf("Usage : %s <port>\n", argv[0]);
    exit(1);
  }
  fp = fopen("lec11.pdf", "rb");
  serv_sd = socket(PF_INET, SOCK_STREAM, 0);
  if (serv_sd == -1)
    error_handling("socket() error");
  memset(&serv_adr, 0, sizeof(serv_adr));
  serv_adr.sin_family = AF_INET;
  serv_adr.sin_addr.s_addr = htonl(INADDR_ANY);
  serv_adr.sin_port = htons(atoi(argv[1]));
  if (bind(serv_sd, (struct sockaddr *)&serv_adr, sizeof(serv_adr)) == -1)
    error_handling("bind() error");
  if (listen(serv_sd, 5) == -1)
    error_handling("listen() error");
  clnt_adr_sz = sizeof(clnt_adr);
  clnt_sd = accept(serv_sd, (struct sockaddr *)&clnt_adr, &clnt_adr_sz);
  if (clnt_sd == -1)
    error_handling("accept() error");
  else
    printf("Connected client 1 \n");
  while (1) {
    read_cnt = fread((void *)buf, 1, 1024, fp);
    if (read_cnt < 1024) {
      write(clnt_sd, buf, read_cnt);
      break;
    }
    write(clnt_sd, buf, 1024);
  }
  shutdown(clnt_sd, SHUT_WR);
  read(clnt_sd, buf, 1024);
  printf("Message from client:%s \n", buf);
  fclose(fp);
  close(clnt_sd);
  close(serv_sd);
  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   $0x2,-0x8(%rbp)
je     1262 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0xdaa(%rip),%rdi
lea    0xdad(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x450(%rbp)
mov    0x2d3d(%rip),%rax
mov    (%rax),%edi
mov    0x2d3c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12ae <main+0x8e>
lea    0xd77(%rip),%rdi
call   10d0 <error_handling@plt>
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x428(%rbp)
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0x42c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1120 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %eax,-0x430(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
cmp    $0xffffffff,%eax
jne    1327 <main+0x107>
lea    0xd0d(%rip),%rdi
call   10d0 <error_handling@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10e0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1349 <main+0x129>
lea    0xcf8(%rip),%rdi
call   10d0 <error_handling@plt>
movl   $0xc,-0x444(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x440(%rbp),%rsi
lea    -0x444(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1387 <main+0x167>
lea    0xcce(%rip),%rdi
call   10d0 <error_handling@plt>
jmp    1395 <main+0x175>
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    139a <main+0x17a>
lea    -0x420(%rbp),%rdi
mov    -0x450(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1030 <fread@plt>
mov    %eax,-0x424(%rbp)
cmpl   $0x400,-0x424(%rbp)
jge    13e7 <main+0x1c7>
mov    -0x18(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    -0x424(%rbp),%edx
call   1040 <write@plt>
jmp    1400 <main+0x1e0>
mov    -0x18(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <write@plt>
jmp    139a <main+0x17a>
mov    -0x18(%rbp),%edi
mov    0x2bd6(%rip),%rax
mov    (%rax),%esi
call   1060 <shutdown@plt>
mov    -0x18(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   10c0 <read@plt>
lea    -0x420(%rbp),%rsi
lea    0xc3c(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x450(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x18(%rbp),%edi
call   10b0 <close@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x430,%rsp
mov    %rsi,%r15
cmp    $0x2,%edi
jne    1415 <main+0x1e5>
lea    0xdc1(%rip),%rdi
lea    0xdc4(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%r12
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
mov    0x2d57(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
jne    128e <main+0x5e>
lea    0xd97(%rip),%rdi
call   10e0 <error_handling@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    0x8(%r15),%rdi
call   1130 <atoi@plt>
mov    %eax,%edi
call   1080 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
cmp    $0xffffffff,%eax
jne    12f6 <main+0xc6>
lea    0xd3e(%rip),%rdi
call   10e0 <error_handling@plt>
mov    %r14d,%edi
mov    $0x5,%esi
call   10f0 <listen@plt>
cmp    $0xffffffff,%eax
jne    1314 <main+0xe4>
lea    0xd2d(%rip),%rdi
call   10e0 <error_handling@plt>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   1120 <accept@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1343 <main+0x113>
lea    0xd37(%rip),%rdi
call   1030 <puts@plt>
jmp    134f <main+0x11f>
lea    0xd01(%rip),%rdi
call   10e0 <error_handling@plt>
lea    0x30(%rsp),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jl     13ab <main+0x17b>
lea    0x30(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1050 <write@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jge    1380 <main+0x150>
lea    0x30(%rsp),%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1050 <write@plt>
mov    0x2c1d(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1070 <shutdown@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   10d0 <read@plt>
lea    0xc78(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r12,%rdi
call   1060 <fclose@plt>
mov    %ebp,%edi
call   10c0 <close@plt>
mov    %r14d,%edi
call   10c0 <close@plt>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r15),%rsi
lea    0xbe1(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [19 x i8] c"Usage : %s <port>\0A\00"
@.str.1 = [10 x i8] c"lec11.pdf\00"
@.str.2 = [3 x i8] c"rb\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [15 x i8] c"socket() error\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind() error\00"
@.str.5 = [15 x i8] c"listen() error\00"
@.str.6 = [15 x i8] c"accept() error\00"
@.str.7 = [21 x i8] c"Connected client 1 \0A\00"
@SHUT_WR = global i32 0
@.str.8 = [25 x i8] c"Message from client:%s \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 i32
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32*
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, 2
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %23, i32** %13
%24 = load i32, i32* @PF_INET
%25 = load i32, i32* @SOCK_STREAM
%26 = call i32 @socket(i32 %24, i32 %25, i32 0)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %22
%32 = call i32 @memset(%struct.sockaddr_in* %10, i32 0, i32 12)
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %33, i32* %34
%35 = load i32, i32* @INADDR_ANY
%36 = call i32 @htonl(i32 %35)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%38 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %37, i32 0, i32 0
store i32 %36, i32* %38
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
%43 = call i32 @htons(i32 %42)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
store i32 %43, i32* %44
%45 = load i32, i32* %6
%46 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%47 = call i32 @bind(i32 %45, %struct.sockaddr* %46, i32 12)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %31
%50 = call i32 @error_handling(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %51
51: ; preds = %49, %31
%52 = load i32, i32* %6
%53 = call i32 @listen(i32 %52, i32 5)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %57
57: ; preds = %55, %51
store i32 12, i32* %12
%58 = load i32, i32* %6
%59 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%60 = call i32 @accept(i32 %58, %struct.sockaddr* %59, i32* %12)
store i32 %60, i32* %7
%61 = load i32, i32* %7
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %65
63: ; preds = %57
%64 = call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %67
65: ; preds = %57
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %67
67: ; preds = %65, %63
br label %68
68: ; preds = %67, %79
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%70 = load i32*, i32** %13
%71 = call i32 @fread(i8* %69, i32 1, i32 1024, i32* %70)
store i32 %71, i32* %9
%72 = load i32, i32* %9
%73 = icmp slt i32 %72, 1024
br i1 %73, label %74, label %79
74: ; preds = %68
%75 = load i32, i32* %7
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%77 = load i32, i32* %9
%78 = call i32 @write(i32 %75, i8* %76, i32 %77)
br label %83
79: ; preds = %68
%80 = load i32, i32* %7
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%82 = call i32 @write(i32 %80, i8* %81, i32 1024)
br label %68
83: ; preds = %74
%84 = load i32, i32* %7
%85 = load i32, i32* @SHUT_WR
%86 = call i32 @shutdown(i32 %84, i32 %85)
%87 = load i32, i32* %7
%88 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%89 = call i32 @read(i32 %87, i8* %88, i32 1024)
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %90)
%92 = load i32*, i32** %13
%93 = call i32 @fclose(i32* %92)
%94 = load i32, i32* %7
%95 = call i32 @close(i32 %94)
%96 = load i32, i32* %6
%97 = call i32 @close(i32 %96)
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 = [19 x i8] c"Usage : %s <port>\0A\00"
@.str.1 = [10 x i8] c"lec11.pdf\00"
@.str.2 = [3 x i8] c"rb\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [15 x i8] c"socket() error\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind() error\00"
@.str.5 = [15 x i8] c"listen() error\00"
@.str.6 = [15 x i8] c"accept() error\00"
@SHUT_WR = global i32 0
@.str.8 = [25 x i8] c"Message from client:%s \0A\00"
@str = [20 x i8] c"Connected client 1 \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast %struct.sockaddr_in* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* @PF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = tail call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %24
24: ; preds = %22, %16
%25 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %26, i32* %27
%28 = load i32, i32* @INADDR_ANY
%29 = call i32 @htonl(i32 %28)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %29, i32* %30
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%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* %4, i64 0, i32 0
store i32 %34, i32* %35
%36 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%37 = call i32 @bind(i32 %20, %struct.sockaddr* %36, i32 12)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %24
%40 = call i32 @error_handling(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39, %24
%42 = call i32 @listen(i32 %20, i32 5)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %44, %41
store i32 12, i32* %6
%47 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%48 = call i32 @accept(i32 %20, %struct.sockaddr* %47, i32* %6)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @error_handling(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %54
52: ; preds = %46
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
%55 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %17)
%56 = icmp slt i32 %55, 1024
br i1 %56, label %57, label %67
57: ; preds = %67, %54
%58 = phi i32 [ %55, %54 ], [ %69, %67 ]
%59 = call i32 @write(i32 %48, i8* %7, i32 %58)
%60 = load i32, i32* @SHUT_WR
%61 = call i32 @shutdown(i32 %48, i32 %60)
%62 = call i32 @read(i32 %48, i8* %7, i32 1024)
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%64 = call i32 @fclose(i32* %17)
%65 = call i32 @close(i32 %48)
%66 = call i32 @close(i32 %20)
ret i32 0
67: ; preds = %54, %67
%68 = call i32 @write(i32 %48, i8* %7, i32 1024)
%69 = call i32 @fread(i8* %7, i32 1, i32 1024, i32* %17)
%70 = icmp slt i32 %69, 1024
br i1 %70, label %57, label %67
}