#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 stat {
  int st_size;
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int EEXIST;
int ENOENT;
int /*<<< orphan*/ SEEK_SET;
int S_ISDIR(int /*<<< orphan*/);
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int mkdir(char const *, int);
int /*<<< orphan*/ *opendir(char const *);
int rmdir(char const *);
int /*<<< orphan*/ stat(char const *, struct stat *);
int /*<<< orphan*/ unit_test_int(char *, int, int);
int /*<<< orphan*/ unit_test_str(char *, char *, char *);
int /*<<< orphan*/ unlink(char const *);
test_io() {
  FILE *f;
  struct stat buf;
  int r;
  const char *fichiertest = "/tacos/fichiertestio";
  const char *dossiertest = "/tacos/dossiertestio";
  unlink(fichiertest);
  f = fopen(fichiertest, "r");
  unit_test_int("Ouverture d'un fichier inexistant avec 'r'", 1, f == NULL);
  if (f)
    fclose(f);
  unlink(fichiertest);
  f = fopen(fichiertest, "r+");
  unit_test_int("Ouverture d'un fichier inexistant avec 'r+'", 1, f == NULL);
  if (f)
    fclose(f);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  unit_test_int("Ouverture d'un fichier inexistant avec 'w'", 1, f != NULL);
  if (f)
    fclose(f);
  unlink(fichiertest);
  f = fopen(fichiertest, "w+");
  unit_test_int("Ouverture d'un fichier inexistant avec 'w+'", 1, f != NULL);
  if (f)
    fclose(f);
  unlink(fichiertest);
  f = fopen(fichiertest, "a");
  unit_test_int("Ouverture d'un fichier inexistant avec 'a'", 1, f != NULL);
  if (f)
    fclose(f);
  unlink(fichiertest);
  f = fopen(fichiertest, "a+");
  unit_test_int("Ouverture d'un fichier inexistant avec 'a+'", 1, f != NULL);
  if (f)
    fclose(f);
  unlink(fichiertest);
  f = fopen(fichiertest, "w+");
  if (f)
    fclose(f);
  stat(fichiertest, &buf);
  unit_test_int("Longueur d'un fichier ouvert avec 'w+' doit etre de 0 "
                "(fichier inexistant)",
                0, buf.st_size);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  if (f) {
    fwrite("0123456789", sizeof(char), 10, f);
    fclose(f);
  }
  f = fopen(fichiertest, "w+");
  if (f)
    fclose(f);
  stat(fichiertest, &buf);
  unit_test_int("Longueur d'un fichier ouvert avec 'w+' doit etre de 0 "
                "(fichier non vide)",
                0, buf.st_size);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  if (f) {
    fwrite("0123456789", sizeof(char), 10, f);
    fclose(f);
  }
  f = fopen(fichiertest, "r");
  char buffer[11];
  if (f) {
    fread(buffer, sizeof(char), 10, f);
    buffer[10] = '\0';
    fclose(f);
  }
  unit_test_str("Lecture d'un fichier depuis le début.", "0123456789", buffer);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  if (f) {
    fwrite("0123456789", sizeof(char), 10, f);
    fclose(f);
  }
  f = fopen(fichiertest, "a");
  if (f) {
    fwrite("1011121314", sizeof(char), 10, f);
    fclose(f);
  }
  char buffer2[21];
  f = fopen(fichiertest, "r");
  if (f) {
    fread(buffer2, sizeof(char), 20, f);
    buffer2[20] = '\0';
    fclose(f);
  }
  unit_test_str("Ecriture, fermeture, Append, Lecture.", "01234567891011121314",
                buffer2);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  if (f) {
    fwrite("01234567891011121314", sizeof(char), 20, f);
    fclose(f);
  }
  f = fopen(fichiertest, "r");
  if (f) {
    fseek(f, 5, SEEK_SET);
    fread(buffer, sizeof(char), 10, f);
    fclose(f);
  }
  unit_test_str("Ecriture, fermeture, fseek, lecture.", "5678910111", buffer);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  if (f)
    fclose(f);
  f = fopen(fichiertest, "r");
  if (f) {
    r = fwrite("01234567891011121314", sizeof(char), 20, f);
    fclose(f);
  } else {
    r = -1;
  }
  unit_test_int("Ecriture sur fichier ouvert en lecture (retour fonction).", 0,
                r);
  stat(fichiertest, &buf);
  unit_test_int("Ecriture sur fichier ouvert en lecture (taille fichier).", 0,
                buf.st_size);
  unlink(fichiertest);
  f = fopen(fichiertest, "w");
  if (f) {
    r = fwrite("01234567891011121314", sizeof(char), 20, f);
    fclose(f);
  }
  unit_test_int("Ecriture sur fichier ouvert en écriture.", 20, r);
  unlink(fichiertest);
  DIR *d = opendir(dossiertest);
  unit_test_int("Ouverture d'un dossier non existant.", (int)NULL, (int)d);
  mkdir(dossiertest, 777);
  stat(dossiertest, &buf);
  unit_test_int("Création d'un dossier non existant.", 1, S_ISDIR(buf.st_mode));
  r = mkdir(dossiertest, 777);
  unit_test_int("Création d'un dossier existant doit renvoyer EEXIST.", EEXIST,
                errno);
  f = fopen(fichiertest, "w");
  r = mkdir(fichiertest, 777);
  unit_test_int(
      "Création d'un dossier portant un nom déjà pris doit renvoyer EEXIST.",
      EEXIST, errno);
  unlink(fichiertest);
  if (f)
    fclose(f);
  r = mkdir("/tacos/bla123456789/bla", 777);
  unit_test_int(
      "Création d'un dossier avec un des sous-dossier inexistant (ENOENT).",
      ENOENT, errno);
  mkdir(dossiertest, 777);
  r = rmdir(dossiertest);
  unit_test_int("Suppression d'un dossier existant (retour fonction).", 0, r);
  DIR *dir = opendir(dossiertest);
  unit_test_int("Suppression d'un dossier existant (opendir).", (int)NULL,
                (int)dir);
}


