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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ *strstr(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  struct sockaddr_in serv_addr;
  struct sockaddr_in clie_addr;
  char buf[10240];
  int sock_id;
  int recv_len;
  int clie_addr_len;
  FILE *fp;
  if (argc != 3) {
    usage(argv[0]);
  }
  if ((fp = fopen(argv[2], "w")) == NULL) {
    perror("Creat file failed");
    exit(0);
  }
  if ((sock_id = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
    perror("Create socket failed\n");
    exit(0);
  }
  memset(&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_port = htons(atoi(argv[1]));
  serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  if (bind(sock_id, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    perror("Bind socket faild\n");
    exit(0);
  }
  clie_addr_len = sizeof(clie_addr);
  bzero(buf, 10240);
  while (recv_len = recvfrom(sock_id, buf, 10240, 0,
                             (struct sockaddr *)&clie_addr, &clie_addr_len)) {
    if (recv_len < 0) {
      printf("Recieve data from client failed!\n");
      break;
    }
    printf("#%d", recv_len);
    fflush(stdout);
    if (strstr(buf, "FILE_TRANSPORT_FINISH") != NULL) {
      printf("\nFinish receiver finish_flag\n");
      break;
    }
    int write_length = fwrite(buf, sizeof(char), recv_len, fp);
    if (write_length < recv_len) {
      printf("File write failed\n");
      break;
    }
    bzero(buf, 10240);
  }
  printf("Finish recieve\n");
  fclose(fp);
  close(sock_id);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2850,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     124f <main+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10b0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xda2(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x2848(%rbp)
cmp    $0x0,%rax
jne    1287 <main+0x67>
lea    0xd87(%rip),%rdi
call   10e0 <perror@plt>
xor    %edi,%edi
call   1110 <exit@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
mov    0x2d41(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0x2834(%rbp)
cmp    $0x0,%eax
jge    12c2 <main+0xa2>
lea    0xd5e(%rip),%rdi
call   10e0 <perror@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,%edi
call   1040 <htons@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2ce4(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x20(%rbp)
mov    -0x2834(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    1337 <main+0x117>
lea    0xcff(%rip),%rdi
call   10e0 <perror@plt>
xor    %edi,%edi
call   1110 <exit@plt>
movl   $0xc,-0x283c(%rbp)
lea    -0x2830(%rbp),%rdi
mov    $0x2800,%esi
call   10f0 <bzero@plt>
mov    -0x2834(%rbp),%edi
lea    -0x2830(%rbp),%rsi
lea    -0x30(%rbp),%r8
mov    $0x2800,%edx
xor    %ecx,%ecx
lea    -0x283c(%rbp),%r9
call   10a0 <recvfrom@plt>
mov    %eax,-0x2838(%rbp)
cmp    $0x0,%eax
je     1456 <main+0x236>
cmpl   $0x0,-0x2838(%rbp)
jge    13a5 <main+0x185>
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1456 <main+0x236>
mov    -0x2838(%rbp),%esi
lea    0xcad(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
lea    -0x2830(%rbp),%rdi
lea    0xc8e(%rip),%rsi
call   1130 <strstr@plt>
cmp    $0x0,%rax
je     13f7 <main+0x1d7>
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1456 <main+0x236>
lea    -0x2830(%rbp),%rdi
mov    -0x2838(%rbp),%edx
mov    -0x2848(%rbp),%rcx
mov    $0x1,%esi
call   1120 <fwrite@plt>
mov    %eax,-0x284c(%rbp)
mov    -0x284c(%rbp),%eax
cmp    -0x2838(%rbp),%eax
jge    1440 <main+0x220>
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1456 <main+0x236>
lea    -0x2830(%rbp),%rdi
mov    $0x2800,%esi
call   10f0 <bzero@plt>
jmp    1352 <main+0x132>
lea    0xc4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2848(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x2834(%rbp),%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x2850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2838,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1251 <main+0x21>
mov    (%rbx),%rdi
call   10c0 <usage@plt>
mov    0x10(%rbx),%rdi
lea    0xda4(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     140a <main+0x1da>
mov    %rax,%r13
mov    0x2d74(%rip),%r15
mov    (%r15),%edi
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
test   %eax,%eax
js     1413 <main+0x1e3>
mov    %eax,%ebp
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    (%r15),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0x10(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
test   %rax,%rax
js     141c <main+0x1ec>
movl   $0xc,0xc(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
lea    0x20(%rsp),%r8
lea    0xc(%rsp),%r9
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x2800,%edx
xor    %ecx,%ecx
call   10b0 <recvfrom@plt>
test   %eax,%eax
je     13db <main+0x1ab>
mov    %eax,%r15d
lea    0x30(%rsp),%rbx
lea    0x20(%rsp),%r14
lea    0xc(%rsp),%r12
nopl   0x0(%rax)
test   %r15d,%r15d
js     13bd <main+0x18d>
lea    0xcf1(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    %rbx,%rdi
lea    0xcd3(%rip),%rsi
call   1140 <strstr@plt>
test   %rax,%rax
jne    13c6 <main+0x196>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    %r13,%rcx
call   1130 <fwrite@plt>
cmp    %r15d,%eax
jl     13cf <main+0x19f>
mov    %rbx,%rdi
mov    $0x2800,%esi
call   1100 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x2800,%edx
xor    %ecx,%ecx
mov    %r14,%r8
mov    %r12,%r9
call   10b0 <recvfrom@plt>
mov    %eax,%r15d
test   %eax,%eax
jne    1340 <main+0x110>
jmp    13db <main+0x1ab>
lea    0xcd1(%rip),%rdi
jmp    13d6 <main+0x1a6>
lea    0xcab(%rip),%rdi
jmp    13d6 <main+0x1a6>
lea    0xc90(%rip),%rdi
call   1030 <puts@plt>
lea    0xc75(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    %ebp,%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x2838,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbf1(%rip),%rdi
jmp    1423 <main+0x1f3>
lea    0xbfa(%rip),%rdi
jmp    1423 <main+0x1f3>
lea    0xc07(%rip),%rdi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [2 x i8] c"w\00"
@.str.1 = [18 x i8] c"Creat file failed\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.2 = [22 x i8] c"Create socket failed\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [19 x i8] c"Bind socket faild\0A\00"
@.str.4 = [34 x i8] c"Recieve data from client failed!\0A\00"
@.str.5 = [4 x i8] c"#%d\00"
@stdout = global i32 0
@.str.6 = [22 x i8] c"FILE_TRANSPORT_FINISH\00"
@.str.7 = [30 x i8] c"\0AFinish receiver finish_flag\0A\00"
@.str.8 = [19 x i8] c"File write failed\0A\00"
@.str.9 = [16 x i8] c"Finish recieve\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%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
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, 3
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @usage(i8* %19)
br label %21
21: ; preds = %16, %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %12
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @exit(i32 0)
unreachable
30: ; preds = %21
%31 = load i32, i32* @AF_INET
%32 = load i32, i32* @SOCK_DGRAM
%33 = call i32 @socket(i32 %31, i32 %32, i32 0)
store i32 %33, i32* %9
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @exit(i32 0)
unreachable
38: ; preds = %30
%39 = call i32 @memset(%struct.sockaddr_in* %6, i32 0, i32 12)
%40 = load i32, i32* @AF_INET
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %40, i32* %41
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
%46 = call i32 @htons(i32 %45)
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %46, i32* %47
%48 = load i32, i32* @INADDR_ANY
%49 = call i32 @htonl(i32 %48)
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%51 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %50, i32 0, i32 0
store i32 %49, i32* %51
%52 = load i32, i32* %9
%53 = bitcast %struct.sockaddr_in* %6 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 %59
56: ; preds = %38
%57 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 0)
unreachable
59: ; preds = %38
store i32 12, i32* %11
%60 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%61 = call i32 @bzero(i8* %60, i32 10240)
br label %62
62: ; preds = %93, %59
%63 = load i32, i32* %9
%64 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%65 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%66 = call i32 @recvfrom(i32 %63, i8* %64, i32 10240, i32 0, %struct.sockaddr* %65, i32* %11)
store i32 %66, i32* %10
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %96
68: ; preds = %62
%69 = load i32, i32* %10
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %96
73: ; preds = %68
%74 = load i32, i32* %10
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %74)
%76 = load i32, i32* @stdout
%77 = call i32 @fflush(i32 %76)
%78 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%79 = call i32* @strstr(i8* %78, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%80 = icmp ne i32* %79, null
br i1 %80, label %81, label %83
81: ; preds = %73
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %96
83: ; preds = %73
%84 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%85 = load i32, i32* %10
%86 = load i32*, i32** %12
%87 = call i32 @fwrite(i8* %84, i32 1, i32 %85, i32* %86)
store i32 %87, i32* %13
%88 = load i32, i32* %13
%89 = load i32, i32* %10
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %93
91: ; preds = %83
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %96
93: ; preds = %83
%94 = getelementptr inbounds [10240 x i8], [10240 x i8]* %8, i64 0, i64 0
%95 = call i32 @bzero(i8* %94, i32 10240)
br label %62
96: ; preds = %91, %81, %71, %62
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%98 = load i32*, i32** %12
%99 = call i32 @fclose(i32* %98)
%100 = load i32, i32* %9
%101 = call i32 @close(i32 %100)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [2 x i8] c"w\00"
@.str.1 = [18 x i8] c"Creat file failed\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.2 = [22 x i8] c"Create socket failed\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [19 x i8] c"Bind socket faild\0A\00"
@.str.5 = [4 x i8] c"#%d\00"
@stdout = global i32 0
@.str.6 = [22 x i8] c"FILE_TRANSPORT_FINISH\00"
@str = [15 x i8] c"Finish recieve\00"
@str.10 = [18 x i8] c"File write failed\00"
@str.11 = [29 x i8] c"\0AFinish receiver finish_flag\00"
@str.12 = [33 x i8] c"Recieve data from client failed!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca [10240 x i8]
%6 = alloca i32
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 3
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 @usage(i8* %13)
br label %15
15: ; preds = %12, %2
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %15
%21 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%22 = tail call i32 @exit(i32 0)
unreachable
23: ; preds = %15
%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 %31
28: ; preds = %23
%29 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%30 = tail call i32 @exit(i32 0)
unreachable
31: ; preds = %23
%32 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%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 i8*, i8** %1, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
%38 = call i32 @htons(i32 %37)
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %38, i32* %39
%40 = load i32, i32* @INADDR_ANY
%41 = call i32 @htonl(i32 %40)
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %41, i32* %42
%43 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%44 = call i64 @bind(i32 %26, %struct.sockaddr* %43, i32 12)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %31
%47 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%48 = call i32 @exit(i32 0)
unreachable
49: ; preds = %31
store i32 12, i32* %6
%50 = call i32 @bzero(i8* %9, i32 10240)
%51 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%52 = call i32 @recvfrom(i32 %26, i8* %9, i32 10240, i32 0, %struct.sockaddr* %51, i32* %6)
%53 = icmp eq i32 %52, 0
br i1 %53, label %73, label %54
54: ; preds = %49, %66
%55 = phi i32 [ %68, %66 ], [ %52, %49 ]
%56 = icmp slt i32 %55, 0
br i1 %56, label %70, label %57
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %55)
%59 = load i32, i32* @stdout
%60 = call i32 @fflush(i32 %59)
%61 = call i32* @strstr(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %70
63: ; preds = %57
%64 = call i32 @fwrite(i8* %9, i32 1, i32 %55, i32* %18)
%65 = icmp slt i32 %64, %55
br i1 %65, label %70, label %66
66: ; preds = %63
%67 = call i32 @bzero(i8* %9, i32 10240)
%68 = call i32 @recvfrom(i32 %26, i8* %9, i32 10240, i32 0, %struct.sockaddr* %51, i32* %6)
%69 = icmp eq i32 %68, 0
br i1 %69, label %73, label %54
70: ; preds = %63, %57, %54
%71 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0), %54 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @str.11, i64 0, i64 0), %57 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.10, i64 0, i64 0), %63 ]
%72 = call i32 @puts(i8* dereferenceable(1) %71)
br label %73
73: ; preds = %66, %70, %49
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%75 = call i32 @fclose(i32* %18)
%76 = call i32 @close(i32 %26)
ret i32 0
}