#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 */
typedef scalar_t__ off_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fsync(int);
scalar_t__ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printTimestamp();
int /*<<< orphan*/ printf(char *, char *);
int read(int, char *, int const);
int /*<<< orphan*/ return404(char *, int, char *);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int strlen(char *);
char *strstr(char *, char *);
void processFileRequest(char *buffer, int csock) {
  int fd;
  int nbytes;
  const int fbufsize = 4096;
  char fbuffer[4096];
  char outbuf[1024];
  char *file = buffer + strlen("GET /web/");
  char *http = strstr(buffer, " HTTP/1.");
  if (http == NULL) {
    return404(buffer, csock, "File request missing trailing HTTP marker");
    return;
  } else {
    http[0] = 0;
    if (strstr(file, "..")) {
      return404(buffer, csock, "File request contained unsupported use of ..");
      return;
    }
    if (strstr(file, "?")) {
      char *q = strstr(file, "?");
      q[0] = 0;
    }
    printTimestamp();
    printf("Serving filename of %s\n", file);
    fd = open(file, O_RDONLY);
    if (fd == -1) {
      return404(buffer, csock, "Problem opening file for reading.");
      return;
    }
    char *found = "HTTP/1.0 200 OK\n";
    send(csock, found, strlen(found), 0);
    off_t len = lseek(fd, 0, SEEK_END);
    lseek(fd, 0, SEEK_SET);
    memset(outbuf, 0, 1024);
    snprintf(outbuf, 1023, "Content-Length: %d\n\n", (int)len);
    send(csock, outbuf, strlen(outbuf), 0);
    nbytes = read(fd, fbuffer, fbufsize);
    while (nbytes != 0) {
      if (nbytes == -1) {
        close(fd);
        return404(buffer, csock, "\n\n!!!Problem reading file");
        return;
      }
      send(csock, fbuffer, nbytes, 0);
      fsync(csock);
      nbytes = read(fd, fbuffer, fbufsize);
    }
    close(fd);
    fsync(csock);
    close(csock);
  }
}


