#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 /*<<< orphan*/ sin;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
scalar_t__ O_CREAT;
scalar_t__ O_WRONLY;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(unsigned short);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int open(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, unsigned char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ shutdown(int, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strtoul(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int write(int, unsigned char *, int);
int main(int argc, char **argv) {
  unsigned short port;
  char *tsfilename;
  int ts;
  if (argc < 3) {
    printf("usage: %s <port> <filename>\n", argv[0]);
    return 1;
  }
  port = strtoul(argv[1], NULL, 0) & 0x1fff;
  tsfilename = argv[2];
  int skt_serv;
  struct sockaddr_in sin;
  skt_serv = socket(PF_INET, SOCK_DGRAM, 0);
  if (skt_serv < 0) {
    fprintf(stderr, "Cannot open SOCKET.\n");
    exit(-1);
  }
  memset(&sin, 0, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = htonl(INADDR_ANY);
  sin.sin_port = htons(port);
  if (bind(skt_serv, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
    fprintf(stderr, "Cannot bind SOCKET for port %d.\n", port);
    shutdown(skt_serv, 2);
    exit(-1);
  }
  if ((ts = open(tsfilename, O_WRONLY || O_CREAT)) < 0) {
    perror(tsfilename);
    return 1;
  }
  unsigned char buf[384 * 188];
  int done;
  int wr;
  for (;;) {
    int len;
    len = recv(skt_serv, buf, 384 * 188, 0);
    if (len < 0) {
      perror("recv()");
      break;
    }
    done = 0;
    while (len > 0) {
      if ((wr = write(ts, &buf[done], len)) <= 0)
        continue;
      printf("[%d bytes written]\n", wr);
      len -= wr;
      done += wr;
    }
  }
  close(ts);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x11a60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1234 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1475 <main+0x285>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10f0 <strtoul@plt>
and    $0x1fff,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%edi
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    12a3 <main+0xb3>
mov    0x2d37(%rip),%rax
mov    (%rax),%edi
lea    0xd8b(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x34(%rbp)
movzwl -0x12(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    1329 <main+0x139>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
movzwl -0x12(%rbp),%edx
lea    0xd27(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x28(%rbp),%edi
mov    $0x2,%esi
call   1050 <shutdown@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x11a58(%rbp)
mov    $0x1,%al
mov    0x2c6b(%rip),%rcx
cmpq   $0x0,(%rcx)
mov    %al,-0x11a4d(%rbp)
jne    1361 <main+0x171>
mov    0x2ca4(%rip),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x11a4d(%rbp)
mov    -0x11a58(%rbp),%rdi
mov    -0x11a4d(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
call   10d0 <open@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jge    1399 <main+0x1a9>
mov    -0x20(%rbp),%rdi
call   10e0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1475 <main+0x285>
jmp    139e <main+0x1ae>
mov    -0x28(%rbp),%edi
lea    -0x11a40(%rbp),%rsi
mov    $0x11a00,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x11a4c(%rbp)
cmpl   $0x0,-0x11a4c(%rbp)
jge    13d8 <main+0x1e8>
lea    0xc85(%rip),%rdi
call   10e0 <perror@plt>
jmp    1466 <main+0x276>
movl   $0x0,-0x11a44(%rbp)
cmpl   $0x0,-0x11a4c(%rbp)
jle    1461 <main+0x271>
mov    -0x24(%rbp),%edi
movslq -0x11a44(%rbp),%rax
lea    -0x11a40(%rbp),%rsi
add    %rax,%rsi
mov    -0x11a4c(%rbp),%edx
call   1040 <write@plt>
mov    %eax,-0x11a48(%rbp)
cmp    $0x0,%eax
jg     1422 <main+0x232>
jmp    13e2 <main+0x1f2>
mov    -0x11a48(%rbp),%esi
lea    0xc2b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x11a48(%rbp),%ecx
mov    -0x11a4c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x11a4c(%rbp)
mov    -0x11a48(%rbp),%eax
add    -0x11a44(%rbp),%eax
mov    %eax,-0x11a44(%rbp)
jmp    13e2 <main+0x1f2>
jmp    139e <main+0x1ae>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x11a60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x11a28,%rsp
mov    %rsi,%rbp
cmp    $0x2,%edi
jg     1232 <main+0x42>
mov    0x0(%rbp),%rsi
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%eax
add    $0x11a28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbp),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <strtoul@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%r14
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
mov    0x2d7b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     13a4 <main+0x1b4>
mov    %eax,%r15d
and    $0x1fff,%ebx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d56(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x14(%rsp)
movzwl %bx,%ebx
mov    %ebx,%edi
call   1060 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
test   %rax,%rax
js     13c5 <main+0x1d5>
mov    0x2cd8(%rip),%rax
mov    (%rax),%rax
mov    0x2d1e(%rip),%rcx
xor    %esi,%esi
or     (%rcx),%rax
setne  %sil
mov    %r14,%rdi
call   10d0 <open@plt>
test   %eax,%eax
jns    12fc <main+0x10c>
mov    %r14,%rdi
call   10e0 <perror@plt>
jmp    121b <main+0x2b>
mov    %eax,%ebp
lea    0x20(%rsp),%rsi
mov    %r15d,%edi
mov    $0x11a00,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jns    1330 <main+0x140>
lea    0xd36(%rip),%rdi
call   10e0 <perror@plt>
mov    %ebp,%edi
call   10a0 <close@plt>
xor    %eax,%eax
jmp    1220 <main+0x30>
mov    %eax,%ebx
lea    0xd21(%rip),%r13
mov    %r15d,0xc(%rsp)
jmp    135b <main+0x16b>
mov    0xc(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x11a00,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1316 <main+0x126>
test   %ebx,%ebx
je     1340 <main+0x150>
xor    %r14d,%r14d
lea    0x20(%rsp),%r12
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <write@plt>
test   %eax,%eax
jle    1370 <main+0x180>
mov    %eax,%r15d
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
add    %r15d,%r14d
movslq %r14d,%rax
lea    (%rsp,%rax,1),%r12
add    $0x20,%r12
sub    %r15d,%ebx
jg     1370 <main+0x180>
jmp    1340 <main+0x150>
mov    0x2c15(%rip),%rax
mov    (%rax),%edi
lea    0xc69(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>
mov    0x2bf4(%rip),%rax
mov    (%rax),%edi
lea    0xc5d(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r15d,%edi
mov    $0x2,%esi
call   1050 <shutdown@plt>
mov    $0xffffffff,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"usage: %s <port> <filename>\0A\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stderr = global i32 0
@.str.1 = [21 x i8] c"Cannot open SOCKET.\0A\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [33 x i8] c"Cannot bind SOCKET for port %d.\0A\00"
@O_WRONLY = global i64 0
@O_CREAT = global i64 0
@.str.3 = [7 x i8] c"recv()\00"
@.str.4 = [20 x i8] c"[%d bytes written]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = alloca [72192 x i8]
%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 slt i32 %15, 3
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 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 1, i32* %3
br label %114
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strtoul(i8* %25, i32* null, i32 0)
%27 = and i32 %26, 8191
%28 = trunc i32 %27 to i16
store i16 %28, i16* %6
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
store i8* %31, i8** %7
%32 = load i32, i32* @PF_INET
%33 = load i32, i32* @SOCK_DGRAM
%34 = call i32 @socket(i32 %32, i32 %33, i32 0)
store i32 %34, i32* %9
%35 = load i32, i32* %9
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %22
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @exit(i32 -1)
unreachable
41: ; preds = %22
%42 = call i32 @memset(%struct.sockaddr_in* %10, i32 0, i32 12)
%43 = load i32, i32* @AF_INET
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %43, i32* %44
%45 = load i32, i32* @INADDR_ANY
%46 = call i32 @htonl(i32 %45)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%48 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %47, i32 0, i32 0
store i32 %46, i32* %48
%49 = load i16, i16* %6
%50 = call i32 @htons(i16 zeroext %49)
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
store i32 %50, i32* %51
%52 = load i32, i32* %9
%53 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%54 = call i64 @bind(i32 %52, %struct.sockaddr* %53, i32 12)
%55 = icmp slt i64 %54, 0
br i1 %55, label %56, label %64
56: ; preds = %41
%57 = load i32, i32* @stderr
%58 = load i16, i16* %6
%59 = zext i16 %58 to i32
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %9
%62 = call i32 @shutdown(i32 %61, i32 2)
%63 = call i32 @exit(i32 -1)
unreachable
64: ; preds = %41
%65 = load i8*, i8** %7
%66 = load i64, i64* @O_WRONLY
%67 = icmp ne i64 %66, 0
br i1 %67, label %71, label %68
68: ; preds = %64
%69 = load i64, i64* @O_CREAT
%70 = icmp ne i64 %69, 0
br label %71
71: ; preds = %68, %64
%72 = phi i1 [ true, %64 ], [ %70, %68 ]
%73 = zext i1 %72 to i32
%74 = call i32 @open(i8* %65, i32 %73)
store i32 %74, i32* %8
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = load i8*, i8** %7
%78 = call i32 @perror(i8* %77)
store i32 1, i32* %3
br label %114
79: ; preds = %71
br label %80
80: ; preds = %110, %79
%81 = load i32, i32* %9
%82 = getelementptr inbounds [72192 x i8], [72192 x i8]* %11, i64 0, i64 0
%83 = call i32 @recv(i32 %81, i8* %82, i32 72192, i32 0)
store i32 %83, i32* %14
%84 = load i32, i32* %14
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %80
%87 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %111
88: ; preds = %80
store i32 0, i32* %12
br label %89
89: ; preds = %101, %100, %88
%90 = load i32, i32* %14
%91 = icmp sgt i32 %90, 0
br i1 %91, label %92, label %110
92: ; preds = %89
%93 = load i32, i32* %8
%94 = load i32, i32* %12
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [72192 x i8], [72192 x i8]* %11, i64 0, i64 %95
%97 = load i32, i32* %14
%98 = call i32 @write(i32 %93, i8* %96, i32 %97)
store i32 %98, i32* %13
%99 = icmp sle i32 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %92
br label %89
101: ; preds = %92
%102 = load i32, i32* %13
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %102)
%104 = load i32, i32* %13
%105 = load i32, i32* %14
%106 = sub nsw i32 %105, %104
store i32 %106, i32* %14
%107 = load i32, i32* %13
%108 = load i32, i32* %12
%109 = add nsw i32 %108, %107
store i32 %109, i32* %12
br label %89
110: ; preds = %89
br label %80
111: ; preds = %86
%112 = load i32, i32* %8
%113 = call i32 @close(i32 %112)
store i32 0, i32* %3
br label %114
114: ; preds = %111, %76, %17
%115 = load i32, i32* %3
ret i32 %115
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"usage: %s <port> <filename>\0A\00"
@PF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@stderr = global i32 0
@.str.1 = [21 x i8] c"Cannot open SOCKET.\0A\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [33 x i8] c"Cannot bind SOCKET for port %d.\0A\00"
@O_WRONLY = global i64 0
@O_CREAT = global i64 0
@.str.3 = [7 x i8] c"recv()\00"
@.str.4 = [20 x i8] c"[%d bytes written]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [72192 x i8]
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %84
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @strtoul(i8* nocapture %11, i32* null, i32 0)
%13 = trunc i32 %12 to i16
%14 = and i16 %13, 8191
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = bitcast %struct.sockaddr_in* %3 to i8*
%18 = load i32, i32* @PF_INET
%19 = load i32, i32* @SOCK_DGRAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %9
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%25 = tail call i32 @exit(i32 -1)
unreachable
26: ; preds = %9
%27 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%28 = load i32, i32* @AF_INET
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %28, i32* %29
%30 = load i32, i32* @INADDR_ANY
%31 = call i32 @htonl(i32 %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %31, i32* %32
%33 = call i32 @htons(i16 zeroext %14)
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %33, i32* %34
%35 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%36 = call i64 @bind(i32 %20, %struct.sockaddr* %35, i32 12)
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %26
%39 = load i32, i32* @stderr
%40 = zext i16 %14 to i32
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = call i32 @shutdown(i32 %20, i32 2)
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %26
%45 = load i64, i64* @O_WRONLY
%46 = icmp ne i64 %45, 0
%47 = load i64, i64* @O_CREAT
%48 = icmp ne i64 %47, 0
%49 = select i1 %46, i1 true, i1 %48
%50 = zext i1 %49 to i32
%51 = call i32 @open(i8* %16, i32 %50)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %44
%54 = call i32 @perror(i8* %16)
br label %82
55: ; preds = %44
%56 = getelementptr inbounds [72192 x i8], [72192 x i8]* %4, i64 0, i64 0
%57 = call i32 @recv(i32 %20, i8* %56, i32 72192, i32 0)
%58 = icmp slt i32 %57, 0
br i1 %58, label %79, label %62
59: ; preds = %72, %62
%60 = call i32 @recv(i32 %20, i8* %56, i32 72192, i32 0)
%61 = icmp slt i32 %60, 0
br i1 %61, label %79, label %62
62: ; preds = %55, %59
%63 = phi i32 [ %60, %59 ], [ %57, %55 ]
%64 = icmp eq i32 %63, 0
br i1 %64, label %59, label %65
65: ; preds = %62, %72
%66 = phi i8* [ %78, %72 ], [ %56, %62 ]
%67 = phi i32 [ %74, %72 ], [ %63, %62 ]
%68 = phi i32 [ %75, %72 ], [ 0, %62 ]
br label %69
69: ; preds = %65, %69
%70 = call i32 @write(i32 %51, i8* %66, i32 %67)
%71 = icmp slt i32 %70, 1
br i1 %71, label %69, label %72
72: ; preds = %69
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %70)
%74 = sub nsw i32 %67, %70
%75 = add nsw i32 %70, %68
%76 = icmp sgt i32 %74, 0
%77 = sext i32 %75 to i64
%78 = getelementptr inbounds [72192 x i8], [72192 x i8]* %4, i64 0, i64 %77
br i1 %76, label %65, label %59
79: ; preds = %59, %55
%80 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%81 = call i32 @close(i32 %51)
br label %82
82: ; preds = %79, %53
%83 = phi i32 [ 1, %53 ], [ 0, %79 ]
br label %84
84: ; preds = %82, %6
%85 = phi i32 [ 1, %6 ], [ %83, %82 ]
ret i32 %85
}