x86 assembly (clang, -O0):
<test_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    0xe21(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe2b(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edx
lea    0xe0d(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
cmpq   $0x0,-0x10(%rbp)
je     123d <test_io+0x6d>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edx
lea    0xdec(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
cmpq   $0x0,-0x10(%rbp)
je     128c <test_io+0xbc>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xde6(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edx
lea    0xdcb(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
cmpq   $0x0,-0x10(%rbp)
je     12db <test_io+0x10b>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xdc4(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edx
lea    0xdaa(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
cmpq   $0x0,-0x10(%rbp)
je     132a <test_io+0x15a>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0x10aa(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edx
lea    0xd87(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
cmpq   $0x0,-0x10(%rbp)
je     1379 <test_io+0x1a9>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xd80(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edx
lea    0xd66(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
cmpq   $0x0,-0x10(%rbp)
je     13c8 <test_io+0x1f8>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xcd7(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     13f9 <test_io+0x229>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <stat@plt>
mov    -0x18(%rbp),%edx
lea    0xd2c(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xc5b(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1462 <test_io+0x292>
mov    -0x10(%rbp),%rcx
lea    0xd3d(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   10f0 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xc46(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     148a <test_io+0x2ba>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <stat@plt>
mov    -0x18(%rbp),%edx
lea    0xcf1(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xbca(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     14f3 <test_io+0x323>
mov    -0x10(%rbp),%rcx
lea    0xcac(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   10f0 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xb2c(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1536 <test_io+0x366>
lea    -0x3b(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0xa,%edx
call   1050 <fread@plt>
movb   $0x0,-0x31(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x3b(%rbp),%rdx
lea    0xc9a(%rip),%rdi
lea    0xc3f(%rip),%rsi
call   10d0 <unit_test_str@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xb25(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1598 <test_io+0x3c8>
mov    -0x10(%rbp),%rcx
lea    0xc07(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   10f0 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xe45(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     15da <test_io+0x40a>
mov    -0x10(%rbp),%rcx
lea    0xc70(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
call   10f0 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0xa45(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     161d <test_io+0x44d>
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0x14,%edx
call   1050 <fread@plt>
movb   $0x0,-0x3c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x50(%rbp),%rdx
lea    0xbda(%rip),%rdi
lea    0xbf9(%rip),%rsi
call   10d0 <unit_test_str@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0xa3e(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     167f <test_io+0x4af>
mov    -0x10(%rbp),%rcx
lea    0xbc1(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
call   10f0 <fwrite@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0x9a0(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     16d5 <test_io+0x505>
mov    -0x10(%rbp),%rdi
mov    0x2927(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   10c0 <fseek@plt>
lea    -0x3b(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
mov    $0xa,%edx
call   1050 <fread@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x3b(%rbp),%rdx
lea    0xb5d(%rip),%rdi
lea    0xb7b(%rip),%rsi
call   10d0 <unit_test_str@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0x986(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     171d <test_io+0x54d>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
lea    0x902(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1767 <test_io+0x597>
mov    -0x10(%rbp),%rcx
lea    0xae1(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
call   10f0 <fwrite@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
jmp    176e <test_io+0x59e>
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
lea    0xaf5(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <stat@plt>
mov    -0x18(%rbp),%edx
lea    0xb11(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x28(%rbp),%rdi
lea    0x8d5(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     17eb <test_io+0x61b>
mov    -0x10(%rbp),%rcx
lea    0xa58(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
call   10f0 <fwrite@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x1c(%rbp),%edx
lea    0xaeb(%rip),%rdi
mov    $0x14,%esi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x30(%rbp),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %eax,%edx
lea    0xae8(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x30(%rbp),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    -0x30(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10a0 <stat@plt>
mov    -0x14(%rbp),%edi
call   1090 <S_ISDIR@plt>
mov    %eax,%edx
lea    0xada(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
mov    -0x30(%rbp),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2769(%rip),%rax
mov    (%rax),%esi
mov    0x2758(%rip),%rax
mov    (%rax),%edx
lea    0xacb(%rip),%rdi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
lea    0x7ed(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2726(%rip),%rax
mov    (%rax),%esi
mov    0x2715(%rip),%rax
mov    (%rax),%edx
lea    0xabe(%rip),%rdi
call   10b0 <unit_test_int@plt>
mov    -0x28(%rbp),%rdi
call   1030 <unlink@plt>
cmpq   $0x0,-0x10(%rbp)
je     18ee <test_io+0x71e>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
lea    0xadd(%rip),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    %eax,-0x1c(%rbp)
mov    0x26b7(%rip),%rax
mov    (%rax),%esi
mov    0x26c6(%rip),%rax
mov    (%rax),%edx
lea    0xacf(%rip),%rdi
call   10b0 <unit_test_int@plt>
mov    -0x30(%rbp),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    -0x30(%rbp),%rdi
call   1080 <rmdir@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edx
lea    0xaeb(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x30(%rbp),%rdi
call   1070 <opendir@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %eax,%edx
lea    0xaff(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_io>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xe1f(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xe3a(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edx,%edx
test   %rax,%rax
sete   %dl
lea    0xe22(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
test   %rbx,%rbx
je     1221 <test_io+0x51>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xdd8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xe20(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edx,%edx
test   %rax,%rax
sete   %dl
lea    0xe09(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
test   %rbx,%rbx
je     1268 <test_io+0x98>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xd91(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xe08(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edx,%edx
test   %rax,%rax
setne  %dl
lea    0xdf0(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
test   %rbx,%rbx
je     12af <test_io+0xdf>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xd4a(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xdee(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edx,%edx
test   %rax,%rax
setne  %dl
lea    0xdd7(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
test   %rbx,%rbx
je     12f6 <test_io+0x126>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xd03(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0x10dc(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edx,%edx
test   %rax,%rax
setne  %dl
lea    0xdbc(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
test   %rbx,%rbx
je     133d <test_io+0x16d>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xcbc(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xdba(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
xor    %edx,%edx
test   %rax,%rax
setne  %dl
lea    0xda3(%rip),%rdi
mov    $0x1,%esi
call   10b0 <unit_test_int@plt>
test   %rbx,%rbx
je     1384 <test_io+0x1b4>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xc75(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xd19(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     13af <test_io+0x1df>
mov    %rax,%rdi
call   1060 <fclose@plt>
lea    0xc4a(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <stat@plt>
mov    0x8(%rsp),%edx
lea    0xd6e(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xca2(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1415 <test_io+0x245>
mov    %rax,%rbx
lea    0xd8c(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xbe4(%rip),%rdi
lea    0xc90(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1435 <test_io+0x265>
mov    %rax,%rdi
call   1060 <fclose@plt>
lea    0xbc4(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <stat@plt>
mov    0x8(%rsp),%edx
lea    0xd3e(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xc1c(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     149b <test_io+0x2cb>
mov    %rax,%rbx
lea    0xd06(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xb5e(%rip),%rdi
lea    0xb81(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     14da <test_io+0x30a>
mov    %rax,%rbx
lea    0x15(%rsp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %rax,%rcx
call   1050 <fread@plt>
movb   $0x0,0x1f(%rsp)
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xcfa(%rip),%rdi
lea    0xc9f(%rip),%rsi
lea    0x15(%rsp),%rdx
call   10d0 <unit_test_str@plt>
lea    0xb07(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xb7e(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1539 <test_io+0x369>
mov    %rax,%rbx
lea    0xc68(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xac0(%rip),%rdi
lea    0xea1(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1575 <test_io+0x3a5>
mov    %rax,%rbx
lea    0xcd7(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xa84(%rip),%rdi
lea    0xaa7(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     15b4 <test_io+0x3e4>
mov    %rax,%rbx
lea    0x20(%rsp),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %rax,%rcx
call   1050 <fread@plt>
movb   $0x0,0x34(%rsp)
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xc47(%rip),%rdi
lea    0xc66(%rip),%rsi
lea    0x20(%rsp),%rdx
call   10d0 <unit_test_str@plt>
lea    0xa2d(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0xaa4(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1613 <test_io+0x443>
mov    %rax,%rbx
lea    0xc2f(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0x9e6(%rip),%rdi
lea    0xa09(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1663 <test_io+0x493>
mov    %rax,%rbx
mov    0x299b(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   10c0 <fseek@plt>
lea    0x15(%rsp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xbd3(%rip),%rdi
lea    0xbf1(%rip),%rsi
lea    0x15(%rsp),%rdx
call   10d0 <unit_test_str@plt>
lea    0x97e(%rip),%rbx
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0x9f5(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     16a6 <test_io+0x4d6>
mov    %rax,%rdi
call   1060 <fclose@plt>
lea    0x953(%rip),%rdi
lea    0x976(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     16e6 <test_io+0x516>
mov    %rax,%rbx
lea    0xb60(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <fclose@plt>
jmp    16eb <test_io+0x51b>
mov    $0xffffffff,%ebp
lea    0xb7b(%rip),%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   10b0 <unit_test_int@plt>
lea    0x8fe(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <stat@plt>
mov    0x8(%rsp),%edx
lea    0xb8d(%rip),%rdi
xor    %esi,%esi
call   10b0 <unit_test_int@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
lea    0x956(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1763 <test_io+0x593>
mov    %rax,%rbx
lea    0xae1(%rip),%rdi
mov    $0x1,%esi
mov    $0x14,%edx
mov    %rax,%rcx
call   10f0 <fwrite@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xb76(%rip),%rdi
mov    $0x14,%esi
mov    %ebp,%edx
call   10b0 <unit_test_int@plt>
lea    0x883(%rip),%r14
mov    %r14,%rdi
call   1030 <unlink@plt>
lea    0x889(%rip),%rbx
mov    %rbx,%rdi
call   1070 <opendir@plt>
lea    0xb6f(%rip),%rdi
xor    %esi,%esi
mov    %eax,%edx
call   10b0 <unit_test_int@plt>
mov    %rbx,%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   10a0 <stat@plt>
mov    0xc(%rsp),%edi
call   1090 <S_ISDIR@plt>
lea    0xb61(%rip),%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   10b0 <unit_test_int@plt>
mov    %rbx,%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    0x27f2(%rip),%rbp
mov    0x0(%rbp),%esi
mov    0x27e0(%rip),%r15
mov    (%r15),%edx
lea    0xb52(%rip),%rdi
call   10b0 <unit_test_int@plt>
lea    0x878(%rip),%rsi
mov    %r14,%rdi
call   10e0 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    0x0(%rbp),%esi
mov    (%r15),%edx
lea    0xb57(%rip),%rdi
call   10b0 <unit_test_int@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
test   %rbx,%rbx
je     184d <test_io+0x67d>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xb7e(%rip),%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    0x275b(%rip),%rax
mov    (%rax),%esi
mov    (%r15),%edx
lea    0xb79(%rip),%rdi
call   10b0 <unit_test_int@plt>
lea    0x798(%rip),%rbx
mov    %rbx,%rdi
mov    $0x309,%esi
call   1040 <mkdir@plt>
mov    %rbx,%rdi
call   1080 <rmdir@plt>
lea    0xb96(%rip),%rdi
xor    %esi,%esi
mov    %eax,%edx
call   10b0 <unit_test_int@plt>
mov    %rbx,%rdi
call   1070 <opendir@plt>
lea    0xbb3(%rip),%rdi
xor    %esi,%esi
mov    %eax,%edx
call   10b0 <unit_test_int@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
@.str = [21 x i8] c"/tacos/fichiertestio\00"
@.str.1 = [21 x i8] c"/tacos/dossiertestio\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [43 x i8] c"Ouverture d'un fichier inexistant avec 'r'\00"
@.str.4 = [3 x i8] c"r+\00"
@.str.5 = [44 x i8] c"Ouverture d'un fichier inexistant avec 'r+'\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [43 x i8] c"Ouverture d'un fichier inexistant avec 'w'\00"
@.str.8 = [3 x i8] c"w+\00"
@.str.9 = [44 x i8] c"Ouverture d'un fichier inexistant avec 'w+'\00"
@.str.10 = [2 x i8] c"a\00"
@.str.11 = [43 x i8] c"Ouverture d'un fichier inexistant avec 'a'\00"
@.str.12 = [3 x i8] c"a+\00"
@.str.13 = [44 x i8] c"Ouverture d'un fichier inexistant avec 'a+'\00"
@.str.14 = [75 x i8] c"Longueur d'un fichier ouvert avec 'w+' doit etre de 0 (fichier inexistant)\00"
@.str.15 = [11 x i8] c"0123456789\00"
@.str.16 = [73 x i8] c"Longueur d'un fichier ouvert avec 'w+' doit etre de 0 (fichier non vide)\00"
@.str.17 = [39 x i8] c"Lecture d'un fichier depuis le d\C3\A9but.\00"
@.str.18 = [11 x i8] c"1011121314\00"
@.str.19 = [38 x i8] c"Ecriture, fermeture, Append, Lecture.\00"
@.str.20 = [21 x i8] c"01234567891011121314\00"
@SEEK_SET = global i32 0
@.str.21 = [37 x i8] c"Ecriture, fermeture, fseek, lecture.\00"
@.str.22 = [11 x i8] c"5678910111\00"
@.str.23 = [58 x i8] c"Ecriture sur fichier ouvert en lecture (retour fonction).\00"
@.str.24 = [57 x i8] c"Ecriture sur fichier ouvert en lecture (taille fichier).\00"
@.str.25 = [42 x i8] c"Ecriture sur fichier ouvert en \C3\A9criture.\00"
@.str.26 = [37 x i8] c"Ouverture d'un dossier non existant.\00"
@.str.27 = [37 x i8] c"Cr\C3\A9ation d'un dossier non existant.\00"
@.str.28 = [54 x i8] c"Cr\C3\A9ation d'un dossier existant doit renvoyer EEXIST.\00"
@EEXIST = global i32 0
@errno = global i32 0
@.str.29 = [72 x i8] c"Cr\C3\A9ation d'un dossier portant un nom d\C3\A9j\C3\A0 pris doit renvoyer EEXIST.\00"
@.str.30 = [24 x i8] c"/tacos/bla123456789/bla\00"
@.str.31 = [69 x i8] c"Cr\C3\A9ation d'un dossier avec un des sous-dossier inexistant (ENOENT).\00"
@ENOENT = global i32 0
@.str.32 = [53 x i8] c"Suppression d'un dossier existant (retour fonction).\00"
@.str.33 = [45 x i8] c"Suppression d'un dossier existant (opendir).\00"
define i32 @test_io() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca %struct.stat
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [11 x i8]
%8 = alloca [21 x i8]
%9 = alloca i32*
%10 = alloca i32*
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8** %6
%11 = load i8*, i8** %5
%12 = call i32 @unlink(i8* %11)
%13 = load i8*, i8** %5
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %14, i32** %2
%15 = load i32*, i32** %2
%16 = icmp eq i32* %15, null
%17 = zext i1 %16 to i32
%18 = call i32 @unit_test_int(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %17)
%19 = load i32*, i32** %2
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = load i32*, i32** %2
%23 = call i32 @fclose(i32* %22)
br label %24
24: ; preds = %21, %0
%25 = load i8*, i8** %5
%26 = call i32 @unlink(i8* %25)
%27 = load i8*, i8** %5
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %28, i32** %2
%29 = load i32*, i32** %2
%30 = icmp eq i32* %29, null
%31 = zext i1 %30 to i32
%32 = call i32 @unit_test_int(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 %31)
%33 = load i32*, i32** %2
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %38
35: ; preds = %24
%36 = load i32*, i32** %2
%37 = call i32 @fclose(i32* %36)
br label %38
38: ; preds = %35, %24
%39 = load i8*, i8** %5
%40 = call i32 @unlink(i8* %39)
%41 = load i8*, i8** %5
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %42, i32** %2
%43 = load i32*, i32** %2
%44 = icmp ne i32* %43, null
%45 = zext i1 %44 to i32
%46 = call i32 @unit_test_int(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 1, i32 %45)
%47 = load i32*, i32** %2
%48 = icmp ne i32* %47, null
br i1 %48, label %49, label %52
49: ; preds = %38
%50 = load i32*, i32** %2
%51 = call i32 @fclose(i32* %50)
br label %52
52: ; preds = %49, %38
%53 = load i8*, i8** %5
%54 = call i32 @unlink(i8* %53)
%55 = load i8*, i8** %5
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %56, i32** %2
%57 = load i32*, i32** %2
%58 = icmp ne i32* %57, null
%59 = zext i1 %58 to i32
%60 = call i32 @unit_test_int(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0), i32 1, i32 %59)
%61 = load i32*, i32** %2
%62 = icmp ne i32* %61, null
br i1 %62, label %63, label %66
63: ; preds = %52
%64 = load i32*, i32** %2
%65 = call i32 @fclose(i32* %64)
br label %66
66: ; preds = %63, %52
%67 = load i8*, i8** %5
%68 = call i32 @unlink(i8* %67)
%69 = load i8*, i8** %5
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %70, i32** %2
%71 = load i32*, i32** %2
%72 = icmp ne i32* %71, null
%73 = zext i1 %72 to i32
%74 = call i32 @unit_test_int(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %73)
%75 = load i32*, i32** %2
%76 = icmp ne i32* %75, null
br i1 %76, label %77, label %80
77: ; preds = %66
%78 = load i32*, i32** %2
%79 = call i32 @fclose(i32* %78)
br label %80
80: ; preds = %77, %66
%81 = load i8*, i8** %5
%82 = call i32 @unlink(i8* %81)
%83 = load i8*, i8** %5
%84 = call i32* @fopen(i8* %83, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
store i32* %84, i32** %2
%85 = load i32*, i32** %2
%86 = icmp ne i32* %85, null
%87 = zext i1 %86 to i32
%88 = call i32 @unit_test_int(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.13, i64 0, i64 0), i32 1, i32 %87)
%89 = load i32*, i32** %2
%90 = icmp ne i32* %89, null
br i1 %90, label %91, label %94
91: ; preds = %80
%92 = load i32*, i32** %2
%93 = call i32 @fclose(i32* %92)
br label %94
94: ; preds = %91, %80
%95 = load i8*, i8** %5
%96 = call i32 @unlink(i8* %95)
%97 = load i8*, i8** %5
%98 = call i32* @fopen(i8* %97, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %98, i32** %2
%99 = load i32*, i32** %2
%100 = icmp ne i32* %99, null
br i1 %100, label %101, label %104
101: ; preds = %94
%102 = load i32*, i32** %2
%103 = call i32 @fclose(i32* %102)
br label %104
104: ; preds = %101, %94
%105 = load i8*, i8** %5
%106 = call i32 @stat(i8* %105, %struct.stat* %3)
%107 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%108 = load i32, i32* %107
%109 = call i32 @unit_test_int(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.14, i64 0, i64 0), i32 0, i32 %108)
%110 = load i8*, i8** %5
%111 = call i32 @unlink(i8* %110)
%112 = load i8*, i8** %5
%113 = call i32* @fopen(i8* %112, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %113, i32** %2
%114 = load i32*, i32** %2
%115 = icmp ne i32* %114, null
br i1 %115, label %116, label %121
116: ; preds = %104
%117 = load i32*, i32** %2
%118 = call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 10, i32* %117)
%119 = load i32*, i32** %2
%120 = call i32 @fclose(i32* %119)
br label %121
121: ; preds = %116, %104
%122 = load i8*, i8** %5
%123 = call i32* @fopen(i8* %122, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
store i32* %123, i32** %2
%124 = load i32*, i32** %2
%125 = icmp ne i32* %124, null
br i1 %125, label %126, label %129
126: ; preds = %121
%127 = load i32*, i32** %2
%128 = call i32 @fclose(i32* %127)
br label %129
129: ; preds = %126, %121
%130 = load i8*, i8** %5
%131 = call i32 @stat(i8* %130, %struct.stat* %3)
%132 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%133 = load i32, i32* %132
%134 = call i32 @unit_test_int(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.16, i64 0, i64 0), i32 0, i32 %133)
%135 = load i8*, i8** %5
%136 = call i32 @unlink(i8* %135)
%137 = load i8*, i8** %5
%138 = call i32* @fopen(i8* %137, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %138, i32** %2
%139 = load i32*, i32** %2
%140 = icmp ne i32* %139, null
br i1 %140, label %141, label %146
141: ; preds = %129
%142 = load i32*, i32** %2
%143 = call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 10, i32* %142)
%144 = load i32*, i32** %2
%145 = call i32 @fclose(i32* %144)
br label %146
146: ; preds = %141, %129
%147 = load i8*, i8** %5
%148 = call i32* @fopen(i8* %147, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %148, i32** %2
%149 = load i32*, i32** %2
%150 = icmp ne i32* %149, null
br i1 %150, label %151, label %158
151: ; preds = %146
%152 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%153 = load i32*, i32** %2
%154 = call i32 @fread(i8* %152, i32 1, i32 10, i32* %153)
%155 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 10
store i8 0, i8* %155
%156 = load i32*, i32** %2
%157 = call i32 @fclose(i32* %156)
br label %158
158: ; preds = %151, %146
%159 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%160 = call i32 @unit_test_str(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %159)
%161 = load i8*, i8** %5
%162 = call i32 @unlink(i8* %161)
%163 = load i8*, i8** %5
%164 = call i32* @fopen(i8* %163, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %164, i32** %2
%165 = load i32*, i32** %2
%166 = icmp ne i32* %165, null
br i1 %166, label %167, label %172
167: ; preds = %158
%168 = load i32*, i32** %2
%169 = call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 10, i32* %168)
%170 = load i32*, i32** %2
%171 = call i32 @fclose(i32* %170)
br label %172
172: ; preds = %167, %158
%173 = load i8*, i8** %5
%174 = call i32* @fopen(i8* %173, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %174, i32** %2
%175 = load i32*, i32** %2
%176 = icmp ne i32* %175, null
br i1 %176, label %177, label %182
177: ; preds = %172
%178 = load i32*, i32** %2
%179 = call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0), i32 1, i32 10, i32* %178)
%180 = load i32*, i32** %2
%181 = call i32 @fclose(i32* %180)
br label %182
182: ; preds = %177, %172
%183 = load i8*, i8** %5
%184 = call i32* @fopen(i8* %183, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %184, i32** %2
%185 = load i32*, i32** %2
%186 = icmp ne i32* %185, null
br i1 %186, label %187, label %194
187: ; preds = %182
%188 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%189 = load i32*, i32** %2
%190 = call i32 @fread(i8* %188, i32 1, i32 20, i32* %189)
%191 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 20
store i8 0, i8* %191
%192 = load i32*, i32** %2
%193 = call i32 @fclose(i32* %192)
br label %194
194: ; preds = %187, %182
%195 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%196 = call i32 @unit_test_str(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i8* %195)
%197 = load i8*, i8** %5
%198 = call i32 @unlink(i8* %197)
%199 = load i8*, i8** %5
%200 = call i32* @fopen(i8* %199, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %200, i32** %2
%201 = load i32*, i32** %2
%202 = icmp ne i32* %201, null
br i1 %202, label %203, label %208
203: ; preds = %194
%204 = load i32*, i32** %2
%205 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 20, i32* %204)
%206 = load i32*, i32** %2
%207 = call i32 @fclose(i32* %206)
br label %208
208: ; preds = %203, %194
%209 = load i8*, i8** %5
%210 = call i32* @fopen(i8* %209, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %210, i32** %2
%211 = load i32*, i32** %2
%212 = icmp ne i32* %211, null
br i1 %212, label %213, label %222
213: ; preds = %208
%214 = load i32*, i32** %2
%215 = load i32, i32* @SEEK_SET
%216 = call i32 @fseek(i32* %214, i32 5, i32 %215)
%217 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%218 = load i32*, i32** %2
%219 = call i32 @fread(i8* %217, i32 1, i32 10, i32* %218)
%220 = load i32*, i32** %2
%221 = call i32 @fclose(i32* %220)
br label %222
222: ; preds = %213, %208
%223 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%224 = call i32 @unit_test_str(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0), i8* %223)
%225 = load i8*, i8** %5
%226 = call i32 @unlink(i8* %225)
%227 = load i8*, i8** %5
%228 = call i32* @fopen(i8* %227, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %228, i32** %2
%229 = load i32*, i32** %2
%230 = icmp ne i32* %229, null
br i1 %230, label %231, label %234
231: ; preds = %222
%232 = load i32*, i32** %2
%233 = call i32 @fclose(i32* %232)
br label %234
234: ; preds = %231, %222
%235 = load i8*, i8** %5
%236 = call i32* @fopen(i8* %235, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %236, i32** %2
%237 = load i32*, i32** %2
%238 = icmp ne i32* %237, null
br i1 %238, label %239, label %244
239: ; preds = %234
%240 = load i32*, i32** %2
%241 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 20, i32* %240)
store i32 %241, i32* %4
%242 = load i32*, i32** %2
%243 = call i32 @fclose(i32* %242)
br label %245
244: ; preds = %234
store i32 -1, i32* %4
br label %245
245: ; preds = %244, %239
%246 = load i32, i32* %4
%247 = call i32 @unit_test_int(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.23, i64 0, i64 0), i32 0, i32 %246)
%248 = load i8*, i8** %5
%249 = call i32 @stat(i8* %248, %struct.stat* %3)
%250 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%251 = load i32, i32* %250
%252 = call i32 @unit_test_int(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.24, i64 0, i64 0), i32 0, i32 %251)
%253 = load i8*, i8** %5
%254 = call i32 @unlink(i8* %253)
%255 = load i8*, i8** %5
%256 = call i32* @fopen(i8* %255, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %256, i32** %2
%257 = load i32*, i32** %2
%258 = icmp ne i32* %257, null
br i1 %258, label %259, label %264
259: ; preds = %245
%260 = load i32*, i32** %2
%261 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 20, i32* %260)
store i32 %261, i32* %4
%262 = load i32*, i32** %2
%263 = call i32 @fclose(i32* %262)
br label %264
264: ; preds = %259, %245
%265 = load i32, i32* %4
%266 = call i32 @unit_test_int(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.25, i64 0, i64 0), i32 20, i32 %265)
%267 = load i8*, i8** %5
%268 = call i32 @unlink(i8* %267)
%269 = load i8*, i8** %6
%270 = call i32* @opendir(i8* %269)
store i32* %270, i32** %9
%271 = load i32*, i32** %9
%272 = ptrtoint i32* %271 to i32
%273 = call i32 @unit_test_int(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i64 0, i64 0), i32 0, i32 %272)
%274 = load i8*, i8** %6
%275 = call i32 @mkdir(i8* %274, i32 777)
%276 = load i8*, i8** %6
%277 = call i32 @stat(i8* %276, %struct.stat* %3)
%278 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 1
%279 = load i32, i32* %278
%280 = call i32 @S_ISDIR(i32 %279)
%281 = call i32 @unit_test_int(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.27, i64 0, i64 0), i32 1, i32 %280)
%282 = load i8*, i8** %6
%283 = call i32 @mkdir(i8* %282, i32 777)
store i32 %283, i32* %4
%284 = load i32, i32* @EEXIST
%285 = load i32, i32* @errno
%286 = call i32 @unit_test_int(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.28, i64 0, i64 0), i32 %284, i32 %285)
%287 = load i8*, i8** %5
%288 = call i32* @fopen(i8* %287, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i32* %288, i32** %2
%289 = load i8*, i8** %5
%290 = call i32 @mkdir(i8* %289, i32 777)
store i32 %290, i32* %4
%291 = load i32, i32* @EEXIST
%292 = load i32, i32* @errno
%293 = call i32 @unit_test_int(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.29, i64 0, i64 0), i32 %291, i32 %292)
%294 = load i8*, i8** %5
%295 = call i32 @unlink(i8* %294)
%296 = load i32*, i32** %2
%297 = icmp ne i32* %296, null
br i1 %297, label %298, label %301
298: ; preds = %264
%299 = load i32*, i32** %2
%300 = call i32 @fclose(i32* %299)
br label %301
301: ; preds = %298, %264
%302 = call i32 @mkdir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.30, i64 0, i64 0), i32 777)
store i32 %302, i32* %4
%303 = load i32, i32* @ENOENT
%304 = load i32, i32* @errno
%305 = call i32 @unit_test_int(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.31, i64 0, i64 0), i32 %303, i32 %304)
%306 = load i8*, i8** %6
%307 = call i32 @mkdir(i8* %306, i32 777)
%308 = load i8*, i8** %6
%309 = call i32 @rmdir(i8* %308)
store i32 %309, i32* %4
%310 = load i32, i32* %4
%311 = call i32 @unit_test_int(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.32, i64 0, i64 0), i32 0, i32 %310)
%312 = load i8*, i8** %6
%313 = call i32* @opendir(i8* %312)
store i32* %313, i32** %10
%314 = load i32*, i32** %10
%315 = ptrtoint i32* %314 to i32
%316 = call i32 @unit_test_int(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.33, i64 0, i64 0), i32 0, i32 %315)
%317 = load i32, i32* %1
ret i32 %317
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
@.str = [21 x i8] c"/tacos/fichiertestio\00"
@.str.1 = [21 x i8] c"/tacos/dossiertestio\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [43 x i8] c"Ouverture d'un fichier inexistant avec 'r'\00"
@.str.4 = [3 x i8] c"r+\00"
@.str.5 = [44 x i8] c"Ouverture d'un fichier inexistant avec 'r+'\00"
@.str.6 = [2 x i8] c"w\00"
@.str.7 = [43 x i8] c"Ouverture d'un fichier inexistant avec 'w'\00"
@.str.8 = [3 x i8] c"w+\00"
@.str.9 = [44 x i8] c"Ouverture d'un fichier inexistant avec 'w+'\00"
@.str.10 = [2 x i8] c"a\00"
@.str.11 = [43 x i8] c"Ouverture d'un fichier inexistant avec 'a'\00"
@.str.12 = [3 x i8] c"a+\00"
@.str.13 = [44 x i8] c"Ouverture d'un fichier inexistant avec 'a+'\00"
@.str.14 = [75 x i8] c"Longueur d'un fichier ouvert avec 'w+' doit etre de 0 (fichier inexistant)\00"
@.str.15 = [11 x i8] c"0123456789\00"
@.str.16 = [73 x i8] c"Longueur d'un fichier ouvert avec 'w+' doit etre de 0 (fichier non vide)\00"
@.str.17 = [39 x i8] c"Lecture d'un fichier depuis le d\C3\A9but.\00"
@.str.18 = [11 x i8] c"1011121314\00"
@.str.19 = [38 x i8] c"Ecriture, fermeture, Append, Lecture.\00"
@.str.20 = [21 x i8] c"01234567891011121314\00"
@SEEK_SET = global i32 0
@.str.21 = [37 x i8] c"Ecriture, fermeture, fseek, lecture.\00"
@.str.22 = [11 x i8] c"5678910111\00"
@.str.23 = [58 x i8] c"Ecriture sur fichier ouvert en lecture (retour fonction).\00"
@.str.24 = [57 x i8] c"Ecriture sur fichier ouvert en lecture (taille fichier).\00"
@.str.25 = [42 x i8] c"Ecriture sur fichier ouvert en \C3\A9criture.\00"
@.str.26 = [37 x i8] c"Ouverture d'un dossier non existant.\00"
@.str.27 = [37 x i8] c"Cr\C3\A9ation d'un dossier non existant.\00"
@.str.28 = [54 x i8] c"Cr\C3\A9ation d'un dossier existant doit renvoyer EEXIST.\00"
@EEXIST = global i32 0
@errno = global i32 0
@.str.29 = [72 x i8] c"Cr\C3\A9ation d'un dossier portant un nom d\C3\A9j\C3\A0 pris doit renvoyer EEXIST.\00"
@.str.30 = [24 x i8] c"/tacos/bla123456789/bla\00"
@.str.31 = [69 x i8] c"Cr\C3\A9ation d'un dossier avec un des sous-dossier inexistant (ENOENT).\00"
@ENOENT = global i32 0
@.str.32 = [53 x i8] c"Suppression d'un dossier existant (retour fonction).\00"
@.str.33 = [45 x i8] c"Suppression d'un dossier existant (opendir).\00"
define i32 @test_io() {
%1 = alloca %struct.stat
%2 = alloca [11 x i8]
%3 = alloca [21 x i8]
%4 = bitcast %struct.stat* %1 to i8*
%5 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32* %6, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %8)
br i1 %7, label %12, label %10
10: ; preds = %0
%11 = tail call i32 @fclose(i32* %6)
br label %12
12: ; preds = %10, %0
%13 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i32* %14, null
%16 = zext i1 %15 to i32
%17 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 1, i32 %16)
br i1 %15, label %20, label %18
18: ; preds = %12
%19 = tail call i32 @fclose(i32* %14)
br label %20
20: ; preds = %18, %12
%21 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%22 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%23 = icmp ne i32* %22, null
%24 = zext i1 %23 to i32
%25 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i32 1, i32 %24)
br i1 %23, label %26, label %28
26: ; preds = %20
%27 = tail call i32 @fclose(i32* %22)
br label %28
28: ; preds = %26, %20
%29 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%30 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%31 = icmp ne i32* %30, null
%32 = zext i1 %31 to i32
%33 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0), i32 1, i32 %32)
br i1 %31, label %34, label %36
34: ; preds = %28
%35 = tail call i32 @fclose(i32* %30)
br label %36
36: ; preds = %34, %28
%37 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%38 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%39 = icmp ne i32* %38, null
%40 = zext i1 %39 to i32
%41 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.11, i64 0, i64 0), i32 1, i32 %40)
br i1 %39, label %42, label %44
42: ; preds = %36
%43 = tail call i32 @fclose(i32* %38)
br label %44
44: ; preds = %42, %36
%45 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%46 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
%47 = icmp ne i32* %46, null
%48 = zext i1 %47 to i32
%49 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.13, i64 0, i64 0), i32 1, i32 %48)
br i1 %47, label %50, label %52
50: ; preds = %44
%51 = tail call i32 @fclose(i32* %46)
br label %52
52: ; preds = %50, %44
%53 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%54 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%55 = icmp eq i32* %54, null
br i1 %55, label %58, label %56
56: ; preds = %52
%57 = tail call i32 @fclose(i32* %54)
br label %58
58: ; preds = %56, %52
%59 = call i32 @stat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%60 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%61 = load i32, i32* %60
%62 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.14, i64 0, i64 0), i32 0, i32 %61)
%63 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%64 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%65 = icmp eq i32* %64, null
br i1 %65, label %69, label %66
66: ; preds = %58
%67 = tail call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 10, i32* %64)
%68 = tail call i32 @fclose(i32* %64)
br label %69
69: ; preds = %66, %58
%70 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%71 = icmp eq i32* %70, null
br i1 %71, label %74, label %72
72: ; preds = %69
%73 = tail call i32 @fclose(i32* %70)
br label %74
74: ; preds = %72, %69
%75 = call i32 @stat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%76 = load i32, i32* %60
%77 = tail call i32 @unit_test_int(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.16, i64 0, i64 0), i32 0, i32 %76)
%78 = tail call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%79 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%80 = icmp eq i32* %79, null
br i1 %80, label %84, label %81
81: ; preds = %74
%82 = tail call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 10, i32* %79)
%83 = tail call i32 @fclose(i32* %79)
br label %84
84: ; preds = %81, %74
%85 = tail call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%86 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%87 = icmp eq i32* %85, null
br i1 %87, label %92, label %88
88: ; preds = %84
%89 = call i32 @fread(i8* %86, i32 1, i32 10, i32* %85)
%90 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 10
store i8 0, i8* %90
%91 = tail call i32 @fclose(i32* %85)
br label %92
92: ; preds = %88, %84
%93 = call i32 @unit_test_str(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* %86)
%94 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%95 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%96 = icmp eq i32* %95, null
br i1 %96, label %100, label %97
97: ; preds = %92
%98 = call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i32 1, i32 10, i32* %95)
%99 = call i32 @fclose(i32* %95)
br label %100
100: ; preds = %97, %92
%101 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%102 = icmp eq i32* %101, null
br i1 %102, label %106, label %103
103: ; preds = %100
%104 = call i32 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.18, i64 0, i64 0), i32 1, i32 10, i32* %101)
%105 = call i32 @fclose(i32* %101)
br label %106
106: ; preds = %103, %100
%107 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%108 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%109 = icmp eq i32* %108, null
br i1 %109, label %114, label %110
110: ; preds = %106
%111 = call i32 @fread(i8* %107, i32 1, i32 20, i32* %108)
%112 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 20
store i8 0, i8* %112
%113 = call i32 @fclose(i32* %108)
br label %114
114: ; preds = %110, %106
%115 = call i32 @unit_test_str(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i8* %107)
%116 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%117 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%118 = icmp eq i32* %117, null
br i1 %118, label %122, label %119
119: ; preds = %114
%120 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 20, i32* %117)
%121 = call i32 @fclose(i32* %117)
br label %122
122: ; preds = %119, %114
%123 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%124 = icmp eq i32* %123, null
br i1 %124, label %130, label %125
125: ; preds = %122
%126 = load i32, i32* @SEEK_SET
%127 = call i32 @fseek(i32* %123, i32 5, i32 %126)
%128 = call i32 @fread(i8* %86, i32 1, i32 10, i32* %123)
%129 = call i32 @fclose(i32* %123)
br label %130
130: ; preds = %125, %122
%131 = call i32 @unit_test_str(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.22, i64 0, i64 0), i8* %86)
%132 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%133 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%134 = icmp eq i32* %133, null
br i1 %134, label %137, label %135
135: ; preds = %130
%136 = call i32 @fclose(i32* %133)
br label %137
137: ; preds = %135, %130
%138 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%139 = icmp eq i32* %138, null
br i1 %139, label %143, label %140
140: ; preds = %137
%141 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 20, i32* %138)
%142 = call i32 @fclose(i32* %138)
br label %143
143: ; preds = %137, %140
%144 = phi i32 [ %141, %140 ], [ -1, %137 ]
%145 = call i32 @unit_test_int(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.23, i64 0, i64 0), i32 0, i32 %144)
%146 = call i32 @stat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%147 = load i32, i32* %60
%148 = call i32 @unit_test_int(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.24, i64 0, i64 0), i32 0, i32 %147)
%149 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%150 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%151 = icmp eq i32* %150, null
br i1 %151, label %155, label %152
152: ; preds = %143
%153 = call i32 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0), i32 1, i32 20, i32* %150)
%154 = call i32 @fclose(i32* %150)
br label %155
155: ; preds = %152, %143
%156 = phi i32 [ %153, %152 ], [ %144, %143 ]
%157 = call i32 @unit_test_int(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.25, i64 0, i64 0), i32 20, i32 %156)
%158 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%159 = call i32* @opendir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%160 = ptrtoint i32* %159 to i64
%161 = trunc i64 %160 to i32
%162 = call i32 @unit_test_int(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.26, i64 0, i64 0), i32 0, i32 %161)
%163 = call i32 @mkdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 777)
%164 = call i32 @stat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %struct.stat* %1)
%165 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 1
%166 = load i32, i32* %165
%167 = call i32 @S_ISDIR(i32 %166)
%168 = call i32 @unit_test_int(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.27, i64 0, i64 0), i32 1, i32 %167)
%169 = call i32 @mkdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 777)
%170 = load i32, i32* @EEXIST
%171 = load i32, i32* @errno
%172 = call i32 @unit_test_int(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.28, i64 0, i64 0), i32 %170, i32 %171)
%173 = call i32* @fopen(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%174 = call i32 @mkdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 777)
%175 = load i32, i32* @EEXIST
%176 = load i32, i32* @errno
%177 = call i32 @unit_test_int(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.29, i64 0, i64 0), i32 %175, i32 %176)
%178 = call i32 @unlink(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%179 = icmp eq i32* %173, null
br i1 %179, label %182, label %180
180: ; preds = %155
%181 = call i32 @fclose(i32* %173)
br label %182
182: ; preds = %180, %155
%183 = call i32 @mkdir(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.30, i64 0, i64 0), i32 777)
%184 = load i32, i32* @ENOENT
%185 = load i32, i32* @errno
%186 = call i32 @unit_test_int(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.31, i64 0, i64 0), i32 %184, i32 %185)
%187 = call i32 @mkdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 777)
%188 = call i32 @rmdir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%189 = call i32 @unit_test_int(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.32, i64 0, i64 0), i32 0, i32 %188)
%190 = call i32* @opendir(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%191 = ptrtoint i32* %190 to i64
%192 = trunc i64 %191 to i32
%193 = call i32 @unit_test_int(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.33, i64 0, i64 0), i32 0, i32 %192)
ret i32 undef
}