x86 assembly (clang, -O0):
<processFileRequest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1470,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1000,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x1450(%rbp)
lea    0xe05(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x1450(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1428(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x1430(%rbp)
cmpq   $0x0,-0x1430(%rbp)
jne    1253 <processFileRequest+0x83>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xdca(%rip),%rdx
call   1030 <return404@plt>
jmp    14a3 <processFileRequest+0x2d3>
mov    -0x1430(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1428(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     1292 <processFileRequest+0xc2>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xdb5(%rip),%rdx
call   1030 <return404@plt>
jmp    14a3 <processFileRequest+0x2d3>
mov    -0x1428(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     12d3 <processFileRequest+0x103>
mov    -0x1428(%rbp),%rdi
lea    0xdad(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x1438(%rbp)
mov    -0x1438(%rbp),%rax
movb   $0x0,(%rax)
mov    $0x0,%al
call   1040 <printTimestamp@plt>
mov    -0x1428(%rbp),%rsi
lea    0xd84(%rip),%rdi
call   1070 <printf@plt>
mov    -0x1428(%rbp),%rdi
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
call   10e0 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1327 <processFileRequest+0x157>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xd67(%rip),%rdx
call   1030 <return404@plt>
jmp    14a3 <processFileRequest+0x2d3>
lea    0xd78(%rip),%rax
mov    %rax,-0x1440(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x146c(%rbp)
mov    -0x1440(%rbp),%rax
mov    %rax,-0x1468(%rbp)
mov    -0x1440(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x146c(%rbp),%edi
mov    -0x1468(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0x10(%rbp),%edi
mov    0x2c70(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <lseek@plt>
mov    %rax,-0x1448(%rbp)
mov    -0x10(%rbp),%edi
mov    0x2c3e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <lseek@plt>
lea    -0x1420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x1420(%rbp),%rdi
mov    -0x1448(%rbp),%rax
mov    %eax,%ecx
mov    $0x3ff,%esi
lea    0xced(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x145c(%rbp)
lea    -0x1420(%rbp),%rax
mov    %rax,-0x1458(%rbp)
lea    -0x1420(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x145c(%rbp),%edi
mov    -0x1458(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0x10(%rbp),%edi
lea    -0x1020(%rbp),%rsi
mov    $0x1000,%edx
call   10c0 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     148b <processFileRequest+0x2bb>
cmpl   $0xffffffff,-0x14(%rbp)
jne    1453 <processFileRequest+0x283>
mov    -0x10(%rbp),%edi
call   10b0 <close@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xc83(%rip),%rdx
call   1030 <return404@plt>
jmp    14a3 <processFileRequest+0x2d3>
mov    -0xc(%rbp),%edi
lea    -0x1020(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    -0xc(%rbp),%edi
call   10d0 <fsync@plt>
mov    -0x10(%rbp),%edi
lea    -0x1020(%rbp),%rsi
mov    $0x1000,%edx
call   10c0 <read@plt>
mov    %eax,-0x14(%rbp)
jmp    141f <processFileRequest+0x24f>
mov    -0x10(%rbp),%edi
call   10b0 <close@plt>
mov    -0xc(%rbp),%edi
call   10d0 <fsync@plt>
mov    -0xc(%rbp),%edi
call   10b0 <close@plt>
add    $0x1470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processFileRequest>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1400,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
lea    0xe05(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
lea    0xe01(%rip),%rsi
mov    %r14,%rdi
call   1100 <strstr@plt>
test   %rax,%rax
je     123c <processFileRequest+0x5c>
movslq %ebp,%rbp
add    %r14,%rbp
movb   $0x0,(%rax)
lea    0xe41(%rip),%rsi
mov    %rbp,%rdi
call   1100 <strstr@plt>
test   %rax,%rax
je     125c <processFileRequest+0x7c>
lea    0xe03(%rip),%rdx
jmp    1243 <processFileRequest+0x63>
lea    0xdd0(%rip),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x1400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <return404@plt>
mov    %rbp,%rdi
mov    $0x3f,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     1271 <processFileRequest+0x91>
movb   $0x0,(%rax)
xor    %eax,%eax
call   1040 <printTimestamp@plt>
lea    0xdeb(%rip),%rdi
mov    %rbp,%rsi
call   1080 <printf@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   10f0 <open@plt>
cmp    $0xffffffff,%eax
je     1370 <processFileRequest+0x190>
mov    %eax,%r15d
lea    0xdf9(%rip),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    0x2d20(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
xor    %esi,%esi
call   10a0 <lseek@plt>
mov    %rax,%r12
mov    0x2cf2(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
xor    %esi,%esi
call   10a0 <lseek@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10b0 <memset@plt>
lea    0xdb2(%rip),%rdx
mov    %rbp,%rdi
mov    $0x3ff,%esi
mov    %r12d,%ecx
call   1090 <snprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
lea    0x400(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   10d0 <read@plt>
test   %eax,%eax
je     137c <processFileRequest+0x19c>
cmp    $0xffffffff,%eax
je     1394 <processFileRequest+0x1b4>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %ebx,%edi
call   10e0 <fsync@plt>
jmp    1340 <processFileRequest+0x160>
lea    0xd0b(%rip),%rdx
jmp    1243 <processFileRequest+0x63>
mov    %r15d,%edi
call   10c0 <close@plt>
mov    %ebx,%edi
call   10e0 <fsync@plt>
mov    %ebx,%edi
call   10c0 <close@plt>
jmp    13ad <processFileRequest+0x1cd>
mov    %r15d,%edi
call   10c0 <close@plt>
lea    0xd27(%rip),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <return404@plt>
add    $0x1400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"GET /web/\00"
@.str.1 = [9 x i8] c" HTTP/1.\00"
@.str.2 = [42 x i8] c"File request missing trailing HTTP marker\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [45 x i8] c"File request contained unsupported use of ..\00"
@.str.5 = [2 x i8] c"?\00"
@.str.6 = [24 x i8] c"Serving filename of %s\0A\00"
@O_RDONLY = global i32 0
@.str.7 = [34 x i8] c"Problem opening file for reading.\00"
@.str.8 = [17 x i8] c"HTTP/1.0 200 OK\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.9 = [21 x i8] c"Content-Length: %d\0A\0A\00"
@.str.10 = [26 x i8] c"\0A\0A!!!Problem reading file\00"
define void @processFileRequest(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [4096 x i8]
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 4096, i32* %7
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8* %18, i8** %10
%19 = load i8*, i8** %3
%20 = call i8* @strstr(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store i8* %20, i8** %11
%21 = load i8*, i8** %11
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %27
23: ; preds = %2
%24 = load i8*, i8** %3
%25 = load i32, i32* %4
%26 = call i32 @return404(i8* %24, i32 %25, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %114
27: ; preds = %2
%28 = load i8*, i8** %11
%29 = getelementptr inbounds i8, i8* %28, i64 0
store i8 0, i8* %29
%30 = load i8*, i8** %10
%31 = call i8* @strstr(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %37
33: ; preds = %27
%34 = load i8*, i8** %3
%35 = load i32, i32* %4
%36 = call i32 @return404(i8* %34, i32 %35, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %114
37: ; preds = %27
%38 = load i8*, i8** %10
%39 = call i8* @strstr(i8* %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = load i8*, i8** %10
%43 = call i8* @strstr(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* %43, i8** %12
%44 = load i8*, i8** %12
%45 = getelementptr inbounds i8, i8* %44, i64 0
store i8 0, i8* %45
br label %46
46: ; preds = %41, %37
%47 = call i32 (...) @printTimestamp()
%48 = load i8*, i8** %10
%49 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* %48)
%50 = load i8*, i8** %10
%51 = load i32, i32* @O_RDONLY
%52 = call i32 @open(i8* %50, i32 %51)
store i32 %52, i32* %5
%53 = load i32, i32* %5
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %59
55: ; preds = %46
%56 = load i8*, i8** %3
%57 = load i32, i32* %4
%58 = call i32 @return404(i8* %56, i32 %57, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %114
59: ; preds = %46
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i8** %13
%60 = load i32, i32* %4
%61 = load i8*, i8** %13
%62 = load i8*, i8** %13
%63 = call i32 @strlen(i8* %62)
%64 = call i32 @send(i32 %60, i8* %61, i32 %63, i32 0)
%65 = load i32, i32* %5
%66 = load i32, i32* @SEEK_END
%67 = call i64 @lseek(i32 %65, i32 0, i32 %66)
store i64 %67, i64* %14
%68 = load i32, i32* %5
%69 = load i32, i32* @SEEK_SET
%70 = call i64 @lseek(i32 %68, i32 0, i32 %69)
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%72 = call i32 @memset(i8* %71, i32 0, i32 1024)
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%74 = load i64, i64* %14
%75 = trunc i64 %74 to i32
%76 = call i32 @snprintf(i8* %73, i32 1023, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %75)
%77 = load i32, i32* %4
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%80 = call i32 @strlen(i8* %79)
%81 = call i32 @send(i32 %77, i8* %78, i32 %80, i32 0)
%82 = load i32, i32* %5
%83 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%84 = call i32 @read(i32 %82, i8* %83, i32 4096)
store i32 %84, i32* %6
br label %85
85: ; preds = %97, %59
%86 = load i32, i32* %6
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %107
88: ; preds = %85
%89 = load i32, i32* %6
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %97
91: ; preds = %88
%92 = load i32, i32* %5
%93 = call i32 @close(i32 %92)
%94 = load i8*, i8** %3
%95 = load i32, i32* %4
%96 = call i32 @return404(i8* %94, i32 %95, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
br label %114
97: ; preds = %88
%98 = load i32, i32* %4
%99 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%100 = load i32, i32* %6
%101 = call i32 @send(i32 %98, i8* %99, i32 %100, i32 0)
%102 = load i32, i32* %4
%103 = call i32 @fsync(i32 %102)
%104 = load i32, i32* %5
%105 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%106 = call i32 @read(i32 %104, i8* %105, i32 4096)
store i32 %106, i32* %6
br label %85
107: ; preds = %85
%108 = load i32, i32* %5
%109 = call i32 @close(i32 %108)
%110 = load i32, i32* %4
%111 = call i32 @fsync(i32 %110)
%112 = load i32, i32* %4
%113 = call i32 @close(i32 %112)
br label %114
114: ; preds = %23, %33, %55, %91, %107
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"GET /web/\00"
@.str.1 = [9 x i8] c" HTTP/1.\00"
@.str.2 = [42 x i8] c"File request missing trailing HTTP marker\00"
@.str.3 = [3 x i8] c"..\00"
@.str.4 = [45 x i8] c"File request contained unsupported use of ..\00"
@.str.6 = [24 x i8] c"Serving filename of %s\0A\00"
@O_RDONLY = global i32 0
@.str.7 = [34 x i8] c"Problem opening file for reading.\00"
@.str.8 = [17 x i8] c"HTTP/1.0 200 OK\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.9 = [21 x i8] c"Content-Length: %d\0A\0A\00"
@.str.10 = [26 x i8] c"\0A\0A!!!Problem reading file\00"
define void @processFileRequest(i8* %0, i32 %1) {
%3 = alloca [4096 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @return404(i8* %0, i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %55
14: ; preds = %2
store i8 0, i8* %10
%15 = tail call i8* @strstr(i8* dereferenceable(1) %9, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @return404(i8* %0, i32 %1, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
br label %55
19: ; preds = %14
%20 = tail call i8* @strchr(i8* dereferenceable(1) %9, i32 63)
%21 = icmp eq i8* %20, null
br i1 %21, label %23, label %22
22: ; preds = %19
store i8 0, i8* %20
br label %23
23: ; preds = %22, %19
%24 = tail call i32 (...) @printTimestamp()
%25 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i8* %9)
%26 = load i32, i32* @O_RDONLY
%27 = tail call i32 @open(i8* %9, i32 %26)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = tail call i32 @return404(i8* %0, i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %55
31: ; preds = %23
%32 = tail call i32 @strlen(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%33 = tail call i32 @send(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %32, i32 0)
%34 = load i32, i32* @SEEK_END
%35 = tail call i64 @lseek(i32 %27, i32 0, i32 %34)
%36 = load i32, i32* @SEEK_SET
%37 = tail call i64 @lseek(i32 %27, i32 0, i32 %36)
%38 = call i32 @memset(i8* %6, i32 0, i32 1024)
%39 = trunc i64 %35 to i32
%40 = call i32 @snprintf(i8* %6, i32 1023, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %39)
%41 = call i32 @strlen(i8* %6)
%42 = call i32 @send(i32 %1, i8* %6, i32 %41, i32 0)
br label %43
43: ; preds = %48, %31
%44 = call i32 @read(i32 %27, i8* %5, i32 4096)
switch i32 %44, label %48 [
i32 0, label %51
i32 -1, label %45
]
45: ; preds = %43
%46 = call i32 @close(i32 %27)
%47 = call i32 @return404(i8* %0, i32 %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
br label %55
48: ; preds = %43
%49 = call i32 @send(i32 %1, i8* %5, i32 %44, i32 0)
%50 = call i32 @fsync(i32 %1)
br label %43
51: ; preds = %43
%52 = call i32 @close(i32 %27)
%53 = call i32 @fsync(i32 %1)
%54 = call i32 @close(i32 %1)
br label %55
55: ; preds = %45, %51, %29, %17, %12
ret void
}