#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 int pid_t;
typedef int /*<<< orphan*/ line;
typedef int /*<<< orphan*/ cwd;

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_CHILDREN;
int /*<<< orphan*/ WNOHANG;
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*/);
int fork();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *getcwd(char *, int);
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
char *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
char *strerror(int /*<<< orphan*/);
scalar_t__ strlen(char *);
char *strsep(char **, char *);
int /*<<< orphan*/ wait(int *);
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
int main() {
  char line[256];
  pid_t pid;
  struct rusage ru;
  struct timeval wallclock;
  time_t begin, end;
  int background = 0;
  int pids[256];
  char *cmds[256];
  int bgp = 0;
  int lastbgp = 0;
  while (1) {
    char *pos;
    char *token, *string, *tofree;
    char *arg[256];
    int n = 0;
    long sarray_len = 0;
    if (bgp != 0) {
      int i;
      for (i = 0; i < lastbgp; i++) {
        if (pids[i] != 0) {
          int status;
          if (waitpid(pids[i], &status, WNOHANG) > 0) {
            pids[i] = 0;
            free(cmds[i]);
            --bgp;
          }
        }
      }
    } else {
      lastbgp = 0;
    }
    printf("\n%s ", "LOG710H2015%>");
    fgets(line, sizeof(line), stdin);
    background = 0;
    if ((pos = strchr(line, '\n')) != NULL)
      *pos = '\0';
    tofree = string = strdup(line);
    assert(string != NULL);
    while ((token = strsep(&string, " ")) != NULL) {
      if (strcmp(token, "&") == 0) {
        background = 1;
        arg[n] = NULL;
      } else {
        arg[n] = token;
      }
      ++n;
    }
    arg[n] = NULL;
    if (strcmp(arg[0], "exit") == 0) {
      if (bgp == 0) {
        exit(0);
      } else {
        printf("%s\n", "Il y a des tâches en background.");
      }
    } 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 if (strcmp(arg[0], "aptaches") == 0) {
      if (bgp != 0) {
        int i;
        for (i = 0; i < lastbgp; i++) {
          if (pids[i] != 0) {
            printf("[%d] %d %s\n", i + 1, pids[i], cmds[i]);
          }
        }
      }
    } 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;
        if (background == 0) {
          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");
        } else {
          if (pids[bgp] == 0) {
            pids[bgp] = pid;
            cmds[bgp] = malloc(strlen(arg[0]) + 1);
            strcpy(cmds[bgp], arg[0]);
            printf("[%d] %s\n", lastbgp + 1, cmds[bgp]);
            bgp++;
            lastbgp++;
          }
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x19b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x144(%rbp)
movl   $0x0,-0xd54(%rbp)
movl   $0x0,-0xd58(%rbp)
movl   $0x0,-0x1584(%rbp)
movq   $0x0,-0x1590(%rbp)
cmpl   $0x0,-0xd54(%rbp)
je     1358 <main+0x108>
movl   $0x0,-0x1594(%rbp)
mov    -0x1594(%rbp),%eax
cmp    -0xd58(%rbp),%eax
jge    1353 <main+0x103>
movslq -0x1594(%rbp),%rax
cmpl   $0x0,-0x550(%rbp,%rax,4)
je     133a <main+0xea>
movslq -0x1594(%rbp),%rax
mov    -0x550(%rbp,%rax,4),%edi
mov    0x2cf8(%rip),%rax
mov    (%rax),%edx
lea    -0x1598(%rbp),%rsi
call   1100 <waitpid@plt>
cmp    $0x0,%rax
jle    1335 <main+0xe5>
movslq -0x1594(%rbp),%rax
movl   $0x0,-0x550(%rbp,%rax,4)
movslq -0x1594(%rbp),%rax
mov    -0xd50(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0xd54(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xd54(%rbp)
jmp    133a <main+0xea>
jmp    133f <main+0xef>
mov    -0x1594(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1594(%rbp)
jmp    12ac <main+0x5c>
jmp    1362 <main+0x112>
movl   $0x0,-0xd58(%rbp)
lea    0xc97(%rip),%rdi
lea    0xc95(%rip),%rsi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2c63(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   10b0 <fgets@plt>
movl   $0x0,-0x144(%rbp)
lea    -0x110(%rbp),%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
mov    %rax,-0xd60(%rbp)
cmp    $0x0,%rax
je     13c7 <main+0x177>
mov    -0xd60(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x110(%rbp),%rdi
call   1140 <strdup@plt>
mov    %rax,-0xd70(%rbp)
mov    %rax,-0xd78(%rbp)
cmpq   $0x0,-0xd70(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10d0 <assert@plt>
lea    -0xd70(%rbp),%rdi
lea    0xbff(%rip),%rsi
call   10f0 <strsep@plt>
mov    %rax,-0xd68(%rbp)
cmp    $0x0,%rax
je     1483 <main+0x233>
mov    -0xd68(%rbp),%rdi
lea    0xbeb(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1459 <main+0x209>
movl   $0x1,-0x144(%rbp)
movslq -0x1584(%rbp),%rax
movq   $0x0,-0x1580(%rbp,%rax,8)
jmp    146f <main+0x21f>
mov    -0xd68(%rbp),%rcx
movslq -0x1584(%rbp),%rax
mov    %rcx,-0x1580(%rbp,%rax,8)
ff
mov    -0x1584(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1584(%rbp)
jmp    13f6 <main+0x1a6>
movslq -0x1584(%rbp),%rax
movq   $0x0,-0x1580(%rbp,%rax,8)
mov    -0x1580(%rbp),%rdi
lea    0xb71(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    14e1 <main+0x291>
cmpl   $0x0,-0xd54(%rbp)
jne    14c7 <main+0x277>
xor    %edi,%edi
call   1130 <exit@plt>
lea    0xb79(%rip),%rdi
lea    0xb45(%rip),%rsi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    187c <main+0x62c>
mov    -0x1580(%rbp),%rdi
lea    0xb4d(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    157d <main+0x32d>
lea    -0x19a0(%rbp),%rdi
mov    $0x400,%esi
call   10a0 <getcwd@plt>
cmp    $0x0,%rax
je     152e <main+0x2de>
lea    -0x19a0(%rbp),%rsi
lea    0xb18(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
cmpq   $0x0,-0x1578(%rbp)
je     1548 <main+0x2f8>
mov    -0x1578(%rbp),%rdi
call   1060 <chdir@plt>
lea    -0x19a0(%rbp),%rdi
mov    $0x400,%esi
call   10a0 <getcwd@plt>
cmp    $0x0,%rax
je     1578 <main+0x328>
lea    -0x19a0(%rbp),%rsi
lea    0xada(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1877 <main+0x627>
mov    -0x1580(%rbp),%rdi
lea    0xace(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    162f <main+0x3df>
cmpl   $0x0,-0xd54(%rbp)
je     162a <main+0x3da>
movl   $0x0,-0x19a4(%rbp)
mov    -0x19a4(%rbp),%eax
cmp    -0xd58(%rbp),%eax
jge    1625 <main+0x3d5>
movslq -0x19a4(%rbp),%rax
cmpl   $0x0,-0x550(%rbp,%rax,4)
je     160c <main+0x3bc>
mov    -0x19a4(%rbp),%esi
add    $0x1,%esi
movslq -0x19a4(%rbp),%rax
mov    -0x550(%rbp,%rax,4),%edx
movslq -0x19a4(%rbp),%rax
mov    -0xd50(%rbp,%rax,8),%rcx
ff
lea    0xa5d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1611 <main+0x3c1>
mov    -0x19a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x19a4(%rbp)
jmp    15b1 <main+0x361>
jmp    162a <main+0x3da>
jmp    1872 <main+0x622>
lea    -0x138(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <gettimeofday@plt>
mov    -0x138(%rbp),%eax
mov    %eax,-0x13c(%rbp)
mov    $0x0,%al
call   1170 <fork@plt>
mov    %eax,-0x114(%rbp)
cmp    $0x0,%eax
jge    168a <main+0x43a>
mov    0x2960(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    %rax,%rsi
lea    0x9f5(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   1130 <exit@plt>
cmpl   $0x0,-0x114(%rbp)
jne    16af <main+0x45f>
mov    -0x1580(%rbp),%rdi
lea    -0x1580(%rbp),%rsi
call   1120 <execvp@plt>
jmp    1868 <main+0x618>
cmpl   $0x0,-0x144(%rbp)
jne    17ac <main+0x55c>
lea    -0x19a8(%rbp),%rdi
call   1160 <wait@plt>
lea    -0x138(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <gettimeofday@plt>
mov    -0x138(%rbp),%eax
mov    %eax,-0x140(%rbp)
mov    0x28e5(%rip),%rax
mov    (%rax),%edi
lea    -0x130(%rbp),%rsi
call   1110 <getrusage@plt>
lea    0x979(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x140(%rbp),%esi
sub    -0x13c(%rbp),%esi
lea    0x9a0(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x11c(%rbp),%esi
lea    0x9c8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x120(%rbp),%esi
lea    0x9dd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x124(%rbp),%esi
lea    0x9f4(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x128(%rbp),%esi
lea    0xa0d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x12c(%rbp),%esi
lea    0xa3b(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x130(%rbp),%esi
lea    0xa4b(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    0xa76(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    1863 <main+0x613>
movslq -0xd54(%rbp),%rax
cmpl   $0x0,-0x550(%rbp,%rax,4)
jne    185e <main+0x60e>
mov    -0x114(%rbp),%ecx
movslq -0xd54(%rbp),%rax
mov    %ecx,-0x550(%rbp,%rax,4)
mov    -0x1580(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10e0 <malloc@plt>
mov    %rax,%rcx
movslq -0xd54(%rbp),%rax
mov    %rcx,-0xd50(%rbp,%rax,8)
ff
movslq -0xd54(%rbp),%rax
mov    -0xd50(%rbp,%rax,8),%rdi
ff
mov    -0x1580(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0xd58(%rbp),%esi
add    $0x1,%esi
movslq -0xd54(%rbp),%rax
mov    -0xd50(%rbp,%rax,8),%rdx
ff
lea    0xa1d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0xd54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd54(%rbp)
mov    -0xd58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd58(%rbp)
jmp    1863 <main+0x613>
jmp    1868 <main+0x618>
jmp    186d <main+0x61d>
jmp    1872 <main+0x622>
jmp    1877 <main+0x627>
jmp    187c <main+0x62c>
jmp    1280 <main+0x30>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1938,%rsp
lea    0xd8b(%rip),%r13
lea    0x28(%rsp),%r14
lea    0xd8f(%rip),%rbp
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
xor    %r15d,%r15d
jmp    12b0 <main+0x50>
mov    0x430(%rsp),%rdi
lea    0x430(%rsp),%rsi
call   1130 <execvp@plt>
mov    (%rsp),%r15d
xchg   %ax,%ax
movl   $0x0,0x4(%rsp)
mov    $0x0,%eax
test   %r15d,%r15d
je     135b <main+0xfb>
test   %r12d,%r12d
jle    1350 <main+0xf0>
mov    %r12d,%ebx
xor    %ebp,%ebp
jmp    12e9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1330 <main+0xd0>
mov    0x30(%rsp,%rbp,4),%edi
test   %edi,%edi
je     12e0 <main+0x80>
mov    0x2ce8(%rip),%rax
mov    (%rax),%edx
lea    0xd30(%rsp),%rsi
call   1110 <waitpid@plt>
test   %rax,%rax
jle    12e0 <main+0x80>
movl   $0x0,0x30(%rsp,%rbp,4)
mov    0x1130(%rsp,%rbp,8),%rdi
call   1030 <free@plt>
add    $0xffffffff,%r15d
jmp    12e0 <main+0x80>
nopw   0x0(%rax,%rax,1)
mov    %r12d,%eax
mov    %r12d,0x4(%rsp)
mov    %r15d,%eax
lea    0xcd1(%rip),%rbp
jmp    135b <main+0xfb>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12d,%eax
mov    %r12d,0x4(%rsp)
mov    %r15d,%eax
mov    %eax,(%rsp)
lea    0xc9b(%rip),%rdi
lea    0xc99(%rip),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edx
lea    0xc30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10c0 <fgets@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     13a6 <main+0x146>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1150 <strdup@plt>
mov    %rax,0x28(%rsp)
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10e0 <assert@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1100 <strsep@plt>
test   %rax,%rax
je     1420 <main+0x1c0>
mov    %rax,%r12
xor    %ebx,%ebx
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
cmove  %rax,%r12
mov    $0x1,%eax
cmove  %eax,%r15d
mov    %r12,0x430(%rsp,%rbx,8)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %r13,%rsi
call   1100 <strsep@plt>
mov    %rax,%r12
test   %rax,%rax
jne    13e0 <main+0x180>
jmp    1425 <main+0x1c5>
nopl   0x0(%rax)
xor    %ebx,%ebx
xor    %r15d,%r15d
mov    0x4(%rsp),%r12d
mov    %ebx,%eax
movq   $0x0,0x430(%rsp,%rax,8)
mov    0x430(%rsp),%rdi
lea    0xbce(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1530 <main+0x2d0>
mov    0x430(%rsp),%rdi
lea    0xbd8(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     1550 <main+0x2f0>
mov    0x430(%rsp),%rdi
lea    0xbd8(%rip),%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     15b9 <main+0x359>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   10a0 <gettimeofday@plt>
mov    0x8(%rsp),%ebx
xor    %eax,%eax
call   1180 <fork@plt>
test   %eax,%eax
js     16fb <main+0x49b>
je     1295 <main+0x35>
test   %r15d,%r15d
je     161b <main+0x3bb>
movslq (%rsp),%rbx
cmpl   $0x0,0x30(%rsp,%rbx,4)
jne    16e4 <main+0x484>
mov    %eax,0x30(%rsp,%rbx,4)
mov    0x430(%rsp),%r15
mov    %r15,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdi
call   10f0 <malloc@plt>
mov    %rax,%r12
mov    %rax,0x1130(%rsp,%rbx,8)
mov    %rax,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    0x4(%rsp),%esi
add    $0x1,%esi
lea    0xcc8(%rip),%rdi
mov    %esi,0x4(%rsp)
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%ebx
mov    %ebx,%r15d
jmp    16e8 <main+0x488>
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%r15d
test   %r15d,%r15d
je     16f4 <main+0x494>
lea    0xad6(%rip),%rdi
call   1050 <puts@plt>
jmp    12b0 <main+0x50>
xchg   %ax,%ax
lea    0xd30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   10b0 <getcwd@plt>
test   %rax,%rax
je     157b <main+0x31b>
lea    0xace(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x438(%rsp),%rdi
test   %rdi,%rdi
je     158d <main+0x32d>
call   1070 <chdir@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   10b0 <getcwd@plt>
test   %rax,%rax
je     15b0 <main+0x350>
lea    0xaa5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    (%rsp),%r15d
jmp    12b0 <main+0x50>
mov    (%rsp),%r15d
test   %r15d,%r15d
je     1290 <main+0x30>
cmpl   $0x0,0x4(%rsp)
jle    12b0 <main+0x50>
xor    %esi,%esi
lea    0xa88(%rip),%rbp
jmp    15e8 <main+0x388>
nopl   0x0(%rax)
mov    %rbx,%rsi
cmp    %rbx,%r12
je     160b <main+0x3ab>
mov    0x30(%rsp,%rsi,4),%edx
lea    0x1(%rsi),%rbx
test   %edx,%edx
je     15e0 <main+0x380>
mov    0x1130(%rsp,%rsi,8),%rcx
add    $0x1,%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    15e0 <main+0x380>
mov    (%rsp),%r15d
lea    0x9fd(%rip),%rbp
jmp    12b0 <main+0x50>
lea    0xd30(%rsp),%rdi
call   1170 <wait@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   10a0 <gettimeofday@plt>
mov    0x8(%rsp),%r12d
sub    %ebx,%r12d
mov    0x298d(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   1120 <getrusage@plt>
lea    0xb88(%rip),%rdi
call   1050 <puts@plt>
lea    0xa17(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x24(%rsp),%esi
lea    0xa3e(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x20(%rsp),%esi
lea    0xa55(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x1c(%rsp),%esi
lea    0xa6e(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x18(%rsp),%esi
lea    0xa89(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x14(%rsp),%esi
lea    0xab9(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xacb(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xb3f(%rip),%rdi
call   1050 <puts@plt>
mov    (%rsp),%r15d
mov    0x4(%rsp),%eax
mov    %eax,%r12d
jmp    12b0 <main+0x50>
xor    %edi,%edi
call   1140 <exit@plt>
mov    0x28c6(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
lea    0x95e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0xffffffff,%edi
call   1140 <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 }
@WNOHANG = global i32 0
@.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 = [2 x i8] c"&\00"
@.str.4 = [5 x i8] c"exit\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [34 x i8] c"Il y a des t\C3\A2ches en background.\00"
@.str.7 = [3 x i8] c"cd\00"
@.str.8 = [12 x i8] c"Ancien: %s\0A\00"
@.str.9 = [14 x i8] c"Pr\C3\A9sent: %s\0A\00"
@.str.10 = [9 x i8] c"aptaches\00"
@.str.11 = [12 x i8] c"[%d] %d %s\0A\00"
@.str.12 = [11 x i8] c"Erreur %s\0A\00"
@errno = global i32 0
@RUSAGE_CHILDREN = global i32 0
@.str.13 = [65 x i8] c"\0A*************************STATISTIQUES*************************\0A\00"
@.str.14 = [60 x i8] c"* Temps \C3\A9coul\C3\A9 pour ex\C3\A9cution (wall-clock time): %ld ms\0A\00"
@.str.15 = [41 x i8] c"* Temps CPU utilis\C3\A9 (user mode): %d ms\0A\00"
@.str.16 = [43 x i8] c"* Temps CPU utilis\C3\A9 (kernel mode): %d ms\0A\00"
@.str.17 = [45 x i8] c"* Nombre d'interruptions involontaires: %ld\0A\00"
@.str.18 = [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.19 = [36 x i8] c"* Nombre de d\C3\A9fauts de pages: %ld\0A\00"
@.str.20 = [57 x i8] c"* Nombre de d\C3\A9fauts de pages satisfaits par cache: %ld\0A\00"
@.str.21 = [64 x i8] c"**************************************************************\0A\00"
@.str.22 = [9 x i8] c"[%d] %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
%4 = alloca %struct.rusage
%5 = alloca %struct.timeval
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [256 x i32]
%10 = alloca [256 x i8*]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca [256 x i8*]
%18 = alloca i32
%19 = alloca i64
%20 = alloca i32
%21 = alloca i32
%22 = alloca [1024 x i8]
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %8
store i32 0, i32* %11
store i32 0, i32* %12
br label %25
25: ; preds = %0, %280
store i32 0, i32* %18
store i64 0, i64* %19
%26 = load i32, i32* %11
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %64
28: ; preds = %25
store i32 0, i32* %20
br label %29
29: ; preds = %60, %28
%30 = load i32, i32* %20
%31 = load i32, i32* %12
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %63
33: ; preds = %29
%34 = load i32, i32* %20
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %59
39: ; preds = %33
%40 = load i32, i32* %20
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* @WNOHANG
%45 = call i64 @waitpid(i32 %43, i32* %21, i32 %44)
%46 = icmp sgt i64 %45, 0
br i1 %46, label %47, label %58
47: ; preds = %39
%48 = load i32, i32* %20
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %49
store i32 0, i32* %50
%51 = load i32, i32* %20
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [256 x i8*], [256 x i8*]* %10, i64 0, i64 %52
%54 = load i8*, i8** %53
%55 = call i32 @free(i8* %54)
%56 = load i32, i32* %11
%57 = add nsw i32 %56, -1
store i32 %57, i32* %11
br label %58
58: ; preds = %47, %39
br label %59
59: ; preds = %58, %33
br label %60
60: ; preds = %59
%61 = load i32, i32* %20
%62 = add nsw i32 %61, 1
store i32 %62, i32* %20
br label %29
63: ; preds = %29
br label %65
64: ; preds = %25
store i32 0, i32* %12
br label %65
65: ; preds = %64, %63
%66 = 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))
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%68 = load i32, i32* @stdin
%69 = call i32 @fgets(i8* %67, i32 256, i32 %68)
store i32 0, i32* %8
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%71 = call i8* @strchr(i8* %70, i8 signext 10)
store i8* %71, i8** %13
%72 = icmp ne i8* %71, null
br i1 %72, label %73, label %75
73: ; preds = %65
%74 = load i8*, i8** %13
store i8 0, i8* %74
br label %75
75: ; preds = %73, %65
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%77 = call i8* @strdup(i8* %76)
store i8* %77, i8** %15
store i8* %77, i8** %16
%78 = load i8*, i8** %15
%79 = icmp ne i8* %78, null
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
br label %82
82: ; preds = %98, %75
%83 = call i8* @strsep(i8** %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %83, i8** %14
%84 = icmp ne i8* %83, null
br i1 %84, label %85, label %101
85: ; preds = %82
%86 = load i8*, i8** %14
%87 = call i64 @strcmp(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %85
store i32 1, i32* %8
%90 = load i32, i32* %18
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 %91
store i8* null, i8** %92
br label %98
93: ; preds = %85
%94 = load i8*, i8** %14
%95 = load i32, i32* %18
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 %96
store i8* %94, i8** %97
br label %98
98: ; preds = %93, %89
%99 = load i32, i32* %18
%100 = add nsw i32 %99, 1
store i32 %100, i32* %18
br label %82
101: ; preds = %82
%102 = load i32, i32* %18
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 %103
store i8* null, i8** %104
%105 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%106 = load i8*, i8** %105
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%108 = icmp eq i64 %107, 0
br i1 %108, label %109, label %117
109: ; preds = %101
%110 = load i32, i32* %11
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %114
112: ; preds = %109
%113 = call i32 @exit(i32 0)
unreachable
114: ; preds = %109
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %116
116: ; preds = %114
br label %280
117: ; preds = %101
%118 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%119 = load i8*, i8** %118
%120 = call i64 @strcmp(i8* %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %145
122: ; preds = %117
%123 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%124 = call i32* @getcwd(i8* %123, i32 1024)
%125 = icmp ne i32* %124, null
br i1 %125, label %126, label %129
126: ; preds = %122
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %127)
br label %129
129: ; preds = %126, %122
%130 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 1
%131 = load i8*, i8** %130
%132 = icmp ne i8* %131, null
br i1 %132, label %133, label %137
133: ; preds = %129
%134 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 1
%135 = load i8*, i8** %134
%136 = call i32 @chdir(i8* %135)
br label %137
137: ; preds = %133, %129
%138 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%139 = call i32* @getcwd(i8* %138, i32 1024)
%140 = icmp ne i32* %139, null
br i1 %140, label %141, label %144
141: ; preds = %137
%142 = getelementptr inbounds [1024 x i8], [1024 x i8]* %22, i64 0, i64 0
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %142)
br label %144
144: ; preds = %141, %137
br label %279
145: ; preds = %117
%146 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%147 = load i8*, i8** %146
%148 = call i64 @strcmp(i8* %147, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%149 = icmp eq i64 %148, 0
br i1 %149, label %150, label %182
150: ; preds = %145
%151 = load i32, i32* %11
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %181
153: ; preds = %150
store i32 0, i32* %23
br label %154
154: ; preds = %177, %153
%155 = load i32, i32* %23
%156 = load i32, i32* %12
%157 = icmp slt i32 %155, %156
br i1 %157, label %158, label %180
158: ; preds = %154
%159 = load i32, i32* %23
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %160
%162 = load i32, i32* %161
%163 = icmp ne i32 %162, 0
br i1 %163, label %164, label %176
164: ; preds = %158
%165 = load i32, i32* %23
%166 = add nsw i32 %165, 1
%167 = load i32, i32* %23
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %168
%170 = load i32, i32* %169
%171 = load i32, i32* %23
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [256 x i8*], [256 x i8*]* %10, i64 0, i64 %172
%174 = load i8*, i8** %173
%175 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %166, i32 %170, i8* %174)
br label %176
176: ; preds = %164, %158
br label %177
177: ; preds = %176
%178 = load i32, i32* %23
%179 = add nsw i32 %178, 1
store i32 %179, i32* %23
br label %154
180: ; preds = %154
br label %181
181: ; preds = %180, %150
br label %278
182: ; preds = %145
%183 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%184 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%185 = load i32, i32* %184
store i32 %185, i32* %6
%186 = call i32 (...) @fork()
store i32 %186, i32* %3
%187 = icmp slt i32 %186, 0
br i1 %187, label %188, label %193
188: ; preds = %182
%189 = load i32, i32* @errno
%190 = call i8* @strerror(i32 %189)
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %190)
%192 = call i32 @exit(i32 -1)
unreachable
193: ; preds = %182
%194 = load i32, i32* %3
%195 = icmp eq i32 %194, 0
br i1 %195, label %196, label %201
196: ; preds = %193
%197 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%198 = load i8*, i8** %197
%199 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%200 = call i32 @execvp(i8* %198, i8** %199)
br label %276
201: ; preds = %193
%202 = load i32, i32* %8
%203 = icmp eq i32 %202, 0
br i1 %203, label %204, label %237
204: ; preds = %201
%205 = call i32 @wait(i32* %24)
%206 = call i32 @gettimeofday(%struct.timeval* %5, i32* null)
%207 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%208 = load i32, i32* %207
store i32 %208, i32* %7
%209 = load i32, i32* @RUSAGE_CHILDREN
%210 = call i32 @getrusage(i32 %209, %struct.rusage* %4)
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.13, i64 0, i64 0))
%212 = load i32, i32* %7
%213 = load i32, i32* %6
%214 = sub nsw i32 %212, %213
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.14, i64 0, i64 0), i32 %214)
%216 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 5
%217 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %216, i32 0, i32 0
%218 = load i32, i32* %217
%219 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0), i32 %218)
%220 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 4
%221 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %220, i32 0, i32 0
%222 = load i32, i32* %221
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.16, i64 0, i64 0), i32 %222)
%224 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 3
%225 = load i32, i32* %224
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.17, i64 0, i64 0), i32 %225)
%227 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 2
%228 = load i32, i32* %227
%229 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.18, i64 0, i64 0), i32 %228)
%230 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 1
%231 = load i32, i32* %230
%232 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.19, i64 0, i64 0), i32 %231)
%233 = getelementptr inbounds %struct.rusage, %struct.rusage* %4, i32 0, i32 0
%234 = load i32, i32* %233
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.20, i64 0, i64 0), i32 %234)
%236 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.21, i64 0, i64 0))
br label %275
237: ; preds = %201
%238 = load i32, i32* %11
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %239
%241 = load i32, i32* %240
%242 = icmp eq i32 %241, 0
br i1 %242, label %243, label %274
243: ; preds = %237
%244 = load i32, i32* %3
%245 = load i32, i32* %11
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds [256 x i32], [256 x i32]* %9, i64 0, i64 %246
store i32 %244, i32* %247
%248 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%249 = load i8*, i8** %248
%250 = call i64 @strlen(i8* %249)
%251 = add nsw i64 %250, 1
%252 = call i8* @malloc(i64 %251)
%253 = load i32, i32* %11
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds [256 x i8*], [256 x i8*]* %10, i64 0, i64 %254
store i8* %252, i8** %255
%256 = load i32, i32* %11
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds [256 x i8*], [256 x i8*]* %10, i64 0, i64 %257
%259 = load i8*, i8** %258
%260 = getelementptr inbounds [256 x i8*], [256 x i8*]* %17, i64 0, i64 0
%261 = load i8*, i8** %260
%262 = call i32 @strcpy(i8* %259, i8* %261)
%263 = load i32, i32* %12
%264 = add nsw i32 %263, 1
%265 = load i32, i32* %11
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds [256 x i8*], [256 x i8*]* %10, i64 0, i64 %266
%268 = load i8*, i8** %267
%269 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i64 0, i64 0), i32 %264, i8* %268)
%270 = load i32, i32* %11
%271 = add nsw i32 %270, 1
store i32 %271, i32* %11
%272 = load i32, i32* %12
%273 = add nsw i32 %272, 1
store i32 %273, i32* %12
br label %274
274: ; preds = %243, %237
br label %275
275: ; preds = %274, %204
br label %276
276: ; preds = %275, %196
br label %277
277: ; preds = %276
br label %278
278: ; preds = %277, %181
br label %279
279: ; preds = %278, %144
br label %280
280: ; preds = %279, %116
br label %25
}

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 }
@WNOHANG = global i32 0
@.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 = [2 x i8] c"&\00"
@.str.4 = [5 x i8] c"exit\00"
@.str.6 = [34 x i8] c"Il y a des t\C3\A2ches en background.\00"
@.str.7 = [3 x i8] c"cd\00"
@.str.8 = [12 x i8] c"Ancien: %s\0A\00"
@.str.9 = [14 x i8] c"Pr\C3\A9sent: %s\0A\00"
@.str.10 = [9 x i8] c"aptaches\00"
@.str.11 = [12 x i8] c"[%d] %d %s\0A\00"
@.str.12 = [11 x i8] c"Erreur %s\0A\00"
@errno = global i32 0
@RUSAGE_CHILDREN = global i32 0
@.str.14 = [60 x i8] c"* Temps \C3\A9coul\C3\A9 pour ex\C3\A9cution (wall-clock time): %ld ms\0A\00"
@.str.15 = [41 x i8] c"* Temps CPU utilis\C3\A9 (user mode): %d ms\0A\00"
@.str.16 = [43 x i8] c"* Temps CPU utilis\C3\A9 (kernel mode): %d ms\0A\00"
@.str.17 = [45 x i8] c"* Nombre d'interruptions involontaires: %ld\0A\00"
@.str.18 = [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.19 = [36 x i8] c"* Nombre de d\C3\A9fauts de pages: %ld\0A\00"
@.str.20 = [57 x i8] c"* Nombre de d\C3\A9fauts de pages satisfaits par cache: %ld\0A\00"
@.str.22 = [9 x i8] c"[%d] %s\0A\00"
@str = [64 x i8] c"\0A*************************STATISTIQUES*************************\00"
@str.23 = [63 x i8] c"**************************************************************\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca %struct.rusage
%3 = alloca %struct.timeval
%4 = alloca [256 x i32]
%5 = alloca [256 x i8*]
%6 = alloca i8*
%7 = alloca [256 x i8*]
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%12 = bitcast %struct.rusage* %2 to i8*
%13 = bitcast %struct.timeval* %3 to i8*
%14 = bitcast [256 x i32]* %4 to i8*
%15 = bitcast [256 x i8*]* %5 to i8*
%16 = bitcast i8** %6 to i8*
%17 = bitcast [256 x i8*]* %7 to i8*
%18 = bitcast i32* %8 to i8*
%19 = getelementptr inbounds [256 x i8*], [256 x i8*]* %7, i64 0, i64 0
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%21 = bitcast i32* %10 to i8*
%22 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 5, i32 0
%23 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 4, i32 0
%24 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 3
%25 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 2
%26 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1
%27 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%29 = getelementptr inbounds [256 x i8*], [256 x i8*]* %7, i64 0, i64 1
br label %30
30: ; preds = %201, %0
%31 = phi i32 [ 0, %0 ], [ %202, %201 ]
%32 = phi i32 [ 0, %0 ], [ %203, %201 ]
%33 = icmp eq i32 %32, 0
br i1 %33, label %59, label %34
34: ; preds = %30
%35 = icmp sgt i32 %31, 0
br i1 %35, label %36, label %59
36: ; preds = %34
%37 = zext i32 %31 to i64
br label %38
38: ; preds = %36, %55
%39 = phi i64 [ 0, %36 ], [ %57, %55 ]
%40 = phi i32 [ %32, %36 ], [ %56, %55 ]
%41 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %39
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
br i1 %43, label %55, label %44
44: ; preds = %38
%45 = load i32, i32* @WNOHANG
%46 = call i64 @waitpid(i32 %42, i32* %8, i32 %45)
%47 = icmp sgt i64 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %44
store i32 0, i32* %41
%49 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 %39
%50 = load i8*, i8** %49
%51 = call i32 @free(i8* %50)
%52 = add nsw i32 %40, -1
br label %53
53: ; preds = %48, %44
%54 = phi i32 [ %52, %48 ], [ %40, %44 ]
br label %55
55: ; preds = %38, %53
%56 = phi i32 [ %54, %53 ], [ %40, %38 ]
%57 = add nuw nsw i64 %39, 1
%58 = icmp eq i64 %57, %37
br i1 %58, label %59, label %38
59: ; preds = %55, %34, %30
%60 = phi i32 [ 0, %30 ], [ %31, %34 ], [ %31, %55 ]
%61 = phi i32 [ 0, %30 ], [ %32, %34 ], [ %56, %55 ]
%62 = 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))
%63 = load i32, i32* @stdin
%64 = call i32 @fgets(i8* %11, i32 256, i32 %63)
%65 = call i8* @strchr(i8* %11, i8 signext 10)
%66 = icmp eq i8* %65, null
br i1 %66, label %68, label %67
67: ; preds = %59
store i8 0, i8* %65
br label %68
68: ; preds = %67, %59
%69 = call i8* @strdup(i8* %11)
store i8* %69, i8** %6
%70 = icmp ne i8* %69, null
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
%73 = call i8* @strsep(i8** %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%74 = icmp eq i8* %73, null
br i1 %74, label %87, label %75
75: ; preds = %68, %75
%76 = phi i64 [ %84, %75 ], [ 0, %68 ]
%77 = phi i8* [ %85, %75 ], [ %73, %68 ]
%78 = phi i32 [ %82, %75 ], [ 0, %68 ]
%79 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
%81 = select i1 %80, i8* null, i8* %77
%82 = select i1 %80, i32 1, i32 %78
%83 = getelementptr inbounds [256 x i8*], [256 x i8*]* %7, i64 0, i64 %76
store i8* %81, i8** %83
%84 = add nuw i64 %76, 1
%85 = call i8* @strsep(i8** %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%86 = icmp eq i8* %85, null
br i1 %86, label %87, label %75
87: ; preds = %75, %68
%88 = phi i64 [ 0, %68 ], [ %84, %75 ]
%89 = phi i32 [ 0, %68 ], [ %82, %75 ]
%90 = and i64 %88, 4294967295
%91 = getelementptr inbounds [256 x i8*], [256 x i8*]* %7, i64 0, i64 %90
store i8* null, i8** %91
%92 = load i8*, i8** %19
%93 = call i64 @strcmp(i8* %92, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%94 = icmp eq i64 %93, 0
br i1 %94, label %95, label %101
95: ; preds = %87
%96 = icmp eq i32 %61, 0
br i1 %96, label %97, label %99
97: ; preds = %95
%98 = call i32 @exit(i32 0)
unreachable
99: ; preds = %95
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %201
101: ; preds = %87
%102 = load i8*, i8** %19
%103 = call i64 @strcmp(i8* %102, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %121
105: ; preds = %101
%106 = call i32* @getcwd(i8* %28, i32 1024)
%107 = icmp eq i32* %106, null
br i1 %107, label %110, label %108
108: ; preds = %105
%109 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %28)
br label %110
110: ; preds = %108, %105
%111 = load i8*, i8** %29
%112 = icmp eq i8* %111, null
br i1 %112, label %115, label %113
113: ; preds = %110
%114 = call i32 @chdir(i8* %111)
br label %115
115: ; preds = %113, %110
%116 = call i32* @getcwd(i8* %28, i32 1024)
%117 = icmp eq i32* %116, null
br i1 %117, label %120, label %118
118: ; preds = %115
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0), i8* %28)
br label %120
120: ; preds = %118, %115
br label %201
121: ; preds = %101
%122 = load i8*, i8** %19
%123 = call i64 @strcmp(i8* %122, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %144
125: ; preds = %121
%126 = icmp eq i32 %61, 0
br i1 %126, label %201, label %127
127: ; preds = %125
%128 = icmp sgt i32 %60, 0
br i1 %128, label %129, label %201
129: ; preds = %127
%130 = zext i32 %60 to i64
br label %131
131: ; preds = %129, %142
%132 = phi i64 [ 0, %129 ], [ %136, %142 ]
%133 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %132
%134 = load i32, i32* %133
%135 = icmp eq i32 %134, 0
%136 = add nuw nsw i64 %132, 1
br i1 %135, label %142, label %137
137: ; preds = %131
%138 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 %132
%139 = load i8*, i8** %138
%140 = trunc i64 %136 to i32
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %140, i32 %134, i8* %139)
br label %142
142: ; preds = %131, %137
%143 = icmp eq i64 %136, %130
br i1 %143, label %201, label %131
144: ; preds = %121
%145 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%146 = load i32, i32* %20
%147 = call i32 (...) @fork()
%148 = icmp slt i32 %147, 0
br i1 %148, label %149, label %154
149: ; preds = %144
%150 = load i32, i32* @errno
%151 = call i8* @strerror(i32 %150)
%152 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* %151)
%153 = call i32 @exit(i32 -1)
unreachable
154: ; preds = %144
%155 = icmp eq i32 %147, 0
br i1 %155, label %156, label %159
156: ; preds = %154
%157 = load i8*, i8** %19
%158 = call i32 @execvp(i8* %157, i8** %19)
br label %201
159: ; preds = %154
%160 = icmp eq i32 %89, 0
br i1 %160, label %161, label %183
161: ; preds = %159
%162 = call i32 @wait(i32* %10)
%163 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%164 = load i32, i32* %20
%165 = load i32, i32* @RUSAGE_CHILDREN
%166 = call i32 @getrusage(i32 %165, %struct.rusage* %2)
%167 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%168 = sub nsw i32 %164, %146
%169 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.14, i64 0, i64 0), i32 %168)
%170 = load i32, i32* %22
%171 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0), i32 %170)
%172 = load i32, i32* %23
%173 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.16, i64 0, i64 0), i32 %172)
%174 = load i32, i32* %24
%175 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.17, i64 0, i64 0), i32 %174)
%176 = load i32, i32* %25
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.18, i64 0, i64 0), i32 %176)
%178 = load i32, i32* %26
%179 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.19, i64 0, i64 0), i32 %178)
%180 = load i32, i32* %27
%181 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.20, i64 0, i64 0), i32 %180)
%182 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.23, i64 0, i64 0))
br label %198
183: ; preds = %159
%184 = sext i32 %61 to i64
%185 = getelementptr inbounds [256 x i32], [256 x i32]* %4, i64 0, i64 %184
%186 = load i32, i32* %185
%187 = icmp eq i32 %186, 0
br i1 %187, label %188, label %198
188: ; preds = %183
store i32 %147, i32* %185
%189 = load i8*, i8** %19
%190 = call i64 @strlen(i8* dereferenceable(1) %189)
%191 = add nsw i64 %190, 1
%192 = call i8* @malloc(i64 %191)
%193 = getelementptr inbounds [256 x i8*], [256 x i8*]* %5, i64 0, i64 %184
store i8* %192, i8** %193
%194 = call i32 @strcpy(i8* %192, i8* %189)
%195 = add nsw i32 %60, 1
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i64 0, i64 0), i32 %195, i8* %192)
%197 = add nsw i32 %61, 1
br label %198
198: ; preds = %183, %188, %161
%199 = phi i32 [ %60, %161 ], [ %195, %188 ], [ %60, %183 ]
%200 = phi i32 [ %61, %161 ], [ %197, %188 ], [ %61, %183 ]
br label %201
201: ; preds = %142, %127, %120, %198, %156, %125, %99
%202 = phi i32 [ %60, %99 ], [ %60, %120 ], [ %60, %125 ], [ %60, %156 ], [ %199, %198 ], [ %60, %127 ], [ %60, %142 ]
%203 = phi i32 [ %61, %99 ], [ %61, %120 ], [ 0, %125 ], [ %61, %156 ], [ %200, %198 ], [ %61, %127 ], [ %61, %142 ]
br label %30
}