#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*/ servaddr;
typedef int /*<<< orphan*/ cliaddr;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, scalar_t__);
int recvfrom(int, char *, int, int /*<<< orphan*/, struct sockaddr *, int *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sendto(int, char *, int /*<<< orphan*/, int /*<<< orphan*/,
                          struct sockaddr *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  int listenfd, connfd, n;
  struct sockaddr_in servaddr, cliaddr;
  socklen_t clilen;
  char buffer[1000];
  listenfd = socket(AF_INET, SOCK_STREAM, 0);
  perror("");
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servaddr.sin_port = htons(32000);
  bind(listenfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
  perror("");
  listen(listenfd, 0);
  perror("");
  clilen = sizeof(cliaddr);
  connfd = accept(listenfd, (struct sockaddr *)&cliaddr, &clilen);
  perror("");
  n = recvfrom(connfd, buffer, 1000, 0, (struct sockaddr *)&cliaddr, &clilen);
  perror("");
  buffer[n] = 0;
  printf("%s %d", buffer, strncmp(buffer, "request", 7));
  if (0 == strncmp(buffer, "request", 7)) {
    FILE *fd;
    int sz = 1000, size;
    fd = fopen("serverfile.txt", "r");
    fseek(fd, 0L, SEEK_END);
    size = ftell(fd);
    rewind(fd);
    memset(buffer, 0, sizeof(buffer));
    sprintf(buffer, "%d", size);
    sendto(connfd, buffer, strlen(buffer), 0, (struct sockaddr *)&cliaddr,
           sizeof(cliaddr));
    while (sz == 1000) {
      sz = fread(buffer, 1, 1000, fd);
      sendto(connfd, buffer, strlen(buffer), 0, (struct sockaddr *)&cliaddr,
             sizeof(cliaddr));
      memset(buffer, 0, sizeof(buffer));
    }
    fclose(fd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
mov    0x2d5f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x14(%rbp)
lea    0xd89(%rip),%rdi
call   1130 <perror@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,-0x24(%rbp)
mov    $0x7d00,%edi
call   1070 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1110 <bind@plt>
lea    0xd42(%rip),%rdi
call   1130 <perror@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   10e0 <listen@plt>
lea    0xd2c(%rip),%rdi
call   1130 <perror@plt>
movl   $0xc,-0x3c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   1140 <accept@plt>
mov    %eax,-0x18(%rbp)
lea    0xd06(%rip),%rdi
call   1130 <perror@plt>
mov    -0x18(%rbp),%edi
lea    -0x430(%rbp),%rsi
lea    -0x38(%rbp),%r8
mov    $0x3e8,%edx
xor    %ecx,%ecx
lea    -0x3c(%rbp),%r9
call   10f0 <recvfrom@plt>
mov    %eax,-0x1c(%rbp)
lea    0xcd9(%rip),%rdi
call   1130 <perror@plt>
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x430(%rbp,%rax,1)
lea    -0x430(%rbp),%rax
mov    %rax,-0x448(%rbp)
lea    -0x430(%rbp),%rdi
lea    0xcad(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    -0x448(%rbp),%rsi
mov    %rax,%rdx
lea    0xc8c(%rip),%rdi
call   1080 <printf@plt>
lea    -0x430(%rbp),%rdi
lea    0xc7f(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1503 <main+0x2c3>
movl   $0x3e8,-0x43c(%rbp)
lea    0xc5e(%rip),%rdi
lea    0xc66(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rdi
mov    0x2c17(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1100 <fseek@plt>
mov    -0x438(%rbp),%rdi
call   10d0 <ftell@plt>
mov    %eax,-0x440(%rbp)
mov    -0x438(%rbp),%rdi
call   1090 <rewind@plt>
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   10b0 <memset@plt>
lea    -0x430(%rbp),%rdi
mov    -0x440(%rbp),%edx
lea    0xbe2(%rip),%rsi
call   1150 <sprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x454(%rbp)
lea    -0x430(%rbp),%rax
mov    %rax,-0x450(%rbp)
lea    -0x430(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x454(%rbp),%edi
mov    -0x450(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%r8
xor    %ecx,%ecx
mov    $0xc,%r9d
call   10c0 <sendto@plt>
cmpl   $0x3e8,-0x43c(%rbp)
jne    14f7 <main+0x2b7>
lea    -0x430(%rbp),%rdi
mov    -0x438(%rbp),%rcx
mov    $0x1,%esi
mov    $0x3e8,%edx
call   1040 <fread@plt>
mov    %eax,-0x43c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x464(%rbp)
lea    -0x430(%rbp),%rax
mov    %rax,-0x460(%rbp)
lea    -0x430(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x464(%rbp),%edi
mov    -0x460(%rbp),%rsi
mov    %eax,%edx
lea    -0x38(%rbp),%r8
xor    %ecx,%ecx
mov    $0xc,%r9d
call   10c0 <sendto@plt>
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   10b0 <memset@plt>
jmp    1469 <main+0x229>
mov    -0x438(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x420,%rsp
mov    0x2d8a(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d69(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,%ebp
lea    0xd94(%rip),%r15
mov    %r15,%rdi
call   1130 <perror@plt>
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,0x14(%rsp)
mov    $0x7d00,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1110 <bind@plt>
mov    %r15,%rdi
call   1130 <perror@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   10e0 <listen@plt>
mov    %r15,%rdi
call   1130 <perror@plt>
movl   $0xc,0xc(%rsp)
lea    0x20(%rsp),%rbx
lea    0xc(%rsp),%r12
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1140 <accept@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1130 <perror@plt>
lea    0x30(%rsp),%rbp
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x3e8,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
mov    %r12,%r9
call   10f0 <recvfrom@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1130 <perror@plt>
movslq %ebx,%rax
movb   $0x0,0x30(%rsp,%rax,1)
lea    0xcdd(%rip),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
lea    0xcc0(%rip),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   1080 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1446 <main+0x206>
lea    0xca3(%rip),%rdi
lea    0xcab(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,%r12
mov    0x2c67(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1100 <fseek@plt>
mov    %r12,%rdi
call   10d0 <ftell@plt>
mov    %eax,%r15d
mov    %r12,%rdi
call   1090 <rewind@plt>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   10b0 <memset@plt>
lea    0xc48(%rip),%rsi
mov    %rbp,%rdi
mov    %r15d,%edx
call   1150 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
lea    0x20(%rsp),%r15
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    $0xc,%r9d
call   10c0 <sendto@plt>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x3e8,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
mov    %r15,%r8
mov    $0xc,%r9d
call   10c0 <sendto@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   10b0 <memset@plt>
cmp    $0x3e8,%ebx
je     13f0 <main+0x1b0>
mov    %r12,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [1 x i8] zeroinitializer
@INADDR_ANY = global i32 0
@.str.1 = [6 x i8] c"%s %d\00"
@.str.2 = [8 x i8] c"request\00"
@.str.3 = [15 x i8] c"serverfile.txt\00"
@.str.4 = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@.str.5 = [3 x i8] c"%d\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 i32
%9 = alloca %struct.sockaddr_in
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca [1000 x i8]
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = call i32 @socket(i32 %16, i32 %17, i32 0)
store i32 %18, i32* %6
%19 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @AF_INET
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %20, i32* %21
%22 = load i32, i32* @INADDR_ANY
%23 = call i32 @htonl(i32 %22)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 0
store i32 %23, i32* %25
%26 = call i32 @htons(i32 32000)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %26, i32* %27
%28 = load i32, i32* %6
%29 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%30 = call i32 @bind(i32 %28, %struct.sockaddr* %29, i32 12)
%31 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* %6
%33 = call i32 @listen(i32 %32, i32 0)
%34 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 12, i32* %11
%35 = load i32, i32* %6
%36 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%37 = call i32 @accept(i32 %35, %struct.sockaddr* %36, i32* %11)
store i32 %37, i32* %7
%38 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%39 = load i32, i32* %7
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%41 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%42 = call i32 @recvfrom(i32 %39, i8* %40, i32 1000, i32 0, %struct.sockaddr* %41, i32* %11)
store i32 %42, i32* %8
%43 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 %45
store i8 0, i8* %46
%47 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%48 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%49 = call i64 @strncmp(i8* %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%50 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %47, i64 %49)
%51 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%52 = call i64 @strncmp(i8* %51, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%53 = icmp eq i64 0, %52
br i1 %53, label %54, label %92
54: ; preds = %2
store i32 1000, i32* %14
%55 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %55, i32** %13
%56 = load i32*, i32** %13
%57 = load i32, i32* @SEEK_END
%58 = call i32 @fseek(i32* %56, i64 0, i32 %57)
%59 = load i32*, i32** %13
%60 = call i32 @ftell(i32* %59)
store i32 %60, i32* %15
%61 = load i32*, i32** %13
%62 = call i32 @rewind(i32* %61)
%63 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%64 = call i32 @memset(i8* %63, i32 0, i32 1000)
%65 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%66 = load i32, i32* %15
%67 = call i32 @sprintf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %7
%69 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%70 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%71 = call i32 @strlen(i8* %70)
%72 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%73 = call i32 @sendto(i32 %68, i8* %69, i32 %71, i32 0, %struct.sockaddr* %72, i32 12)
br label %74
74: ; preds = %77, %54
%75 = load i32, i32* %14
%76 = icmp eq i32 %75, 1000
br i1 %76, label %77, label %89
77: ; preds = %74
%78 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%79 = load i32*, i32** %13
%80 = call i32 @fread(i8* %78, i32 1, i32 1000, i32* %79)
store i32 %80, i32* %14
%81 = load i32, i32* %7
%82 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%83 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%84 = call i32 @strlen(i8* %83)
%85 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%86 = call i32 @sendto(i32 %81, i8* %82, i32 %84, i32 0, %struct.sockaddr* %85, i32 12)
%87 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%88 = call i32 @memset(i8* %87, i32 0, i32 1000)
br label %74
89: ; preds = %74
%90 = load i32*, i32** %13
%91 = call i32 @fclose(i32* %90)
br label %92
92: ; preds = %89, %2
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [1 x i8] zeroinitializer
@INADDR_ANY = global i32 0
@.str.1 = [6 x i8] c"%s %d\00"
@.str.2 = [8 x i8] c"request\00"
@.str.3 = [15 x i8] c"serverfile.txt\00"
@.str.4 = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@.str.5 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [1000 x i8]
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, 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 = tail call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @AF_INET
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %15, i32* %16
%17 = load i32, i32* @INADDR_ANY
%18 = tail call i32 @htonl(i32 %17)
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %18, i32* %19
%20 = tail call i32 @htons(i32 32000)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %20, i32* %21
%22 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%23 = call i32 @bind(i32 %13, %struct.sockaddr* %22, i32 12)
%24 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @listen(i32 %13, i32 0)
%26 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 12, i32* %5
%27 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%28 = call i32 @accept(i32 %13, %struct.sockaddr* %27, i32* %5)
%29 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @recvfrom(i32 %28, i8* %10, i32 1000, i32 0, %struct.sockaddr* %27, i32* %5)
%31 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%32 = sext i32 %30 to i64
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %32
store i8 0, i8* %33
%34 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%35 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %10, i64 %34)
%36 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %56
38: ; preds = %2
%39 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%40 = load i32, i32* @SEEK_END
%41 = call i32 @fseek(i32* %39, i64 0, i32 %40)
%42 = call i32 @ftell(i32* %39)
%43 = call i32 @rewind(i32* %39)
%44 = call i32 @memset(i8* %10, i32 0, i32 1000)
%45 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %42)
%46 = call i32 @strlen(i8* %10)
%47 = call i32 @sendto(i32 %28, i8* %10, i32 %46, i32 0, %struct.sockaddr* %27, i32 12)
br label %48
48: ; preds = %38, %48
%49 = call i32 @fread(i8* %10, i32 1, i32 1000, i32* %39)
%50 = call i32 @strlen(i8* %10)
%51 = call i32 @sendto(i32 %28, i8* %10, i32 %50, i32 0, %struct.sockaddr* %27, i32 12)
%52 = call i32 @memset(i8* %10, i32 0, i32 1000)
%53 = icmp eq i32 %49, 1000
br i1 %53, label %48, label %54
54: ; preds = %48
%55 = call i32 @fclose(i32* %39)
br label %56
56: ; preds = %54, %2
ret i32 0
}