#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ isDir(char *);
int /*<<< orphan*/ lire(char *);
int /*<<< orphan*/ lireDossier(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ system(char *);
void parcourirDossier(DIR *rep, char *chemin) {
  lire(chemin);
  system("clear");
  if (!isDir(chemin)) {
    printf("%s n'est pas un dossier", chemin);
    exit(-1);
  }
  rep = opendir(chemin);
  if (rep == NULL) {
    printf("Le dossier '%s' n'a pas pu etre ouvert", chemin);
    exit(-1);
  }
  lireDossier(chemin, rep);
  closedir(rep);
  parcourirDossier(rep, chemin);
}


x86 assembly (clang, -O0):
<parcourirDossier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <lire@plt>
lea    0xe50(%rip),%rdi
call   1050 <system@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <isDir@plt>
cmp    $0x0,%eax
jne    11e1 <parcourirDossier+0x51>
mov    -0x10(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1040 <opendir@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1213 <parcourirDossier+0x83>
mov    -0x10(%rbp),%rsi
lea    0xe1a(%rip),%rdi
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1090 <lireDossier@plt>
mov    -0x8(%rbp),%rdi
call   1080 <closedir@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <parcourirDossier@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parcourirDossier>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rsi,%rdi
call   1060 <lire@plt>
lea    0xe69(%rip),%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1090 <isDir@plt>
test   %eax,%eax
je     11ef <parcourirDossier+0x6f>
lea    0xe51(%rip),%r14
nop
mov    %r15,%rdi
call   1030 <opendir@plt>
test   %rax,%rax
je     11f8 <parcourirDossier+0x78>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1080 <lireDossier@plt>
mov    %rbx,%rdi
call   1070 <closedir@plt>
mov    %r15,%rdi
call   1060 <lire@plt>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %r15,%rdi
call   1090 <isDir@plt>
test   %eax,%eax
jne    11b0 <parcourirDossier+0x30>
lea    0xe10(%rip),%rdi
jmp    11ff <parcourirDossier+0x7f>
lea    0xe1f(%rip),%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [24 x i8] c"%s n'est pas un dossier\00"
@.str.2 = [39 x i8] c"Le dossier '%s' n'a pas pu etre ouvert\00"
define void @parcourirDossier(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @lire(i8* %5)
%7 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = call i32 @isDir(i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call i32* @opendir(i8* %16)
store i32* %17, i32** %3
%18 = load i32*, i32** %3
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load i8*, i8** %4
%22 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %15
%25 = load i8*, i8** %4
%26 = load i32*, i32** %3
%27 = call i32 @lireDossier(i8* %25, i32* %26)
%28 = load i32*, i32** %3
%29 = call i32 @closedir(i32* %28)
%30 = load i32*, i32** %3
%31 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [24 x i8] c"%s n'est pas un dossier\00"
@.str.2 = [39 x i8] c"Le dossier '%s' n'a pas pu etre ouvert\00"
define void @parcourirDossier(i32* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @lire(i8* %1)
%4 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @isDir(i8* %1)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %16, %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %2, %16
%11 = tail call i32* @opendir(i8* %1)
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %10
%17 = tail call i32 @lireDossier(i8* %1, i32* %11)
%18 = tail call i32 @closedir(i32* %11)
%19 = tail call i32 @lire(i8* %1)
%20 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%21 = tail call i32 @isDir(i8* %1)
%22 = icmp eq i32 %21, 0
br i1 %22, label %7, label %10
}