#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 int /*<<< orphan*/ tmp_path;
typedef int /*<<< orphan*/ tmp;
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ msg;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ SendError(int, int, char *, char *, char *);
int /*<<< orphan*/ SendHeaders(int, int, char *, char *, char *, size_t,
                               int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
int /*<<< orphan*/ substr(char *, int, int, char *);
int /*<<< orphan*/ write(int, char *, size_t);
int SendDirectory(int client_sock, char *path, char *pathinfo) {
  size_t file_size;
  char msg[128], buf[10240], tmp[1024], tmp_path[1024];
  DIR *dp;
  struct dirent *node;
  if ((dp = opendir(path)) == NULL) {
    memset(buf, 0, sizeof(msg));
    sprintf(msg, "Something unexpected went wrong browse directory %s.",
            pathinfo);
    SendError(client_sock, 500, "Internal Server Error", "", msg);
  }
  memset(tmp_path, 0, sizeof(tmp_path));
  substr(pathinfo, -1, 1, tmp_path);
  if (strcmp(tmp_path, "/") == 0) {
    memset(tmp_path, 0, sizeof(tmp_path));
    strcpy(tmp_path, pathinfo);
  } else {
    memset(tmp_path, 0, sizeof(tmp_path));
    strcpy(tmp_path, pathinfo);
    strcat(tmp_path, "/");
  }
  sprintf(tmp,
          "<html>\n<head>\n<title>Browse directory %s - "
          "%s</title>\n</head>\n<body><h3>Directory %s</h3>\n<hr />\n<ul>\n",
          pathinfo, "tmhttpd/1.0.0_alpha", pathinfo);
  strcat(buf, tmp);
  while ((node = readdir(dp)) != NULL) {
    if (strcmp(node->d_name, ".") != 0) {
      memset(tmp, 0, sizeof(tmp));
      sprintf(tmp, "\t<li><a href=\"%s%s\">%s</a></li>\n", tmp_path,
              node->d_name, node->d_name);
      strcat(buf, tmp);
    }
  }
  memset(tmp, 0, sizeof(tmp));
  sprintf(tmp,
          "\n</ul>\n<br /><hr />\n<address>%s</address>\n</body>\n</html>\n",
          "tmhttpd/1.0.0_alpha");
  strcat(buf, tmp);
  file_size = strlen(buf);
  SendHeaders(client_sock, 200, "OK", "", "text/html", file_size, 0);
  write(client_sock, buf, file_size);
  return 0;
}


x86 assembly (clang, -O0):
<SendDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30c0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x30a8(%rbp)
cmp    $0x0,%rax
jne    123e <SendDirectory+0x7e>
lea    -0x28a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   10a0 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xdeb(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%r8
mov    $0x1f4,%esi
lea    0xe03(%rip),%rdx
lea    0xeaf(%rip),%rcx
call   1030 <SendError@plt>
lea    -0x30a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30a0(%rbp),%rcx
mov    $0xffffffff,%esi
mov    $0x1,%edx
call   1080 <substr@plt>
lea    -0x30a0(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    12b0 <SendDirectory+0xf0>
lea    -0x30a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x30a0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    12e6 <SendDirectory+0x126>
lea    -0x30a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x30a0(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x30a0(%rbp),%rdi
lea    0xd6a(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x2ca0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%r8
lea    0xd51(%rip),%rsi
lea    0xdb1(%rip),%rcx
mov    $0x0,%al
call   10e0 <sprintf@plt>
lea    -0x28a0(%rbp),%rdi
lea    -0x2ca0(%rbp),%rsi
call   10d0 <strcat@plt>
mov    -0x30a8(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x30b0(%rbp)
cmp    $0x0,%rax
je     13b5 <SendDirectory+0x1f5>
mov    -0x30b0(%rbp),%rax
mov    (%rax),%rdi
lea    0xce8(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     13b0 <SendDirectory+0x1f0>
lea    -0x2ca0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x2ca0(%rbp),%rdi
lea    -0x30a0(%rbp),%rdx
mov    -0x30b0(%rbp),%rax
mov    (%rax),%rcx
mov    -0x30b0(%rbp),%rax
mov    (%rax),%r8
lea    0xd32(%rip),%rsi
mov    $0x0,%al
call   10e0 <sprintf@plt>
lea    -0x28a0(%rbp),%rdi
lea    -0x2ca0(%rbp),%rsi
call   10d0 <strcat@plt>
jmp    131d <SendDirectory+0x15d>
lea    -0x2ca0(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    -0x2ca0(%rbp),%rdi
lea    0xd13(%rip),%rsi
lea    0xcd7(%rip),%rdx
mov    $0x0,%al
call   10e0 <sprintf@plt>
lea    -0x28a0(%rbp),%rdi
lea    -0x2ca0(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x28a0(%rbp),%rdi
call   1070 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%r9
mov    $0xc8,%esi
lea    0xd0a(%rip),%rdx
lea    0xcc7(%rip),%rcx
lea    0xcff(%rip),%r8
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1090 <SendHeaders@plt>
mov    -0x4(%rbp),%edi
lea    -0x28a0(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <write@plt>
xor    %eax,%eax
add    $0x30c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendDirectory>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3098,%rsp
mov    %rdx,%r14
mov    %edi,%ebp
mov    %rsi,%rdi
call   1060 <opendir@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1230 <SendDirectory+0x70>
lea    0x890(%rsp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   10a0 <memset@plt>
lea    0xdff(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   10e0 <sprintf@plt>
lea    0xe1b(%rip),%rdx
lea    0xec7(%rip),%rcx
mov    %ebp,%edi
mov    $0x1f4,%esi
mov    %rbx,%r8
call   1030 <SendError@plt>
mov    %ebp,0xc(%rsp)
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    %r14,%rdi
mov    $0xffffffff,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <substr@plt>
lea    0xde4(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
test   %rbp,%rbp
je     12a5 <SendDirectory+0xe5>
lea    0xdb3(%rip),%rsi
lea    0x90(%rsp),%rdi
call   10d0 <strcat@plt>
lea    0xda1(%rip),%rsi
lea    0xe01(%rip),%rcx
lea    0x490(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%r8
xor    %eax,%eax
call   10e0 <sprintf@plt>
lea    0x890(%rsp),%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
mov    %r15,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     1368 <SendDirectory+0x1a8>
mov    %rax,%r12
lea    0xd3d(%rip),%rbp
lea    0x490(%rsp),%rbx
lea    0x90(%rsp),%r13
lea    0x890(%rsp),%r14
jmp    1320 <SendDirectory+0x160>
mov    %r15,%rdi
call   10c0 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     1368 <SendDirectory+0x1a8>
mov    (%r12),%rdi
mov    %rbp,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1310 <SendDirectory+0x150>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    (%r12),%rcx
mov    %rbx,%rdi
lea    0xd7a(%rip),%rsi
mov    %r13,%rdx
mov    %rcx,%r8
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
jmp    1310 <SendDirectory+0x150>
lea    0x490(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
lea    0xd63(%rip),%rsi
lea    0xd27(%rip),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <sprintf@plt>
lea    0x890(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   10d0 <strcat@plt>
mov    %r14,%rdi
call   1070 <strlen@plt>
mov    %rax,%rbx
movl   $0x0,(%rsp)
lea    0xd61(%rip),%rdx
lea    0xd1e(%rip),%rcx
lea    0xd56(%rip),%r8
mov    0xc(%rsp),%ebp
mov    %ebp,%edi
mov    $0xc8,%esi
mov    %rax,%r9
call   1090 <SendHeaders@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <write@plt>
xor    %eax,%eax
add    $0x3098,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [53 x i8] c"Something unexpected went wrong browse directory %s.\00"
@.str.1 = [22 x i8] c"Internal Server Error\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [103 x i8] c"<html>\0A<head>\0A<title>Browse directory %s - %s</title>\0A</head>\0A<body><h3>Directory %s</h3>\0A<hr />\0A<ul>\0A\00"
@.str.5 = [20 x i8] c"tmhttpd/1.0.0_alpha\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [33 x i8] c"\09<li><a href=\22%s%s\22>%s</a></li>\0A\00"
@.str.8 = [59 x i8] c"\0A</ul>\0A<br /><hr />\0A<address>%s</address>\0A</body>\0A</html>\0A\00"
@.str.9 = [3 x i8] c"OK\00"
@.str.10 = [10 x i8] c"text/html\00"
define i32 @SendDirectory(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [128 x i8]
%9 = alloca [10240 x i8]
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
%12 = alloca i32*
%13 = alloca %struct.dirent*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%14 = load i8*, i8** %5
%15 = call i32* @opendir(i8* %14)
store i32* %15, i32** %12
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %26
17: ; preds = %3
%18 = getelementptr inbounds [10240 x i8], [10240 x i8]* %9, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i32 0, i32 128)
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%21 = load i8*, i8** %6
%22 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %4
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%25 = call i32 @SendError(i32 %23, i32 500, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %17, %3
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%28 = call i32 @memset(i8* %27, i32 0, i32 1024)
%29 = load i8*, i8** %6
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%31 = call i32 @substr(i8* %29, i32 -1, i32 1, i8* %30)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %26
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%37 = call i32 @memset(i8* %36, i32 0, i32 1024)
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%39 = load i8*, i8** %6
%40 = call i32 @strcpy(i8* %38, i8* %39)
br label %49
41: ; preds = %26
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%43 = call i32 @memset(i8* %42, i32 0, i32 1024)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%45 = load i8*, i8** %6
%46 = call i32 @strcpy(i8* %44, i8* %45)
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%48 = call i32 @strcat(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %49
49: ; preds = %41, %35
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%51 = load i8*, i8** %6
%52 = load i8*, i8** %6
%53 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %50, i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.4, i64 0, i64 0), i8* %51, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds [10240 x i8], [10240 x i8]* %9, i64 0, i64 0
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%56 = call i32 @strcat(i8* %54, i8* %55)
br label %57
57: ; preds = %82, %49
%58 = load i32*, i32** %12
%59 = call %struct.dirent* @readdir(i32* %58)
store %struct.dirent* %59, %struct.dirent** %13
%60 = icmp ne %struct.dirent* %59, null
br i1 %60, label %61, label %83
61: ; preds = %57
%62 = load %struct.dirent*, %struct.dirent** %13
%63 = getelementptr inbounds %struct.dirent, %struct.dirent* %62, i32 0, i32 0
%64 = load i8*, i8** %63
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %82
67: ; preds = %61
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%69 = call i32 @memset(i8* %68, i32 0, i32 1024)
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%72 = load %struct.dirent*, %struct.dirent** %13
%73 = getelementptr inbounds %struct.dirent, %struct.dirent* %72, i32 0, i32 0
%74 = load i8*, i8** %73
%75 = load %struct.dirent*, %struct.dirent** %13
%76 = getelementptr inbounds %struct.dirent, %struct.dirent* %75, i32 0, i32 0
%77 = load i8*, i8** %76
%78 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %70, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %71, i8* %74, i8* %77)
%79 = getelementptr inbounds [10240 x i8], [10240 x i8]* %9, i64 0, i64 0
%80 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%81 = call i32 @strcat(i8* %79, i8* %80)
br label %82
82: ; preds = %67, %61
br label %57
83: ; preds = %57
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%85 = call i32 @memset(i8* %84, i32 0, i32 1024)
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%87 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %86, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%88 = getelementptr inbounds [10240 x i8], [10240 x i8]* %9, i64 0, i64 0
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%90 = call i32 @strcat(i8* %88, i8* %89)
%91 = getelementptr inbounds [10240 x i8], [10240 x i8]* %9, i64 0, i64 0
%92 = call i64 @strlen(i8* %91)
store i64 %92, i64* %7
%93 = load i32, i32* %4
%94 = load i64, i64* %7
%95 = call i32 @SendHeaders(i32 %93, i32 200, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i64 %94, i32 0)
%96 = load i32, i32* %4
%97 = getelementptr inbounds [10240 x i8], [10240 x i8]* %9, i64 0, i64 0
%98 = load i64, i64* %7
%99 = call i32 @write(i32 %96, i8* %97, i64 %98)
ret i32 0
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [53 x i8] c"Something unexpected went wrong browse directory %s.\00"
@.str.1 = [22 x i8] c"Internal Server Error\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [103 x i8] c"<html>\0A<head>\0A<title>Browse directory %s - %s</title>\0A</head>\0A<body><h3>Directory %s</h3>\0A<hr />\0A<ul>\0A\00"
@.str.5 = [20 x i8] c"tmhttpd/1.0.0_alpha\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [33 x i8] c"\09<li><a href=\22%s%s\22>%s</a></li>\0A\00"
@.str.8 = [59 x i8] c"\0A</ul>\0A<br /><hr />\0A<address>%s</address>\0A</body>\0A</html>\0A\00"
@.str.9 = [3 x i8] c"OK\00"
@.str.10 = [10 x i8] c"text/html\00"
define i32 @SendDirectory(i32 %0, i8* nocapture %1, i8* %2) {
%4 = alloca [128 x i8]
%5 = alloca [10240 x i8]
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%12 = tail call i32* @opendir(i8* %1)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = call i32 @memset(i8* %9, i32 0, i32 128)
%16 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %2)
%17 = call i32 @SendError(i32 %0, i32 500, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* %8)
br label %18
18: ; preds = %14, %3
%19 = call i32 @memset(i8* %11, i32 0, i32 1024)
%20 = call i32 @substr(i8* %2, i32 -1, i32 1, i8* %11)
%21 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
%23 = call i32 @memset(i8* %11, i32 0, i32 1024)
%24 = call i32 @strcpy(i8* %11, i8* %2)
br i1 %22, label %27, label %25
25: ; preds = %18
%26 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %18, %25
%28 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%29 = call i32 @strcat(i8* %9, i8* %10)
%30 = call %struct.dirent* @readdir(i32* %12)
%31 = icmp eq %struct.dirent* %30, null
br i1 %31, label %46, label %32
32: ; preds = %27, %43
%33 = phi %struct.dirent* [ %44, %43 ], [ %30, %27 ]
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i64 0, i32 0
%35 = load i8*, i8** %34
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %43, label %38
38: ; preds = %32
%39 = call i32 @memset(i8* %10, i32 0, i32 1024)
%40 = load i8*, i8** %34
%41 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %11, i8* %40, i8* %40)
%42 = call i32 @strcat(i8* %9, i8* %10)
br label %43
43: ; preds = %38, %32
%44 = call %struct.dirent* @readdir(i32* %12)
%45 = icmp eq %struct.dirent* %44, null
br i1 %45, label %46, label %32
46: ; preds = %43, %27
%47 = call i32 @memset(i8* %10, i32 0, i32 1024)
%48 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%49 = call i32 @strcat(i8* %9, i8* %10)
%50 = call i64 @strlen(i8* %9)
%51 = call i32 @SendHeaders(i32 %0, i32 200, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i64 %50, i32 0)
%52 = call i32 @write(i32 %0, i8* %9, i64 %50)
ret i32 0
}