#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_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct timeval {
  int /*<<< orphan*/ tv_usec;
};
struct TYPE_4__ {
  int tv_usec;
};
struct TYPE_3__ {
  int tv_usec;
};
struct rusage {
  int /*<<< orphan*/ ru_minflt;
  int /*<<< orphan*/ ru_majflt;
  int /*<<< orphan*/ ru_nvcsw;
  int /*<<< orphan*/ ru_nivcsw;
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ cwd;

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_CHILDREN;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ *getcwd(char *, int);
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
char *strdup(char *);
char *strerror(int /*<<< orphan*/);
char *strsep(char **, char *);
int /*<<< orphan*/ wait(int *);
int main() {
  char line[256];
  pid_t pid;
  struct rusage ru;
  struct timeval wallclock;
  time_t begin, end;
  while (1) {
    char *pos;
    char *token, *string, *tofree;
    char *arg[256];
    int i = 0;
    long sarray_len = 0;
    printf("\n%s ", "LOG710H2015%>");
    fgets(line, sizeof(line), stdin);
    if ((pos = strchr(line, '\n')) != NULL)
      *pos = '\0';
    tofree = string = strdup(line);
    assert(string != NULL);
    while ((token = strsep(&string, " ")) != NULL) {
      arg[i] = token;
      ++i;
    }
    arg[i] = NULL;
    if (strcmp(arg[0], "exit") == 0) {
      exit(0);
    } else if (strcmp(arg[0], "cd") == 0) {
      char cwd[1024];
      if (getcwd(cwd, sizeof(cwd)) != NULL)
        printf("Ancien: %s\n", cwd);
      if (arg[1] != NULL) {
        chdir(arg[1]);
      }
      if (getcwd(cwd, sizeof(cwd)) != NULL)
        printf("Présent: %s\n", cwd);
    } else {
      gettimeofday(&wallclock, NULL);
      begin = wallclock.tv_usec;
      if ((pid = fork()) < 0) {
        printf("Erreur %s\n", strerror(errno));
        exit(-1);
      } else if (pid == 0) {
        execvp(arg[0], arg);
      } else {
        int status;
        wait(&status);
        gettimeofday(&wallclock, NULL);
        end = wallclock.tv_usec;
        getrusage(RUSAGE_CHILDREN, &ru);
        printf("\n*************************STATISTIQUES************************"
               "*\n");
        printf("* Temps écoulé pour exécution (wall-clock time): %ld ms\n",
               end - begin);
        printf("* Temps CPU utilisé (user mode): %d ms\n", ru.ru_utime.tv_usec);
        printf("* Temps CPU utilisé (kernel mode): %d ms\n",
               ru.ru_stime.tv_usec);
        printf("* Nombre d'interruptions involontaires: %ld\n", ru.ru_nivcsw);
        printf("* Nombre de fois que le CPU a été libéré volontairement: %ld\n",
               ru.ru_nvcsw);
        printf("* Nombre de défauts de pages: %ld\n", ru.ru_majflt);
        printf("* Nombre de défauts de pages satisfaits par cache: %ld\n",
               ru.ru_minflt);
        printf(
            "**************************************************************\n");
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x964(%rbp)
movq   $0x0,-0x970(%rbp)
lea    0xdd2(%rip),%rdi
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1080 <fgets@plt>
lea    -0x110(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0x148(%rbp)
cmp    $0x0,%rax
je     1282 <main+0x82>
mov    -0x148(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x110(%rbp),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x158(%rbp)
mov    %rax,-0x160(%rbp)
cmpq   $0x0,-0x158(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
lea    -0x158(%rbp),%rdi
lea    0xd44(%rip),%rsi
call   10b0 <strsep@plt>
mov    %rax,-0x150(%rbp)
cmp    $0x0,%rax
je     12ff <main+0xff>
mov    -0x150(%rbp),%rcx
movslq -0x964(%rbp),%rax
mov    %rcx,-0x960(%rbp,%rax,8)
ff
mov    -0x964(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x964(%rbp)
jmp    12b1 <main+0xb1>
movslq -0x964(%rbp),%rax
movq   $0x0,-0x960(%rbp,%rax,8)
mov    -0x960(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1336 <main+0x136>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x960(%rbp),%rdi
lea    0xcd4(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    13d2 <main+0x1d2>
lea    -0xd70(%rbp),%rdi
mov    $0x400,%esi
call   1070 <getcwd@plt>
cmp    $0x0,%rax
je     1383 <main+0x183>
lea    -0xd70(%rbp),%rsi
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpq   $0x0,-0x958(%rbp)
je     139d <main+0x19d>
mov    -0x958(%rbp),%rdi
call   1030 <chdir@plt>
lea    -0xd70(%rbp),%rdi
mov    $0x400,%esi
call   1070 <getcwd@plt>
cmp    $0x0,%rax
je     13cd <main+0x1cd>
lea    -0xd70(%rbp),%rsi
lea    0xc61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    154a <main+0x34a>
lea    -0x138(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x138(%rbp),%eax
mov    %eax,-0x13c(%rbp)
mov    $0x0,%al
call   1120 <fork@plt>
mov    %rax,-0x118(%rbp)
cmp    $0x0,%rax
jge    142f <main+0x22f>
mov    0x2bc3(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %rax,%rsi
lea    0xc17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
cmpq   $0x0,-0x118(%rbp)
jne    1455 <main+0x255>
mov    -0x960(%rbp),%rdi
lea    -0x960(%rbp),%rsi
call   10d0 <execvp@plt>
jmp    1540 <main+0x340>
lea    -0xd74(%rbp),%rdi
call   1110 <wait@plt>
lea    -0x138(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x138(%rbp),%eax
mov    %eax,-0x140(%rbp)
mov    0x2b54(%rip),%rax
mov    (%rax),%edi
lea    -0x130(%rbp),%rsi
call   10c0 <getrusage@plt>
lea    0xba7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x140(%rbp),%esi
sub    -0x13c(%rbp),%esi
lea    0xbce(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x11c(%rbp),%esi
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x120(%rbp),%esi
lea    0xc0b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x124(%rbp),%esi
lea    0xc22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x128(%rbp),%esi
lea    0xc3b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x12c(%rbp),%esi
lea    0xc69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x130(%rbp),%esi
lea    0xc79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xca4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1545 <main+0x345>
jmp    154a <main+0x34a>
jmp    154f <main+0x34f>
jmp    1212 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd38,%rsp
lea    0xddd(%rip),%r15
mov    0x2db9(%rip),%r12
lea    0x30(%rsp),%rbp
lea    0xdc8(%rip),%r13
lea    0x28(%rsp),%rbx
jmp    126a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x130(%rsp),%rdi
lea    0x130(%rsp),%rsi
call   10e0 <execvp@plt>
lea    0x30(%rsp),%rbp
lea    0xd8f(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%r12),%edx
mov    %rbp,%rdi
mov    $0x100,%esi
call   1090 <fgets@plt>
mov    %rbp,%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     12a1 <main+0x91>
movb   $0x0,(%rax)
mov    %rbp,%rdi
call   1100 <strdup@plt>
mov    %rax,0x28(%rsp)
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10b0 <assert@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   10c0 <strsep@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     12ec <main+0xdc>
xchg   %ax,%ax
mov    %rax,0x130(%rsp,%rbp,8)
add    $0x1,%rbp
mov    %rbx,%rdi
mov    %r13,%rsi
call   10c0 <strsep@plt>
test   %rax,%rax
jne    12d0 <main+0xc0>
mov    %ebp,%eax
movq   $0x0,0x130(%rsp,%rax,8)
mov    0x130(%rsp),%rdi
lea    0xd0a(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     14b6 <main+0x2a6>
mov    0x130(%rsp),%rdi
lea    0xcf2(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1440 <main+0x230>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
mov    0x8(%rsp),%ebp
xor    %eax,%eax
call   1130 <fork@plt>
test   %rax,%rax
js     14bd <main+0x2ad>
je     1250 <main+0x40>
lea    0x930(%rsp),%rdi
call   1120 <wait@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1070 <gettimeofday@plt>
mov    0x8(%rsp),%r14d
sub    %ebp,%r14d
mov    0x2c56(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   10d0 <getrusage@plt>
lea    0xe07(%rip),%rdi
call   1030 <puts@plt>
lea    0xc9f(%rip),%rdi
mov    %r14d,%esi
mov    0x2c3d(%rip),%r12
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xcbf(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xcd6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xcef(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xd0a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xd3a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xd4c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdb7(%rip),%rdi
call   1030 <puts@plt>
lea    0x30(%rsp),%rbp
jmp    126a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x930(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
call   1080 <getcwd@plt>
test   %rax,%rax
je     146b <main+0x25b>
lea    0xbba(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x138(%rsp),%rdi
test   %rdi,%rdi
lea    0x30(%rsp),%rbp
je     1482 <main+0x272>
call   1040 <chdir@plt>
lea    0x930(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1080 <getcwd@plt>
test   %rax,%rax
je     126a <main+0x5a>
lea    0xb80(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    126a <main+0x5a>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x2b0c(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xb63(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.rusage = type { i32, i32, i32, i32, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32 }
%struct.TYPE_3__ = type { i32 }
%struct.timeval = type { i32 }
@.str = [5 x i8] c"\0A%s \00"
@.str.1 = [14 x i8] c"LOG710H2015%>\00"
@stdin = global i32 0
@.str.2 = [2 x i8] c" \00"
@.str.3 = [5 x i8] c"exit\00"
@.str.4 = [3 x i8] c"cd\00"
@.str.5 = [12 x i8] c"Ancien: %s\0A\00"
@.str.6 = [14 x i8] c"Pr\C3\A9sent: %s\0A\00"
@.str.7 = [11 x i8] c"Erreur %s\0A\00"
@errno = global i32 0
@RUSAGE_CHILDREN = global i32 0
@.str.8 = [65 x i8] c"\0A*************************STATISTIQUES*************************\0A\00"
@.str.9 = [60 x i8] c"* Temps \C3\A9coul\C3\A9 pour ex\C3\A9cution (wall-clock time): %ld ms\0A\00"
@.str.10 = [41 x i8] c"* Temps CPU utilis\C3\A9 (user mode): %d ms\0A\00"
@.str.11 = [43 x i8] c"* Temps CPU utilis\C3\A9 (kernel mode): %d ms\0A\00"
@.str.12 = [45 x i8] c"* Nombre d'interruptions involontaires: %ld\0A\00"
@.str.13 = [66 x i8] c"* Nombre de fois que le CPU a \C3\A9t\C3\A9 lib\C3\A9r\C3\A9 volontairement: %ld\0A\00"
@.str.14 = [36 x i8] c"* Nombre de d\C3\A9fauts de pages: %ld\0A\00"
@.str.15 = [57 x i8] c"* Nombre de d\C3\A9fauts de pages satisfaits par cache: %ld\0A\00"
@.str.16 = [64 x i8] c"**************************************************************\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i64
%4 = alloca %struct.rusage
%5 = alloca %struct.timeval
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [256 x i8*]
%13 = alloca i32
%14 = alloca i64
%15 = alloca [1024 x i8]
%16 = alloca i32
store i32 0, i32* %1
br label %17
17: ; preds = %0, %137
store i32 0, i32* %13
store i64 0, i64* %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%20 = load i32, i32* @stdin
%21 = call i32 @fgets(i8* %19, i32 256, i32 %20)
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%23 = call i8* @strchr(i8* %22, i8 signext 10)
store i8* %23, i8** %8
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %27
25: ; preds = %17
%26 = load i8*, i8** %8
store i8 0, i8* %26
br label %27
27: ; preds = %25, %17
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%29 = call i8* @strdup(i8* %28)
store i8* %29, i8** %10
store i8* %29, i8** %11
%30 = load i8*, i8** %10
%31 = icmp ne i8* %30, null
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
br label %34
34: ; preds = %37, %27
%35 = call i8* @strsep(i8** %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %35, i8** %9
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = load i8*, i8** %9
%39 = load i32, i32* %13
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 %40
store i8* %38, i8** %41
%42 = load i32, i32* %13
%43 = add nsw i32 %42, 1
store i32 %43, i32* %13
br label %34
44: ; preds = %34
%45 = load i32, i32* %13
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 %46
store i8* null, i8** %47
%48 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 0
%49 = load i8*, i8** %48
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %44
%53 = call i32 @exit(i32 0)
unreachable
54: ; preds = %44
%55 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 0
%56 = load i8*, i8** %55
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %82
59: ; preds = %54
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%61 = call i32* @getcwd(i8* %60, i32 1024)
%62 = icmp ne i32* %61, null
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %64)
br label %66
66: ; preds = %63, %59
%67 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 1
%68 = load i8*, i8** %67
%69 = icmp ne i8* %68, null
br i1 %69, label %70, label %74
70: ; preds = %66
%71 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 1
%72 = load i8*, i8** %71
%73 = call i32 @chdir(i8* %72)
br label %74
74: ; preds = %70, %66
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%76 = call i32* @getcwd(i8* %75, i32 1024)
%77 = icmp ne i32* %76, null
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %79)
br label %81
81: ; preds = %78, %74
br label %136
82: ; preds = %54
%83 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%84 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%85 = load i32, i32* %84
store i32 %85, i32* %6
%86 = call i64 (...) @fork()
store i64 %86, i64* %3
%87 = icmp slt i64 %86, 0
br i1 %87, label %88, label %93
88: ; preds = %82
%89 = load i32, i32* @errno
%90 = call i8* @strerror(i32 %89)
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %90)
%92 = call i32 @exit(i32 -1)
unreachable
93: ; preds = %82
%94 = load i64, i64* %3
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %101
96: ; preds = %93
%97 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 0
%98 = load i8*, i8** %97
%99 = getelementptr inbounds [256 x i8*], [256 x i8*]* %12, i64 0, i64 0
%100 = call i32 @execvp(i8* %98, i8** %99)
br label %134
101: ; preds = %93
%102 = call i32 @wait(i32* %16)
%103 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%104 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%105 = load i32, i32* %104
store i32 %105, i32* %7
%106 = load i32, i32* @RUSAGE_CHILDREN
%107 = call i32 @getrusage(i32 %106, %struct.rusage* %4)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.8, i64 0, i64 0))
%109 = load i32, i32* %7
%110 = load i32, i32* %6
%111 = sub nsw i32 %109, %110
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 %111)
%113 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 5
%114 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %113, i32 0, i32 0
%115 = load i32, i32* %114
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i32 %115)
%117 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 4
%118 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %117, i32 0, i32 0
%119 = load i32, i32* %118
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 %119)
%121 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 3
%122 = load i32, i32* %121
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i32 %122)
%124 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 2
%125 = load i32, i32* %124
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.13, i64 0, i64 0), i32 %125)
%127 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 1
%128 = load i32, i32* %127
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0), i32 %128)
%130 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 0
%131 = load i32, i32* %130
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.15, i64 0, i64 0), i32 %131)
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.16, i64 0, i64 0))
br label %134
134: ; preds = %101, %96
br label %135
135: ; preds = %134
br label %136
136: ; preds = %135, %81
br label %137
137: ; preds = %136
br label %17
}

LLVM IR (-O2):
%struct.rusage = type { i32, i32, i32, i32, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32 }
%struct.TYPE_3__ = type { i32 }
%struct.timeval = type { i32 }
@.str = [5 x i8] c"\0A%s \00"
@.str.1 = [14 x i8] c"LOG710H2015%>\00"
@stdin = global i32 0
@.str.2 = [2 x i8] c" \00"
@.str.3 = [5 x i8] c"exit\00"
@.str.4 = [3 x i8] c"cd\00"
@.str.5 = [12 x i8] c"Ancien: %s\0A\00"
@.str.6 = [14 x i8] c"Pr\C3\A9sent: %s\0A\00"
@.str.7 = [11 x i8] c"Erreur %s\0A\00"
@errno = global i32 0
@RUSAGE_CHILDREN = global i32 0
@.str.9 = [60 x i8] c"* Temps \C3\A9coul\C3\A9 pour ex\C3\A9cution (wall-clock time): %ld ms\0A\00"
@.str.10 = [41 x i8] c"* Temps CPU utilis\C3\A9 (user mode): %d ms\0A\00"
@.str.11 = [43 x i8] c"* Temps CPU utilis\C3\A9 (kernel mode): %d ms\0A\00"
@.str.12 = [45 x i8] c"* Nombre d'interruptions involontaires: %ld\0A\00"
@.str.13 = [66 x i8] c"* Nombre de fois que le CPU a \C3\A9t\C3\A9 lib\C3\A9r\C3\A9 volontairement: %ld\0A\00"
@.str.14 = [36 x i8] c"* Nombre de d\C3\A9fauts de pages: %ld\0A\00"
@.str.15 = [57 x i8] c"* Nombre de d\C3\A9fauts de pages satisfaits par cache: %ld\0A\00"
@str = [64 x i8] c"\0A*************************STATISTIQUES*************************\00"
@str.17 = [63 x i8] c"**************************************************************\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca %struct.rusage
%3 = alloca %struct.timeval
%4 = alloca i8*
%5 = alloca [256 x i8*]
%6 = alloca [1024 x i8]
%7 = alloca i32
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%9 = bitcast %struct.rusage* %2 to i8*
%10 = bitcast %struct.timeval* %3 to i8*
%11 = bitcast i8** %4 to i8*
%12 = bitcast [256 x i8*]* %5 to i8*
%13 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 0
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%15 = bitcast i32* %7 to i8*
%16 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 5, i32 0
%17 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 4, i32 0
%18 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 3
%19 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 2
%20 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1
%21 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%23 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 1
br label %24
24: ; preds = %111, %0
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @stdin
%27 = call i32 @fgets(i8* %8, i32 256, i32 %26)
%28 = call i8* @strchr(i8* %8, i8 signext 10)
%29 = icmp eq i8* %28, null
br i1 %29, label %31, label %30
30: ; preds = %24
store i8 0, i8* %28
br label %31
31: ; preds = %30, %24
%32 = call i8* @strdup(i8* %8)
store i8* %32, i8** %4
%33 = icmp ne i8* %32, null
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i8* %36, null
br i1 %37, label %45, label %38
38: ; preds = %31, %38
%39 = phi i64 [ %42, %38 ], [ 0, %31 ]
%40 = phi i8* [ %43, %38 ], [ %36, %31 ]
%41 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 %39
store i8* %40, i8** %41
%42 = add nuw i64 %39, 1
%43 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %38
45: ; preds = %38, %31
%46 = phi i64 [ 0, %31 ], [ %42, %38 ]
%47 = and i64 %46, 4294967295
%48 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 %47
store i8* null, i8** %48
%49 = load i8*, i8** %13
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %45
%53 = call i32 @exit(i32 0)
unreachable
54: ; preds = %45
%55 = load i8*, i8** %13
%56 = call i64 @strcmp(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %74
58: ; preds = %54
%59 = call i32* @getcwd(i8* %22, i32 1024)
%60 = icmp eq i32* %59, null
br i1 %60, label %63, label %61
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %22)
br label %63
63: ; preds = %61, %58
%64 = load i8*, i8** %23
%65 = icmp eq i8* %64, null
br i1 %65, label %68, label %66
66: ; preds = %63
%67 = call i32 @chdir(i8* %64)
br label %68
68: ; preds = %66, %63
%69 = call i32* @getcwd(i8* %22, i32 1024)
%70 = icmp eq i32* %69, null
br i1 %70, label %73, label %71
71: ; preds = %68
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %22)
br label %73
73: ; preds = %71, %68
br label %111
74: ; preds = %54
%75 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%76 = load i32, i32* %14
%77 = call i64 (...) @fork()
%78 = icmp slt i64 %77, 0
br i1 %78, label %79, label %84
79: ; preds = %74
%80 = load i32, i32* @errno
%81 = call i8* @strerror(i32 %80)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %81)
%83 = call i32 @exit(i32 -1)
unreachable
84: ; preds = %74
%85 = icmp eq i64 %77, 0
br i1 %85, label %86, label %89
86: ; preds = %84
%87 = load i8*, i8** %13
%88 = call i32 @execvp(i8* %87, i8** %13)
br label %111
89: ; preds = %84
%90 = call i32 @wait(i32* %7)
%91 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%92 = load i32, i32* %14
%93 = load i32, i32* @RUSAGE_CHILDREN
%94 = call i32 @getrusage(i32 %93, %struct.rusage* %2)
%95 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%96 = sub nsw i32 %92, %76
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 %96)
%98 = load i32, i32* %16
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i32 %98)
%100 = load i32, i32* %17
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 %100)
%102 = load i32, i32* %18
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.12, i64 0, i64 0), i32 %102)
%104 = load i32, i32* %19
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.13, i64 0, i64 0), i32 %104)
%106 = load i32, i32* %20
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0), i32 %106)
%108 = load i32, i32* %21
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.15, i64 0, i64 0), i32 %108)
%110 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.17, i64 0, i64 0))
br label %111
111: ; preds = %73, %86, %89
br label %24
}