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

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strstr(char *, char *);
char *strtok(char *, char *);
int main() {
  DIR *dir;
  DIR *dir1 = NULL;
  FILE *fp;
  struct dirent *ptr;
  struct dirent *ptr1;
  char s[255];
  char path[50];
  char path1[50];
  char *mem;
  int i;
  printf("Content-type:text/html\r\n\r\n");
  printf("<html><head></head><body><div align='left'>");
  printf("<meta http-equiv='Content-Type' content='text/html; "
         "charset=utf-8'/></head>");
  if ((dir = opendir("/proc")) == NULL) {
    perror(" opendir");
    return -1;
  }
  printf(
      "<div><table style ='border-width:5px; border-collapse:collapse; 	"
      "border-color:#222796'; border='2'><tr><td width='40px'>PID</td><td "
      "width='100px'>	该任务虚拟地址空间大小</td><td "
      "width='130px'>该任务当前驻留物理地址空间大小</td>	<td "
      "width='140px'>该任务能驻留物理地址空间的最大值 </td><td "
      "width='150px'>	该任务在虚拟地址空间代码段的起始地址 </td><td "
      "width='150px'>该任务在虚拟地址空间代码段的结束地址	</td><td "
      "width='140px'>该任务在虚拟地址空间栈的结束地址</td></tr>");
  while ((ptr = readdir(dir)) != NULL) {
    if (isdigit(ptr->d_name[0])) {
      strcpy(path, "/proc/");
      strcat(path, ptr->d_name);
      if ((dir1 = opendir(path)) == NULL) {
        perror("opendir");
        return -1;
      }
      while ((ptr1 = readdir(dir1)) != NULL) {
        if (!strcmp(ptr1->d_name, "stat")) {
          strcpy(path1, path);
          strcat(path1, "/stat");
          fp = fopen(path1, "r");
          fgets(s, 255, fp);
          mem = strstr(s, " ");
          for (i = 1; i < 22; i++) {
            mem += 1;
            mem = strstr(mem, " ");
          }
          printf("<tr><td width='40px'>%s</td>", ptr->d_name);
          printf("<td width='100px'>%s</td>", strtok(mem, " "));
          printf("<td width='130px'>%s</td>", strtok(NULL, " "));
          printf("<td width='140px'>%s</td>", strtok(NULL, " "));
          printf("<td width='150px'>%s</td>", strtok(NULL, " "));
          printf("<td width='150px'>%s</td>", strtok(NULL, " "));
          printf("<td width='140px'>%s</td></tr>", strtok(NULL, " "));
        }
      }
    }
  }
  printf("</table></div>");
  closedir(dir1);
  closedir(dir);
  printf("</div></body></html>");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe78(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1246 <main+0x76>
lea    0xe64(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <main+0x329>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     14c4 <main+0x2f4>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     14bf <main+0x2ef>
lea    -0x170(%rbp),%rdi
lea    0x1040(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x170(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   10e0 <strcat@plt>
lea    -0x170(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    12dc <main+0x10c>
lea    0xdcf(%rip),%rdi
call   10c0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f9 <main+0x329>
jmp    12e1 <main+0x111>
mov    -0x18(%rbp),%rdi
call   10a0 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     14ba <main+0x2ea>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xfd4(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    14b5 <main+0x2e5>
lea    -0x1b0(%rbp),%rdi
lea    -0x170(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xfa4(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x1b0(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0xff,%esi
call   1080 <fgets@plt>
lea    -0x130(%rbp),%rdi
lea    0xf6b(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x1b8(%rbp)
movl   $0x1,-0x1bc(%rbp)
cmpl   $0x16,-0x1bc(%rbp)
jge    13d7 <main+0x207>
mov    -0x1b8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x1b8(%rbp),%rdi
lea    0xf28(%rip),%rsi
call   10f0 <strstr@plt>
mov    %rax,-0x1b8(%rbp)
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    138a <main+0x1ba>
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x1b8(%rbp),%rdi
lea    0xee5(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%rsi
lea    0xef5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xec4(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%rsi
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xea3(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%rsi
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe82(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%rsi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe61(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe40(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%rsi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12e1 <main+0x111>
jmp    14bf <main+0x2ef>
jmp    1254 <main+0x84>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <closedir@plt>
mov    -0x10(%rbp),%rdi
call   1070 <closedir@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
lea    0x1196(%rip),%rdi
call   1050 <puts@plt>
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe58(%rip),%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     157e <main+0x39e>
mov    %rax,%rbp
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
mov    %rbp,(%rsp)
je     153b <main+0x35b>
mov    %rax,%rbx
lea    0x1061(%rip),%r15
lea    0x50(%rsp),%r12
lea    0x105c(%rip),%r14
xor    %ebp,%ebp
jmp    1285 <main+0xa5>
xchg   %ax,%ax
mov    (%rsp),%rdi
call   10c0 <readdir@plt>
mov    %rax,%rbx
test   %rax,%rax
je     153d <main+0x35d>
mov    (%rbx),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1270 <main+0x90>
mov    %rbx,%rbp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
lea    0x1010(%rip),%rsi
call   1040 <strcpy@plt>
mov    %rbp,0x8(%rsp)
mov    0x0(%rbp),%rsi
mov    %rbx,%rdi
call   1100 <strcat@plt>
mov    %rbx,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     1587 <main+0x3a7>
mov    %rax,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     1270 <main+0x90>
mov    (%rax),%rdi
mov    %r15,%rsi
call   10b0 <strcmp@plt>
test   %eax,%eax
jne    12e0 <main+0x100>
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
lea    0xfab(%rip),%rsi
call   1100 <strcat@plt>
mov    %r12,%rdi
lea    0xd63(%rip),%rsi
call   10d0 <fopen@plt>
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %rax,%rdx
call   10a0 <fgets@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
lea    0x1(%rax),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,%r13
mov    0x8(%rsp),%rax
mov    (%rax),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13,%rdi
lea    0xe33(%rip),%r13
mov    %r13,%rsi
call   10f0 <strtok@plt>
lea    0xe43(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
lea    0xe42(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
lea    0xe41(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
mov    %rbp,%rbx
lea    0xe3d(%rip),%rbp
mov    %rbp,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
mov    %rbp,%rdi
mov    %rbx,%rbp
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   10f0 <strtok@plt>
lea    0xe1f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    12e0 <main+0x100>
xor    %ebp,%ebp
lea    0xe26(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbp,%rdi
call   1090 <closedir@plt>
mov    (%rsp),%rdi
call   1090 <closedir@plt>
lea    0xe16(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xaf9(%rip),%rdi
jmp    158e <main+0x3ae>
lea    0xaf1(%rip),%rdi
call   10e0 <perror@plt>
mov    $0xffffffff,%eax
jmp    156c <main+0x38c>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [27 x i8] c"Content-type:text/html\0D\0A\0D\0A\00"
@.str.1 = [44 x i8] c"<html><head></head><body><div align='left'>\00"
@.str.2 = [76 x i8] c"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head>\00"
@.str.3 = [6 x i8] c"/proc\00"
@.str.4 = [9 x i8] c" opendir\00"
@.str.5 = [560 x i8] c"<div><table style ='border-width:5px; border-collapse:collapse; \09border-color:'; border='2'><tr><td width='40px'>PID</td><td width='100px'>\09\E8\AF\A5\E4\BB\BB\E5\8A\A1\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F</td><td width='130px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\BD\93\E5\89\8D\E9\A9\BB\E7\95\99\E7\89\A9\E7\90\86\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F</td>\09<td width='140px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E8\83\BD\E9\A9\BB\E7\95\99\E7\89\A9\E7\90\86\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E7\9A\84\E6\9C\80\E5\A4\A7\E5\80\BC </td><td width='150px'>\09\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\9C\A8\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E4\BB\A3\E7\A0\81\E6\AE\B5\E7\9A\84\E8\B5\B7\E5\A7\8B\E5\9C\B0\E5\9D\80 </td><td width='150px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\9C\A8\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E4\BB\A3\E7\A0\81\E6\AE\B5\E7\9A\84\E7\BB\93\E6\9D\9F\E5\9C\B0\E5\9D\80\09</td><td width='140px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\9C\A8\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E6\A0\88\E7\9A\84\E7\BB\93\E6\9D\9F\E5\9C\B0\E5\9D\80</td></tr>\00"
@.str.6 = [7 x i8] c"/proc/\00"
@.str.7 = [8 x i8] c"opendir\00"
@.str.8 = [5 x i8] c"stat\00"
@.str.9 = [6 x i8] c"/stat\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [29 x i8] c"<tr><td width='40px'>%s</td>\00"
@.str.13 = [26 x i8] c"<td width='100px'>%s</td>\00"
@.str.14 = [26 x i8] c"<td width='130px'>%s</td>\00"
@.str.15 = [26 x i8] c"<td width='140px'>%s</td>\00"
@.str.16 = [26 x i8] c"<td width='150px'>%s</td>\00"
@.str.17 = [31 x i8] c"<td width='140px'>%s</td></tr>\00"
@.str.18 = [15 x i8] c"</table></div>\00"
@.str.19 = [21 x i8] c"</div></body></html>\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca %struct.dirent*
%6 = alloca %struct.dirent*
%7 = alloca [255 x i8]
%8 = alloca [50 x i8]
%9 = alloca [50 x i8]
%10 = alloca i8*
%11 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32* %15, i32** %2
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %109
19: ; preds = %0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([560 x i8], [560 x i8]* @.str.5, i64 0, i64 0))
br label %21
21: ; preds = %101, %19
%22 = load i32*, i32** %2
%23 = call %struct.dirent* @readdir(i32* %22)
store %struct.dirent* %23, %struct.dirent** %5
%24 = icmp ne %struct.dirent* %23, null
br i1 %24, label %25, label %102
25: ; preds = %21
%26 = load %struct.dirent*, %struct.dirent** %5
%27 = getelementptr inbounds %struct.dirent, %struct.dirent* %26, i32 0, i32 0
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = call i64 @isdigit(i8 signext %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %101
33: ; preds = %25
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%37 = load %struct.dirent*, %struct.dirent** %5
%38 = getelementptr inbounds %struct.dirent, %struct.dirent* %37, i32 0, i32 0
%39 = load i8*, i8** %38
%40 = call i32 @strcat(i8* %36, i8* %39)
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%42 = call i32* @opendir(i8* %41)
store i32* %42, i32** %3
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %46
44: ; preds = %33
%45 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %1
br label %109
46: ; preds = %33
br label %47
47: ; preds = %99, %46
%48 = load i32*, i32** %3
%49 = call %struct.dirent* @readdir(i32* %48)
store %struct.dirent* %49, %struct.dirent** %6
%50 = icmp ne %struct.dirent* %49, null
br i1 %50, label %51, label %100
51: ; preds = %47
%52 = load %struct.dirent*, %struct.dirent** %6
%53 = getelementptr inbounds %struct.dirent, %struct.dirent* %52, i32 0, i32 0
%54 = load i8*, i8** %53
%55 = call i32 @strcmp(i8* %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%56 = icmp ne i32 %55, 0
br i1 %56, label %99, label %57
57: ; preds = %51
%58 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%59 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%60 = call i32 @strcpy(i8* %58, i8* %59)
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%62 = call i32 @strcat(i8* %61, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%63 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%64 = call i32* @fopen(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %64, i32** %4
%65 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%66 = load i32*, i32** %4
%67 = call i32 @fgets(i8* %65, i32 255, i32* %66)
%68 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%69 = call i8* @strstr(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i8* %69, i8** %10
store i32 1, i32* %11
br label %70
70: ; preds = %78, %57
%71 = load i32, i32* %11
%72 = icmp slt i32 %71, 22
br i1 %72, label %73, label %81
73: ; preds = %70
%74 = load i8*, i8** %10
%75 = getelementptr inbounds i8, i8* %74, i64 1
store i8* %75, i8** %10
%76 = load i8*, i8** %10
%77 = call i8* @strstr(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i8* %77, i8** %10
br label %78
78: ; preds = %73
%79 = load i32, i32* %11
%80 = add nsw i32 %79, 1
store i32 %80, i32* %11
br label %70
81: ; preds = %70
%82 = load %struct.dirent*, %struct.dirent** %5
%83 = getelementptr inbounds %struct.dirent, %struct.dirent* %82, i32 0, i32 0
%84 = load i8*, i8** %83
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %84)
%86 = load i8*, i8** %10
%87 = call i8* @strtok(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i8* %87)
%89 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %89)
%91 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0), i8* %91)
%93 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %93)
%95 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %95)
%97 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0), i8* %97)
br label %99
99: ; preds = %81, %51
br label %47
100: ; preds = %47
br label %101
101: ; preds = %100, %25
br label %21
102: ; preds = %21
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%104 = load i32*, i32** %3
%105 = call i32 @closedir(i32* %104)
%106 = load i32*, i32** %2
%107 = call i32 @closedir(i32* %106)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
store i32 0, i32* %1
br label %109
109: ; preds = %102, %44, %17
%110 = load i32, i32* %1
ret i32 %110
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str.1 = [44 x i8] c"<html><head></head><body><div align='left'>\00"
@.str.2 = [76 x i8] c"<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/></head>\00"
@.str.3 = [6 x i8] c"/proc\00"
@.str.4 = [9 x i8] c" opendir\00"
@.str.5 = [560 x i8] c"<div><table style ='border-width:5px; border-collapse:collapse; \09border-color:'; border='2'><tr><td width='40px'>PID</td><td width='100px'>\09\E8\AF\A5\E4\BB\BB\E5\8A\A1\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F</td><td width='130px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\BD\93\E5\89\8D\E9\A9\BB\E7\95\99\E7\89\A9\E7\90\86\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E5\A4\A7\E5\B0\8F</td>\09<td width='140px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E8\83\BD\E9\A9\BB\E7\95\99\E7\89\A9\E7\90\86\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E7\9A\84\E6\9C\80\E5\A4\A7\E5\80\BC </td><td width='150px'>\09\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\9C\A8\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E4\BB\A3\E7\A0\81\E6\AE\B5\E7\9A\84\E8\B5\B7\E5\A7\8B\E5\9C\B0\E5\9D\80 </td><td width='150px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\9C\A8\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E4\BB\A3\E7\A0\81\E6\AE\B5\E7\9A\84\E7\BB\93\E6\9D\9F\E5\9C\B0\E5\9D\80\09</td><td width='140px'>\E8\AF\A5\E4\BB\BB\E5\8A\A1\E5\9C\A8\E8\99\9A\E6\8B\9F\E5\9C\B0\E5\9D\80\E7\A9\BA\E9\97\B4\E6\A0\88\E7\9A\84\E7\BB\93\E6\9D\9F\E5\9C\B0\E5\9D\80</td></tr>\00"
@.str.6 = [7 x i8] c"/proc/\00"
@.str.7 = [8 x i8] c"opendir\00"
@.str.8 = [5 x i8] c"stat\00"
@.str.9 = [6 x i8] c"/stat\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [29 x i8] c"<tr><td width='40px'>%s</td>\00"
@.str.13 = [26 x i8] c"<td width='100px'>%s</td>\00"
@.str.14 = [26 x i8] c"<td width='130px'>%s</td>\00"
@.str.15 = [26 x i8] c"<td width='140px'>%s</td>\00"
@.str.16 = [26 x i8] c"<td width='150px'>%s</td>\00"
@.str.17 = [31 x i8] c"<td width='140px'>%s</td></tr>\00"
@.str.18 = [15 x i8] c"</table></div>\00"
@.str.19 = [21 x i8] c"</div></body></html>\00"
@str = [26 x i8] c"Content-type:text/html\0D\0A\0D\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %118
14: ; preds = %0
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([560 x i8], [560 x i8]* @.str.5, i64 0, i64 0))
%16 = call %struct.dirent* @readdir(i32* %10)
%17 = icmp eq %struct.dirent* %16, null
br i1 %17, label %112, label %18
18: ; preds = %14, %108
%19 = phi %struct.dirent* [ %110, %108 ], [ %16, %14 ]
%20 = phi i32* [ %109, %108 ], [ null, %14 ]
%21 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i64 0, i32 0
%22 = load i8*, i8** %21
%23 = load i8, i8* %22
%24 = call i64 @isdigit(i8 signext %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %108, label %26
26: ; preds = %18
%27 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%28 = load i8*, i8** %21
%29 = call i32 @strcat(i8* %5, i8* %28)
%30 = call i32* @opendir(i8* %5)
%31 = icmp eq i32* %30, null
br i1 %31, label %35, label %32
32: ; preds = %26
%33 = call %struct.dirent* @readdir(i32* %30)
%34 = icmp eq %struct.dirent* %33, null
br i1 %34, label %108, label %37
35: ; preds = %26
%36 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %118
37: ; preds = %32, %105
%38 = phi %struct.dirent* [ %106, %105 ], [ %33, %32 ]
%39 = getelementptr inbounds %struct.dirent, %struct.dirent* %38, i64 0, i32 0
%40 = load i8*, i8** %39
%41 = call i32 @strcmp(i8* dereferenceable(1) %40, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %105
43: ; preds = %37
%44 = call i32 @strcpy(i8* %6, i8* %5)
%45 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%46 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%47 = call i32 @fgets(i8* %4, i32 255, i32* %46)
%48 = call i8* @strchr(i8* %4, i32 32)
%49 = getelementptr inbounds i8, i8* %48, i64 1
%50 = call i8* @strchr(i8* %49, i32 32)
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = call i8* @strchr(i8* %51, i32 32)
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = call i8* @strchr(i8* %53, i32 32)
%55 = getelementptr inbounds i8, i8* %54, i64 1
%56 = call i8* @strchr(i8* %55, i32 32)
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = call i8* @strchr(i8* %57, i32 32)
%59 = getelementptr inbounds i8, i8* %58, i64 1
%60 = call i8* @strchr(i8* %59, i32 32)
%61 = getelementptr inbounds i8, i8* %60, i64 1
%62 = call i8* @strchr(i8* %61, i32 32)
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = call i8* @strchr(i8* %63, i32 32)
%65 = getelementptr inbounds i8, i8* %64, i64 1
%66 = call i8* @strchr(i8* %65, i32 32)
%67 = getelementptr inbounds i8, i8* %66, i64 1
%68 = call i8* @strchr(i8* %67, i32 32)
%69 = getelementptr inbounds i8, i8* %68, i64 1
%70 = call i8* @strchr(i8* %69, i32 32)
%71 = getelementptr inbounds i8, i8* %70, i64 1
%72 = call i8* @strchr(i8* %71, i32 32)
%73 = getelementptr inbounds i8, i8* %72, i64 1
%74 = call i8* @strchr(i8* %73, i32 32)
%75 = getelementptr inbounds i8, i8* %74, i64 1
%76 = call i8* @strchr(i8* %75, i32 32)
%77 = getelementptr inbounds i8, i8* %76, i64 1
%78 = call i8* @strchr(i8* %77, i32 32)
%79 = getelementptr inbounds i8, i8* %78, i64 1
%80 = call i8* @strchr(i8* %79, i32 32)
%81 = getelementptr inbounds i8, i8* %80, i64 1
%82 = call i8* @strchr(i8* %81, i32 32)
%83 = getelementptr inbounds i8, i8* %82, i64 1
%84 = call i8* @strchr(i8* %83, i32 32)
%85 = getelementptr inbounds i8, i8* %84, i64 1
%86 = call i8* @strchr(i8* %85, i32 32)
%87 = getelementptr inbounds i8, i8* %86, i64 1
%88 = call i8* @strchr(i8* %87, i32 32)
%89 = getelementptr inbounds i8, i8* %88, i64 1
%90 = call i8* @strchr(i8* %89, i32 32)
%91 = load i8*, i8** %21
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %91)
%93 = call i8* @strtok(i8* %90, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i8* %93)
%95 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%96 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.14, i64 0, i64 0), i8* %95)
%97 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.15, i64 0, i64 0), i8* %97)
%99 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %99)
%101 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0), i8* %101)
%103 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0), i8* %103)
br label %105
105: ; preds = %43, %37
%106 = call %struct.dirent* @readdir(i32* %30)
%107 = icmp eq %struct.dirent* %106, null
br i1 %107, label %108, label %37
108: ; preds = %105, %32, %18
%109 = phi i32* [ %20, %18 ], [ %30, %32 ], [ %30, %105 ]
%110 = call %struct.dirent* @readdir(i32* %10)
%111 = icmp eq %struct.dirent* %110, null
br i1 %111, label %112, label %18
112: ; preds = %108, %14
%113 = phi i32* [ null, %14 ], [ %109, %108 ]
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%115 = call i32 @closedir(i32* %113)
%116 = call i32 @closedir(i32* %10)
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
br label %118
118: ; preds = %112, %35, %12
%119 = phi i32 [ -1, %12 ], [ -1, %35 ], [ 0, %112 ]
ret i32 %119
}