#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_port;
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ sin;
typedef int /*<<< orphan*/ data;
typedef int /*<<< orphan*/ ack;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ file_exists(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_aton(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *,
             int /*<<< orphan*/ *);
int /*<<< orphan*/ sendto(int, char *, int, int /*<<< orphan*/,
                          struct sockaddr *, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    usage(argv[0]);
  }
  char *filename = argv[1];
  if (file_exists(filename)) {
    error("exists");
  }
  FILE *fp = fopen(filename, "wb");
  if (!fp) {
    error("file");
  }
  int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
  if (sockfd < 0) {
    error("sock");
  }
  int port = 32581;
  char *server = "127.0.0.1";
  struct sockaddr_in sin;
  socklen_t sin_len = sizeof(sin);
  socklen_t *sin_lenp = &sin_len;
  sin.sin_family = AF_INET;
  if (!inet_aton(server, &(sin.sin_addr))) {
    printf("invalid server IP %s\n", server);
    exit(1);
  }
  sin.sin_port = htons(port);
  struct sockaddr *sap = (struct sockaddr *)(&sin);
  if (bind(sockfd, sap, sizeof(sin)) != 0) {
    error("bind");
  }
  int seq_counter = 0;
  char data[101];
  char ack[1];
  int rcvd;
  while (1) {
    rcvd = recvfrom(sockfd, data, sizeof(data), 0, (struct sockaddr *)&sin,
                    sin_lenp);
    int seq = (int)(data[0] - '0');
    if ((seq_counter % 2) == seq) {
      fwrite(data + 1, sizeof(char), rcvd - 1, fp);
      seq_counter++;
    }
    ack[0] = (char)(((int)'2') + (seq % 2));
    sendto(sockfd, ack, sizeof(ack), 0, (struct sockaddr *)&sin, sin_len);
    if (rcvd < 100) {
      break;
    }
  }
  fclose(fp);
  close(sockfd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     121f <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <file_exists@plt>
cmp    $0x0,%rax
je     124a <main+0x5a>
lea    0xdbb(%rip),%rdi
call   10d0 <error@plt>
mov    -0x18(%rbp),%rdi
lea    0xdb2(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1275 <main+0x85>
lea    0xd9a(%rip),%rdi
call   10d0 <error@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
mov    0x2d5b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    12a7 <main+0xb7>
lea    0xd6d(%rip),%rdi
call   10d0 <error@plt>
movl   $0x7f45,-0x28(%rbp)
lea    0xd5f(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0xc,-0x44(%rbp)
lea    -0x44(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2d19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
add    $0x4,%rsi
call   1090 <inet_aton@plt>
cmp    $0x0,%eax
jne    1308 <main+0x118>
mov    -0x30(%rbp),%rsi
lea    0xd25(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x40(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x58(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
je     1342 <main+0x152>
lea    0xcf7(%rip),%rdi
call   10d0 <error@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x24(%rbp),%edi
lea    -0xd0(%rbp),%rsi
lea    -0x40(%rbp),%r8
mov    -0x50(%rbp),%r9
mov    $0x65,%edx
xor    %ecx,%ecx
call   10a0 <recvfrom@plt>
mov    %eax,-0xd8(%rbp)
movsbl -0xd0(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xdc(%rbp)
mov    -0x5c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    -0xdc(%rbp),%edx
jne    13bf <main+0x1cf>
lea    -0xd0(%rbp),%rdi
add    $0x1,%rdi
mov    -0xd8(%rbp),%edx
sub    $0x1,%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1100 <fwrite@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0xdc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x32,%edx
mov    %dl,%al
mov    %al,-0xd1(%rbp)
mov    -0x24(%rbp),%edi
lea    -0xd1(%rbp),%rsi
lea    -0x40(%rbp),%r8
mov    -0x44(%rbp),%r9d
mov    $0x1,%edx
xor    %ecx,%ecx
call   1070 <sendto@plt>
cmpl   $0x64,-0xd8(%rbp)
jge    1408 <main+0x218>
jmp    140d <main+0x21d>
jmp    1349 <main+0x159>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x24(%rbp),%edi
call   1080 <close@plt>
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1211 <main+0x21>
mov    (%rbx),%rdi
call   10b0 <usage@plt>
mov    0x8(%rbx),%rbx
mov    %rbx,%rdi
call   1030 <file_exists@plt>
test   %rax,%rax
je     122e <main+0x3e>
lea    0xdd7(%rip),%rdi
call   10d0 <error@plt>
lea    0xdd2(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    1253 <main+0x63>
lea    0xdbc(%rip),%rdi
call   10d0 <error@plt>
mov    0x2d8e(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d7d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    127e <main+0x8e>
lea    0xd96(%rip),%rdi
call   10d0 <error@plt>
movl   $0xc,0x4(%rsp)
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
lea    0xc(%rsp),%rsi
lea    0xd7c(%rip),%rdi
call   1090 <inet_aton@plt>
test   %eax,%eax
je     13ae <main+0x1be>
mov    $0x7f45,%edi
call   1050 <htons@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   10c0 <bind@plt>
test   %rax,%rax
je     12d5 <main+0xe5>
lea    0xd64(%rip),%rdi
call   10d0 <error@plt>
xor    %r12d,%r12d
lea    0x8(%rsp),%rbx
lea    0x3(%rsp),%r14
jmp    132a <main+0x13a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzwl %r13w,%eax
shr    $0xf,%eax
add    %r13d,%eax
and    $0xfe,%eax
sub    %eax,%r13d
add    $0x32,%r13b
mov    %r13b,0x3(%rsp)
mov    0x4(%rsp),%r9d
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1070 <sendto@plt>
cmp    $0x63,%r15d
jle    1389 <main+0x199>
mov    %ebp,%edi
lea    0x20(%rsp),%rsi
mov    $0x65,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
lea    0x4(%rsp),%r9
call   10a0 <recvfrom@plt>
mov    %eax,%r15d
movsbl 0x20(%rsp),%r13d
add    $0xffffffd0,%r13d
mov    %r12d,%eax
shr    $0x1f,%eax
add    %r12d,%eax
and    $0xfffffffe,%eax
mov    %r12d,%ecx
sub    %eax,%ecx
cmp    %r13d,%ecx
jne    12f0 <main+0x100>
lea    -0x1(%r15),%edx
lea    0x21(%rsp),%rdi
mov    $0x1,%esi
mov    0x18(%rsp),%rcx
call   1100 <fwrite@plt>
add    $0x1,%r12d
jmp    12f0 <main+0x100>
mov    0x18(%rsp),%rdi
call   1040 <fclose@plt>
mov    %ebp,%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc69(%rip),%rdi
lea    0xc58(%rip),%rsi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"exists\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [5 x i8] c"file\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [5 x i8] c"sock\00"
@.str.4 = [10 x i8] c"127.0.0.1\00"
@.str.5 = [22 x i8] c"invalid server IP %s\0A\00"
@.str.6 = [5 x i8] c"bind\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 i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca i32*
%14 = alloca %struct.sockaddr*
%15 = alloca i32
%16 = alloca [101 x i8]
%17 = alloca [1 x i8]
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp ne i32 %20, 2
br i1 %21, label %22, label %27
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @usage(i8* %25)
br label %27
27: ; preds = %22, %2
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
store i8* %30, i8** %6
%31 = load i8*, i8** %6
%32 = call i64 @file_exists(i8* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = call i32 @error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %36
36: ; preds = %34, %27
%37 = load i8*, i8** %6
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %38, i32** %7
%39 = load i32*, i32** %7
%40 = icmp ne i32* %39, null
br i1 %40, label %43, label %41
41: ; preds = %36
%42 = call i32 @error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %36
%44 = load i32, i32* @AF_INET
%45 = load i32, i32* @SOCK_DGRAM
%46 = call i32 @socket(i32 %44, i32 %45, i32 0)
store i32 %46, i32* %8
%47 = load i32, i32* %8
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = call i32 @error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49, %43
store i32 32581, i32* %9
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %10
store i32 12, i32* %12
store i32* %12, i32** %13
%52 = load i32, i32* @AF_INET
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %52, i32* %53
%54 = load i8*, i8** %10
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%56 = call i32 @inet_aton(i8* %54, i32* %55)
%57 = icmp ne i32 %56, 0
br i1 %57, label %62, label %58
58: ; preds = %51
%59 = load i8*, i8** %10
%60 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %59)
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %51
%63 = load i32, i32* %9
%64 = call i32 @htons(i32 %63)
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %64, i32* %65
%66 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
store %struct.sockaddr* %66, %struct.sockaddr** %14
%67 = load i32, i32* %8
%68 = load %struct.sockaddr*, %struct.sockaddr** %14
%69 = call i64 @bind(i32 %67, %struct.sockaddr* %68, i32 12)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %62
%72 = call i32 @error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %73
73: ; preds = %71, %62
store i32 0, i32* %15
br label %74
74: ; preds = %73, %111
%75 = load i32, i32* %8
%76 = getelementptr inbounds [101 x i8], [101 x i8]* %16, i64 0, i64 0
%77 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%78 = load i32*, i32** %13
%79 = call i32 @recvfrom(i32 %75, i8* %76, i32 101, i32 0, %struct.sockaddr* %77, i32* %78)
store i32 %79, i32* %18
%80 = getelementptr inbounds [101 x i8], [101 x i8]* %16, i64 0, i64 0
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = sub nsw i32 %82, 48
store i32 %83, i32* %19
%84 = load i32, i32* %15
%85 = srem i32 %84, 2
%86 = load i32, i32* %19
%87 = icmp eq i32 %85, %86
br i1 %87, label %88, label %97
88: ; preds = %74
%89 = getelementptr inbounds [101 x i8], [101 x i8]* %16, i64 0, i64 0
%90 = getelementptr inbounds i8, i8* %89, i64 1
%91 = load i32, i32* %18
%92 = sub nsw i32 %91, 1
%93 = load i32*, i32** %7
%94 = call i32 @fwrite(i8* %90, i32 1, i32 %92, i32* %93)
%95 = load i32, i32* %15
%96 = add nsw i32 %95, 1
store i32 %96, i32* %15
br label %97
97: ; preds = %88, %74
%98 = load i32, i32* %19
%99 = srem i32 %98, 2
%100 = add nsw i32 50, %99
%101 = trunc i32 %100 to i8
%102 = getelementptr inbounds [1 x i8], [1 x i8]* %17, i64 0, i64 0
store i8 %101, i8* %102
%103 = load i32, i32* %8
%104 = getelementptr inbounds [1 x i8], [1 x i8]* %17, i64 0, i64 0
%105 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%106 = load i32, i32* %12
%107 = call i32 @sendto(i32 %103, i8* %104, i32 1, i32 0, %struct.sockaddr* %105, i32 %106)
%108 = load i32, i32* %18
%109 = icmp slt i32 %108, 100
br i1 %109, label %110, label %111
110: ; preds = %97
br label %112
111: ; preds = %97
br label %74
112: ; preds = %110
%113 = load i32*, i32** %7
%114 = call i32 @fclose(i32* %113)
%115 = load i32, i32* %8
%116 = call i32 @close(i32 %115)
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"exists\00"
@.str.1 = [3 x i8] c"wb\00"
@.str.2 = [5 x i8] c"file\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.3 = [5 x i8] c"sock\00"
@.str.4 = [10 x i8] c"127.0.0.1\00"
@.str.5 = [22 x i8] c"invalid server IP %s\0A\00"
@.str.6 = [5 x i8] c"bind\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [101 x i8]
%6 = alloca [1 x i8]
%7 = icmp eq i32 %0, 2
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 1
%13 = load i8*, i8** %12
%14 = tail call i64 @file_exists(i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = tail call i32 @error(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %11
%19 = tail call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* @AF_INET
%25 = load i32, i32* @SOCK_DGRAM
%26 = tail call i32 @socket(i32 %24, i32 %25, i32 0)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %23
%29 = tail call i32 @error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %23
%31 = bitcast %struct.sockaddr_in* %3 to i8*
%32 = bitcast i32* %4 to i8*
store i32 12, i32* %4
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %33, i32* %34
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
%36 = call i32 @inet_aton(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32* %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %30
%39 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %30
%42 = call i32 @htons(i32 32581)
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %42, i32* %43
%44 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%45 = call i64 @bind(i32 %26, %struct.sockaddr* %44, i32 12)
%46 = icmp eq i64 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %41
%48 = call i32 @error(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%51 = getelementptr inbounds [1 x i8], [1 x i8]* %6, i64 0, i64 0
%52 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 1
br label %53
53: ; preds = %65, %49
%54 = phi i32 [ 0, %49 ], [ %66, %65 ]
%55 = call i32 @recvfrom(i32 %26, i8* %50, i32 101, i32 0, %struct.sockaddr* %44, i32* %4)
%56 = load i8, i8* %50
%57 = sext i8 %56 to i32
%58 = add nsw i32 %57, -48
%59 = srem i32 %54, 2
%60 = icmp eq i32 %59, %58
br i1 %60, label %61, label %65
61: ; preds = %53
%62 = add nsw i32 %55, -1
%63 = call i32 @fwrite(i8* %52, i32 1, i32 %62, i32* %19)
%64 = add nsw i32 %54, 1
br label %65
65: ; preds = %61, %53
%66 = phi i32 [ %64, %61 ], [ %54, %53 ]
%67 = trunc i32 %58 to i16
%68 = srem i16 %67, 2
%69 = trunc i16 %68 to i8
%70 = add nsw i8 %69, 50
store i8 %70, i8* %51
%71 = load i32, i32* %4
%72 = call i32 @sendto(i32 %26, i8* %51, i32 1, i32 0, %struct.sockaddr* %44, i32 %71)
%73 = icmp slt i32 %55, 100
br i1 %73, label %74, label %53
74: ; preds = %65
%75 = call i32 @fclose(i32* %19)
%76 = call i32 @close(i32 %26)
ret i32 0
}