#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 timespec {
  scalar_t__ tv_sec;
  scalar_t__ tv_nsec;
};
struct dirent {
  char *d_name;
};
typedef int pid_t;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ _exit(int);
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
char *ctime(scalar_t__ *);
int fork();
int /*<<< orphan*/ free(void *);
int getpid();
void *malloc(int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int system(char *);
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  printf("Test %d\n", argc);
  int i;
  for (i = 0; i < argc; i++) {
    printf("%d: %s\n", i, argv[i]);
  }
  struct timespec tp;
  if (clock_gettime(CLOCK_REALTIME, &tp) == 0) {
    printf("clock_gettime %d %d\n", (int)tp.tv_sec, (int)tp.tv_nsec);
    printf("ctime %s", ctime(&tp.tv_sec));
    void *test = malloc(1024 * 1024);
    if (test > 0) {
      printf("Malloc %p\n", test);
      free(test);
      printf("Free\n");
      DIR *dir = opendir("/home/");
      if (dir != NULL) {
        printf("opendir %p\n", dir);
        struct dirent *ent;
        while ((ent = readdir(dir)) != NULL) {
          printf("%s\n", ent->d_name);
        }
        closedir(dir);
        pid_t pid = fork();
        if (pid > 0) {
          printf("Fork Parent %d = %d\n", getpid(), pid);
          int status = 0;
          if (waitpid(pid, &status, 0) >= 0) {
            printf("waitpid status %d\n", status);
          } else {
            perror("waitpid failed\n");
          }
        } else if (pid == 0) {
          printf("Fork Child %d = %d\n", getpid(), pid);
          int result = system("echo test");
          if (result == 0) {
            printf("System Success");
          } else {
            printf("System Failed %d\n", result);
          }
          _exit(123);
        } else {
          printf("Fork Failed %d = %d\n", getpid(), pid);
        }
      } else {
        perror("Opendir Failed\n");
      }
    } else {
      perror("Malloc Failed\n");
    }
  } else {
    perror("clock_gettime Failed\n");
  }
  return 234;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1245 <main+0x65>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120e <main+0x2e>
mov    0x2d94(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1050 <clock_gettime@plt>
cmp    $0x0,%rax
jne    1463 <main+0x283>
mov    -0x28(%rbp),%rax
mov    %eax,%esi
mov    -0x20(%rbp),%rax
mov    %eax,%edx
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0x28(%rbp),%rdi
call   1080 <ctime@plt>
mov    %rax,%rsi
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x100000,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jbe    1452 <main+0x272>
mov    -0x30(%rbp),%rsi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    0xd62(%rip),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1441 <main+0x261>
mov    -0x38(%rbp),%rsi
lea    0xd4a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x38(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
je     1335 <main+0x155>
mov    -0x40(%rbp),%rax
mov    (%rax),%rsi
lea    0xce4(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1304 <main+0x124>
mov    -0x38(%rbp),%rdi
call   10b0 <closedir@plt>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jle    13b2 <main+0x1d2>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
mov    -0x44(%rbp),%edx
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x48(%rbp),%rsi
xor    %edx,%edx
call   10e0 <waitpid@plt>
cmp    $0x0,%rax
jl     13a1 <main+0x1c1>
mov    -0x48(%rbp),%esi
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    13ad <main+0x1cd>
lea    0xcd3(%rip),%rdi
call   10f0 <perror@plt>
jmp    143c <main+0x25c>
cmpl   $0x0,-0x44(%rbp)
jne    141d <main+0x23d>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
mov    -0x44(%rbp),%edx
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    0xcc2(%rip),%rdi
call   1090 <system@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jne    1402 <main+0x222>
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1413 <main+0x233>
mov    -0x4c(%rbp),%esi
lea    0xcac(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x7b,%edi
call   1040 <_exit@plt>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%esi
mov    -0x44(%rbp),%edx
lea    0xc9a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    143c <main+0x25c>
jmp    144d <main+0x26d>
lea    0xc97(%rip),%rdi
call   10f0 <perror@plt>
jmp    145e <main+0x27e>
lea    0xc96(%rip),%rdi
call   10f0 <perror@plt>
jmp    146f <main+0x28f>
lea    0xc94(%rip),%rdi
call   10f0 <perror@plt>
mov    $0xea,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xdf9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
test   %ebx,%ebx
jle    1239 <main+0x49>
mov    %ebx,%r12d
lea    0xdeb(%rip),%r14
xor    %ebx,%ebx
mov    (%r15,%rbx,8),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1220 <main+0x30>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1060 <clock_gettime@plt>
test   %rax,%rax
jne    1383 <main+0x193>
mov    0x8(%rsp),%esi
mov    0x10(%rsp),%edx
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0x8(%rsp),%rdi
call   1090 <ctime@plt>
lea    0xdaa(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x100000,%edi
call   10e0 <malloc@plt>
test   %rax,%rax
je     138c <main+0x19c>
mov    %rax,%rbx
lea    0xd8c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xe52(%rip),%rdi
call   1050 <puts@plt>
lea    0xd72(%rip),%rdi
call   1080 <opendir@plt>
test   %rax,%rax
je     1395 <main+0x1a5>
mov    %rax,%rbx
lea    0xd61(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1307 <main+0x117>
mov    (%rax),%rdi
call   1050 <puts@plt>
jmp    12f0 <main+0x100>
mov    %rbx,%rdi
call   10c0 <closedir@plt>
xor    %eax,%eax
call   1110 <fork@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1364 <main+0x174>
xor    %eax,%eax
call   1070 <getpid@plt>
lea    0xd23(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   10b0 <printf@plt>
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   10f0 <waitpid@plt>
test   %rax,%rax
js     139e <main+0x1ae>
mov    0x4(%rsp),%esi
lea    0xd07(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
jmp    13aa <main+0x1ba>
xor    %eax,%eax
call   1070 <getpid@plt>
test   %ebx,%ebx
je     13bb <main+0x1cb>
lea    0xd4e(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   10b0 <printf@plt>
jmp    13aa <main+0x1ba>
lea    0xd6e(%rip),%rdi
jmp    13a5 <main+0x1b5>
lea    0xd56(%rip),%rdi
jmp    13a5 <main+0x1b5>
lea    0xd3d(%rip),%rdi
jmp    13a5 <main+0x1b5>
lea    0xcd0(%rip),%rdi
call   1100 <perror@plt>
mov    $0xea,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xcc3(%rip),%rdi
mov    %eax,%esi
xor    %edx,%edx
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0xcc5(%rip),%rdi
call   10a0 <system@plt>
test   %eax,%eax
jne    13f5 <main+0x205>
lea    0xcbf(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x7b,%edi
call   1040 <_exit@plt>
lea    0xcb6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x7b,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
%struct.dirent = type { i8* }
@.str = [9 x i8] c"Test %d\0A\00"
@.str.1 = [8 x i8] c"%d: %s\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [21 x i8] c"clock_gettime %d %d\0A\00"
@.str.3 = [9 x i8] c"ctime %s\00"
@.str.4 = [11 x i8] c"Malloc %p\0A\00"
@.str.5 = [6 x i8] c"Free\0A\00"
@.str.6 = [7 x i8] c"/home/\00"
@.str.7 = [12 x i8] c"opendir %p\0A\00"
@.str.8 = [4 x i8] c"%s\0A\00"
@.str.9 = [21 x i8] c"Fork Parent %d = %d\0A\00"
@.str.10 = [19 x i8] c"waitpid status %d\0A\00"
@.str.11 = [16 x i8] c"waitpid failed\0A\00"
@.str.12 = [20 x i8] c"Fork Child %d = %d\0A\00"
@.str.13 = [10 x i8] c"echo test\00"
@.str.14 = [15 x i8] c"System Success\00"
@.str.15 = [18 x i8] c"System Failed %d\0A\00"
@.str.16 = [21 x i8] c"Fork Failed %d = %d\0A\00"
@.str.17 = [16 x i8] c"Opendir Failed\0A\00"
@.str.18 = [15 x i8] c"Malloc Failed\0A\00"
@.str.19 = [22 x i8] c"clock_gettime Failed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.timespec
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca %struct.dirent*
%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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %14)
store i32 0, i32* %6
br label %16
16: ; preds = %28, %2
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %16
%21 = load i32, i32* %6
%22 = load i8**, i8*** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %21, i8* %26)
br label %28
28: ; preds = %20
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %16
31: ; preds = %16
%32 = load i32, i32* @CLOCK_REALTIME
%33 = call i64 @clock_gettime(i32 %32, %struct.timespec* %7)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %118
35: ; preds = %31
%36 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 0
%37 = load i64, i64* %36
%38 = trunc i64 %37 to i32
%39 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 1
%40 = load i64, i64* %39
%41 = trunc i64 %40 to i32
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %38, i32 %41)
%43 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 0
%44 = call i8* @ctime(i64* %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = call i8* @malloc(i32 1048576)
store i8* %46, i8** %8
%47 = load i8*, i8** %8
%48 = icmp ugt i8* %47, null
br i1 %48, label %49, label %115
49: ; preds = %35
%50 = load i8*, i8** %8
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %50)
%52 = load i8*, i8** %8
%53 = call i32 @free(i8* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%55 = call i32* @opendir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
store i32* %55, i32** %9
%56 = load i32*, i32** %9
%57 = icmp ne i32* %56, null
br i1 %57, label %58, label %112
58: ; preds = %49
%59 = load i32*, i32** %9
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32* %59)
br label %61
61: ; preds = %65, %58
%62 = load i32*, i32** %9
%63 = call %struct.dirent* @readdir(i32* %62)
store %struct.dirent* %63, %struct.dirent** %10
%64 = icmp ne %struct.dirent* %63, null
br i1 %64, label %65, label %70
65: ; preds = %61
%66 = load %struct.dirent*, %struct.dirent** %10
%67 = getelementptr inbounds %struct.dirent, %struct.dirent* %66, i32 0, i32 0
%68 = load i8*, i8** %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %68)
br label %61
70: ; preds = %61
%71 = load i32*, i32** %9
%72 = call i32 @closedir(i32* %71)
%73 = call i32 (...) @fork()
store i32 %73, i32* %11
%74 = load i32, i32* %11
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %89
76: ; preds = %70
%77 = call i32 (...) @getpid()
%78 = load i32, i32* %11
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %77, i32 %78)
store i32 0, i32* %12
%80 = load i32, i32* %11
%81 = call i64 @waitpid(i32 %80, i32* %12, i32 0)
%82 = icmp sge i64 %81, 0
br i1 %82, label %83, label %86
83: ; preds = %76
%84 = load i32, i32* %12
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %84)
br label %88
86: ; preds = %76
%87 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %88
88: ; preds = %86, %83
br label %111
89: ; preds = %70
%90 = load i32, i32* %11
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %106
92: ; preds = %89
%93 = call i32 (...) @getpid()
%94 = load i32, i32* %11
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i32 %93, i32 %94)
%96 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
store i32 %96, i32* %13
%97 = load i32, i32* %13
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %92
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0))
br label %104
101: ; preds = %92
%102 = load i32, i32* %13
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i32 %102)
br label %104
104: ; preds = %101, %99
%105 = call i32 @_exit(i32 123)
unreachable
106: ; preds = %89
%107 = call i32 (...) @getpid()
%108 = load i32, i32* %11
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %107, i32 %108)
br label %110
110: ; preds = %106
br label %111
111: ; preds = %110, %88
br label %114
112: ; preds = %49
%113 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0))
br label %114
114: ; preds = %112, %111
br label %117
115: ; preds = %35
%116 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
br label %117
117: ; preds = %115, %114
br label %120
118: ; preds = %31
%119 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0))
br label %120
120: ; preds = %118, %117
ret i32 234
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
%struct.dirent = type { i8* }
@.str = [9 x i8] c"Test %d\0A\00"
@.str.1 = [8 x i8] c"%d: %s\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.2 = [21 x i8] c"clock_gettime %d %d\0A\00"
@.str.3 = [9 x i8] c"ctime %s\00"
@.str.4 = [11 x i8] c"Malloc %p\0A\00"
@.str.6 = [7 x i8] c"/home/\00"
@.str.7 = [12 x i8] c"opendir %p\0A\00"
@.str.9 = [21 x i8] c"Fork Parent %d = %d\0A\00"
@.str.10 = [19 x i8] c"waitpid status %d\0A\00"
@.str.11 = [16 x i8] c"waitpid failed\0A\00"
@.str.12 = [20 x i8] c"Fork Child %d = %d\0A\00"
@.str.13 = [10 x i8] c"echo test\00"
@.str.14 = [15 x i8] c"System Success\00"
@.str.15 = [18 x i8] c"System Failed %d\0A\00"
@.str.16 = [21 x i8] c"Fork Failed %d = %d\0A\00"
@.str.17 = [16 x i8] c"Opendir Failed\0A\00"
@.str.18 = [15 x i8] c"Malloc Failed\0A\00"
@.str.19 = [22 x i8] c"clock_gettime Failed\0A\00"
@str = [5 x i8] c"Free\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timespec
%4 = alloca i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = trunc i64 %10 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8* %12)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9, %2
%18 = bitcast %struct.timespec* %3 to i8*
%19 = load i32, i32* @CLOCK_REALTIME
%20 = call i64 @clock_gettime(i32 %19, %struct.timespec* %3)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %86
22: ; preds = %17
%23 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%24 = load i64, i64* %23
%25 = trunc i64 %24 to i32
%26 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%27 = load i64, i64* %26
%28 = trunc i64 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %28)
%30 = call i8* @ctime(i64* %23)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%32 = call dereferenceable_or_null(1048576) i8* @malloc(i32 1048576)
%33 = icmp eq i8* %32, null
br i1 %33, label %84, label %34
34: ; preds = %22
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%36 = call i32 @free(i8* %32)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%38 = call i32* @opendir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%39 = icmp eq i32* %38, null
br i1 %39, label %82, label %40
40: ; preds = %34
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32* %38)
%42 = call %struct.dirent* @readdir(i32* %38)
%43 = icmp eq %struct.dirent* %42, null
br i1 %43, label %51, label %44
44: ; preds = %40, %44
%45 = phi %struct.dirent* [ %49, %44 ], [ %42, %40 ]
%46 = getelementptr inbounds %struct.dirent, %struct.dirent* %45, i64 0, i32 0
%47 = load i8*, i8** %46
%48 = call i32 @puts(i8* dereferenceable(1) %47)
%49 = call %struct.dirent* @readdir(i32* %38)
%50 = icmp eq %struct.dirent* %49, null
br i1 %50, label %51, label %44
51: ; preds = %44, %40
%52 = call i32 @closedir(i32* %38)
%53 = call i32 (...) @fork()
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %67
55: ; preds = %51
%56 = call i32 (...) @getpid()
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %56, i32 %53)
%58 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%59 = call i64 @waitpid(i32 %53, i32* %4, i32 0)
%60 = icmp sgt i64 %59, -1
br i1 %60, label %61, label %64
61: ; preds = %55
%62 = load i32, i32* %4
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i32 %62)
br label %66
64: ; preds = %55
%65 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0))
br label %66
66: ; preds = %64, %61
br label %88
67: ; preds = %51
%68 = icmp eq i32 %53, 0
%69 = call i32 (...) @getpid()
br i1 %68, label %70, label %80
70: ; preds = %67
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i32 %69, i32 0)
%72 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0))
br label %78
76: ; preds = %70
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.15, i64 0, i64 0), i32 %72)
br label %78
78: ; preds = %76, %74
%79 = call i32 @_exit(i32 123)
unreachable
80: ; preds = %67
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0), i32 %69, i32 %53)
br label %88
82: ; preds = %34
%83 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0))
br label %88
84: ; preds = %22
%85 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
br label %88
86: ; preds = %17
%87 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0))
br label %88
88: ; preds = %84, %66, %80, %82, %86
ret i32 234
}