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

/* Variables and functions */
int EOF;
int EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int close(int);
int errno;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ memset(void *, int /*<<< orphan*/, size_t);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read(int, void *, size_t);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int wait(int *);
int main(int argc, char **argv) {
  int error = 0;
  int fprintf_return = 0;
  int file_to_read = 0;
  int fgetc_return = 0;
  int close_return = 0;
  int wait_status = 0;
  FILE *file_to_fread = NULL;
  pid_t wait_return = NULL;
  pid_t fork_return = NULL;
  ssize_t read_return = 0;
  unsigned char read_buffer[1 + 1] = "";
  if (argc != 3) {
    fprintf_return = fprintf(
        stdout, "Usage: %s <option: -p -c> <fichier a lire> \n", argv[0]);
    if (fprintf_return < 0) {
      perror("Error fprintf");
      return fprintf_return;
    }
    return -1;
  }
  read_buffer[1 + 1] = '\0';
  if (strcmp(argv[1], "-p") == 0) {
    file_to_read = open(argv[2], O_RDONLY);
    if (file_to_read == -1) {
      error = errno;
      perror("Error open");
      return error;
    }
    fork_return = fork();
    if (fork_return == -1) {
      error = errno;
      perror("Error fork");
      return error;
    }
    if (fork_return == 0) {
      fork_return = fork();
      if (fork_return == -1) {
        error = errno;
        perror("Error fork");
        return error;
      }
      if (fork_return == 0) {
        while ((read_return =
                    read(file_to_read,
                         (void *)memset((void *)read_buffer, 0, (size_t)1),
                         (size_t)1)) != 0) {
          if (read_return == -1) {
            error = errno;
            perror("Error read");
            return error;
          }
          fprintf_return = fprintf(stdout, "Petit fils chaine lue: %s \n",
                                   (unsigned char *)read_buffer);
          if (fprintf_return < 0) {
            perror("Error fprintf");
            return fprintf_return;
          }
        }
        return 0;
      }
      while (
          (read_return = read(file_to_read,
                              (void *)memset((void *)read_buffer, 0, (size_t)1),
                              (size_t)1)) != 0) {
        if (read_return == -1) {
          error = errno;
          perror("Error read");
          return error;
        }
        fprintf_return = fprintf(stdout, "Fils, chaine lue: %s \n",
                                 (unsigned char *)read_buffer);
        if (fprintf_return < 0) {
          perror("Error fprintf");
          return fprintf_return;
        }
      }
      wait_return = wait(&wait_status);
      if (wait_return == -1) {
        error = errno;
        perror("Error wait");
        return error;
      }
      return 0;
    }
    while ((read_return = read(
                file_to_read, (void *)memset((void *)read_buffer, 0, (size_t)1),
                (size_t)1)) != 0) {
      if (read_return == -1) {
        error = errno;
        perror("Error read");
        return error;
      }
      fprintf_return = fprintf(stdout, "Pere, chaine lue: %s \n",
                               (unsigned char *)read_buffer);
      if (fprintf_return < 0) {
        perror("Error fprintf");
        return fprintf_return;
      }
    }
    close_return = close(file_to_read);
    if (close_return == -1) {
      error = errno;
      perror("Error close");
      return error;
    }
  }
  if (strcmp(argv[1], "-c") == 0) {
    file_to_fread = fopen(argv[2], "r");
    if (file_to_fread == NULL) {
      error = errno;
      perror("Error open");
      return error;
    }
    fork_return = fork();
    if (fork_return == -1) {
      error = errno;
      perror("Error fork");
      return error;
    }
    if (fork_return == 0) {
      fork_return = fork();
      if (fork_return == -1) {
        error = errno;
        perror("Error fork");
        return error;
      }
      if (fork_return == 0) {
        while ((fgetc_return = fgetc(file_to_fread)) != EOF) {
          fprintf_return = fprintf(stdout, "Petit fils, Caractere lu: %c \n",
                                   (unsigned char)fgetc_return);
          if (fprintf_return < 0) {
            perror("Error fprintf");
            return fprintf_return;
          }
        }
        return 0;
      }
      while ((fgetc_return = fgetc(file_to_fread)) != EOF) {
        fprintf_return = fprintf(stdout, "Fils, caractere lu: %c \n",
                                 (unsigned char)fgetc_return);
        if (fprintf_return < 0) {
          perror("Error fprintf");
          return fprintf_return;
        }
      }
      wait_return = wait(&wait_status);
      if (wait_return == -1) {
        error = errno;
        perror("Error wait");
        return error;
      }
      return 0;
    }
    while ((fgetc_return = fgetc(file_to_fread)) != EOF) {
      fprintf_return = fprintf(stdout, "Pere, caractere lu: %c \n",
                               (unsigned char)fgetc_return);
      if (fprintf_return < 0) {
        perror("Error fprintf");
        return fprintf_return;
      }
    }
    close_return = close(file_to_read);
    if (close_return == -1) {
      error = errno;
      perror("Error close");
      return error;
    }
  }
  wait_return = wait(&wait_status);
  if (wait_return == -1) {
    error = errno;
    perror("Error wait");
    return error;
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x3e(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <memset@plt>
cmpl   $0x3,-0x8(%rbp)
je     1275 <main+0xc5>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1269 <main+0xb9>
lea    0xdd4(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
movl   $0xffffffff,-0x4(%rbp)
jmp    18d0 <main+0x720>
movb   $0x0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb3(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    15e5 <main+0x435>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d42(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12dd <main+0x12d>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xd71(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1314 <main+0x164>
mov    0x2cd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xd45(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
cmpl   $0x0,-0x38(%rbp)
jne    1500 <main+0x350>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1355 <main+0x1a5>
mov    0x2c97(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xd04(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
cmpl   $0x0,-0x38(%rbp)
jne    1413 <main+0x263>
jmp    1364 <main+0x1b4>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x3e(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
je     1407 <main+0x257>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    13c3 <main+0x213>
mov    0x2c29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xca1(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
mov    0x2bfe(%rip),%rax
mov    (%rax),%edi
lea    -0x3e(%rbp),%rdx
lea    0xc88(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1402 <main+0x252>
lea    0xc3b(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1364 <main+0x1b4>
movl   $0x0,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1418 <main+0x268>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x3e(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
mov    -0x48(%rbp),%edi
mov    %rax,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
je     14bb <main+0x30b>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1477 <main+0x2c7>
mov    0x2b75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xbed(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
mov    0x2b4a(%rip),%rax
mov    (%rax),%edi
lea    -0x3e(%rbp),%rdx
lea    0xbf0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    14b6 <main+0x306>
lea    0xb87(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1418 <main+0x268>
lea    -0x28(%rbp),%rdi
call   10c0 <wait@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    14f4 <main+0x344>
mov    0x2af8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xbae(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
movl   $0x0,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1505 <main+0x355>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
lea    -0x3e(%rbp),%rdi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <memset@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
je     15a8 <main+0x3f8>
cmpl   $0xffffffff,-0x3c(%rbp)
jne    1564 <main+0x3b4>
mov    0x2a88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xb00(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
mov    0x2a5d(%rip),%rax
mov    (%rax),%edi
lea    -0x3e(%rbp),%rdx
lea    0xb25(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    15a3 <main+0x3f3>
lea    0xa9a(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1505 <main+0x355>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    15e0 <main+0x430>
mov    0x2a0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xae4(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    15e5 <main+0x435>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xacc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    188b <main+0x6db>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xab1(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1649 <main+0x499>
mov    0x29a3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0xa05(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1680 <main+0x4d0>
mov    0x296c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0x9d9(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
cmpl   $0x0,-0x38(%rbp)
jne    17e8 <main+0x638>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    16c1 <main+0x511>
mov    0x292b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0x998(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
cmpl   $0x0,-0x38(%rbp)
jne    173d <main+0x58d>
jmp    16d0 <main+0x520>
mov    -0x30(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    0x28fd(%rip),%rcx
cmp    (%rcx),%eax
je     1731 <main+0x581>
mov    0x28d6(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%eax
movzbl %al,%edx
lea    0x9c4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    172c <main+0x57c>
lea    0x911(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    16d0 <main+0x520>
movl   $0x0,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1742 <main+0x592>
mov    -0x30(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    0x288b(%rip),%rcx
cmp    (%rcx),%eax
je     17a3 <main+0x5f3>
mov    0x2864(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%eax
movzbl %al,%edx
lea    0x971(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    179e <main+0x5ee>
lea    0x89f(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    1742 <main+0x592>
lea    -0x28(%rbp),%rdi
call   10c0 <wait@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    17dc <main+0x62c>
mov    0x2810(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0x8c6(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
movl   $0x0,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    17ed <main+0x63d>
mov    -0x30(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x20(%rbp)
mov    0x27e0(%rip),%rcx
cmp    (%rcx),%eax
je     184e <main+0x69e>
mov    0x27b9(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%eax
movzbl %al,%edx
lea    0x8df(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1849 <main+0x699>
lea    0x7f4(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    17ed <main+0x63d>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1886 <main+0x6d6>
mov    0x2766(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0x83e(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
jmp    188b <main+0x6db>
lea    -0x28(%rbp),%rdi
call   10c0 <wait@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    18c4 <main+0x714>
mov    0x2728(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
lea    0x7de(%rip),%rdi
call   10b0 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    18d0 <main+0x720>
mov    0x26f5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
movl   $0x0,0x4(%rsp)
movw   $0x0,0x2(%rsp)
cmp    $0x3,%edi
jne    1226 <main+0x76>
movb   $0x0,0x4(%rsp)
mov    0x8(%r15),%rdi
lea    0xe59(%rip),%rsi
call   1070 <strcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     125e <main+0xae>
mov    0x8(%r15),%rdi
lea    0xec6(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12fa <main+0x14a>
lea    0x4(%rsp),%rdi
call   10c0 <wait@plt>
cmp    $0xffffffff,%eax
je     147a <main+0x2ca>
mov    0x2d9e(%rip),%rax
mov    (%rax),%ebp
jmp    124d <main+0x9d>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xdc7(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
js     1586 <main+0x3d6>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%r15),%rdi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     159b <main+0x3eb>
mov    %eax,%r14d
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     137a <main+0x1ca>
cmp    $0xffffffff,%eax
je     15b5 <main+0x405>
lea    0x2(%rsp),%rbx
mov    0x2d28(%rip),%r13
lea    0xdf6(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x1,%edx
mov    %r14d,%edi
mov    %rax,%rsi
call   1060 <read@plt>
test   %eax,%eax
je     13fa <main+0x24a>
cmp    $0xffffffff,%eax
je     15cf <main+0x41f>
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %eax,%eax
jns    12b0 <main+0x100>
jmp    1527 <main+0x377>
mov    0x10(%r15),%rdi
lea    0xdbe(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     159b <main+0x3eb>
mov    %rax,%r12
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     1410 <main+0x260>
cmp    $0xffffffff,%eax
je     15b5 <main+0x405>
mov    0x2cab(%rip),%rbx
mov    0x2c8c(%rip),%r13
lea    0xdba(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1040 <fgetc@plt>
cmp    (%rbx),%eax
je     1494 <main+0x2e4>
mov    0x0(%r13),%edi
movzbl %al,%edx
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %eax,%eax
jns    1350 <main+0x1a0>
jmp    1527 <main+0x377>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     14bf <main+0x30f>
cmp    $0xffffffff,%eax
je     15b5 <main+0x405>
lea    0x2(%rsp),%rbx
mov    0x2c2a(%rip),%r12
lea    0xcd6(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x1,%edx
mov    %r14d,%edi
mov    %rax,%rsi
call   1060 <read@plt>
test   %eax,%eax
je     1465 <main+0x2b5>
cmp    $0xffffffff,%eax
je     15cf <main+0x41f>
mov    (%r12),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %eax,%eax
jns    13b0 <main+0x200>
jmp    1527 <main+0x377>
mov    %r14d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
jne    11ef <main+0x3f>
jmp    14a5 <main+0x2f5>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     153a <main+0x38a>
cmp    $0xffffffff,%eax
je     15b5 <main+0x405>
mov    0x2bb1(%rip),%rbx
mov    0x2b92(%rip),%r15
lea    0xca7(%rip),%r14
nopl   (%rax)
mov    %r12,%rdi
call   1040 <fgetc@plt>
cmp    (%rbx),%eax
je     1465 <main+0x2b5>
mov    (%r15),%edi
movzbl %al,%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %eax,%eax
jns    1440 <main+0x290>
jmp    1527 <main+0x377>
lea    0x4(%rsp),%rdi
call   10c0 <wait@plt>
xor    %ebp,%ebp
cmp    $0xffffffff,%eax
jne    124d <main+0x9d>
mov    0x2b4f(%rip),%rax
mov    (%rax),%ebp
lea    0xc08(%rip),%rdi
call   10b0 <perror@plt>
jmp    124d <main+0x9d>
mov    %r14d,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
jne    1208 <main+0x58>
mov    0x2b24(%rip),%rax
mov    (%rax),%ebp
lea    0xbff(%rip),%rdi
call   10b0 <perror@plt>
jmp    124d <main+0x9d>
lea    0x2(%rsp),%rbx
mov    0x2afd(%rip),%r12
lea    0xb8d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    $0x1,%edx
mov    %r14d,%edi
mov    %rax,%rsi
call   1060 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
je     124d <main+0x9d>
cmp    $0xffffffff,%ebp
je     15cf <main+0x41f>
mov    (%r12),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %eax,%eax
jns    14e0 <main+0x330>
mov    %eax,%ebp
lea    0xafd(%rip),%rdi
call   10b0 <perror@plt>
jmp    124d <main+0x9d>
mov    0x2a9f(%rip),%r15
mov    0x2a80(%rip),%r13
lea    0xb76(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%eax
je     124d <main+0x9d>
mov    0x0(%r13),%edi
movzbl %al,%edx
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
test   %eax,%eax
jns    1560 <main+0x3b0>
mov    %eax,%ebx
lea    0xa9e(%rip),%rdi
call   10b0 <perror@plt>
mov    %ebx,%ebp
jmp    124d <main+0x9d>
mov    0x2a2e(%rip),%rax
mov    (%rax),%ebp
lea    0xa93(%rip),%rdi
call   10b0 <perror@plt>
jmp    124d <main+0x9d>
mov    0x2a14(%rip),%rax
mov    (%rax),%ebp
lea    0xa84(%rip),%rdi
call   10b0 <perror@plt>
jmp    124d <main+0x9d>
mov    0x29fa(%rip),%rax
mov    (%rax),%ebp
lea    0xa75(%rip),%rdi
call   10b0 <perror@plt>
jmp    124d <main+0x9d>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [45 x i8] c"Usage: %s <option: -p -c> <fichier a lire> \0A\00"
@.str.1 = [14 x i8] c"Error fprintf\00"
@.str.2 = [3 x i8] c"-p\00"
@O_RDONLY = global i32 0
@errno = global i32 0
@.str.3 = [11 x i8] c"Error open\00"
@.str.4 = [11 x i8] c"Error fork\00"
@.str.5 = [11 x i8] c"Error read\00"
@.str.6 = [28 x i8] c"Petit fils chaine lue: %s \0A\00"
@.str.7 = [23 x i8] c"Fils, chaine lue: %s \0A\00"
@.str.8 = [11 x i8] c"Error wait\00"
@.str.9 = [23 x i8] c"Pere, chaine lue: %s \0A\00"
@.str.10 = [12 x i8] c"Error close\00"
@.str.11 = [3 x i8] c"-c\00"
@.str.12 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.13 = [31 x i8] c"Petit fils, Caractere lu: %c \0A\00"
@.str.14 = [25 x i8] c"Fils, caractere lu: %c \0A\00"
@.str.15 = [25 x i8] c"Pere, caractere lu: %c \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [2 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32* null, i32** %12
store i32 0, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
%17 = bitcast [2 x i8]* %16 to i8*
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 3
br i1 %19, label %20, label %32
20: ; preds = %2
%21 = load i32, i32* @stdout
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %7
store i32 %30, i32* %3
br label %291
31: ; preds = %20
store i32 -1, i32* %3
br label %291
32: ; preds = %2
%33 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 2
store i8 0, i8* %33
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %168
39: ; preds = %32
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = load i32, i32* @O_RDONLY
%44 = call i32 @open(i8* %42, i32 %43)
store i32 %44, i32* %8
%45 = load i32, i32* %8
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %51
47: ; preds = %39
%48 = load i32, i32* @errno
store i32 %48, i32* %6
%49 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%50 = load i32, i32* %6
store i32 %50, i32* %3
br label %291
51: ; preds = %39
%52 = call i32 (...) @fork()
store i32 %52, i32* %14
%53 = load i32, i32* %14
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %59
55: ; preds = %51
%56 = load i32, i32* @errno
store i32 %56, i32* %6
%57 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%58 = load i32, i32* %6
store i32 %58, i32* %3
br label %291
59: ; preds = %51
%60 = load i32, i32* %14
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %133
62: ; preds = %59
%63 = call i32 (...) @fork()
store i32 %63, i32* %14
%64 = load i32, i32* %14
%65 = icmp eq i32 %64, -1
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = load i32, i32* @errno
store i32 %67, i32* %6
%68 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%69 = load i32, i32* %6
store i32 %69, i32* %3
br label %291
70: ; preds = %62
%71 = load i32, i32* %14
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %99
73: ; preds = %70
br label %74
74: ; preds = %97, %73
%75 = load i32, i32* %8
%76 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%77 = call i64 @memset(i8* %76, i32 0, i64 1)
%78 = inttoptr i64 %77 to i8*
%79 = call i32 @read(i32 %75, i8* %78, i64 1)
store i32 %79, i32* %15
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %98
81: ; preds = %74
%82 = load i32, i32* %15
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %88
84: ; preds = %81
%85 = load i32, i32* @errno
store i32 %85, i32* %6
%86 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%87 = load i32, i32* %6
store i32 %87, i32* %3
br label %291
88: ; preds = %81
%89 = load i32, i32* @stdout
%90 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %90)
store i32 %91, i32* %7
%92 = load i32, i32* %7
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %88
%95 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%96 = load i32, i32* %7
store i32 %96, i32* %3
br label %291
97: ; preds = %88
br label %74
98: ; preds = %74
store i32 0, i32* %3
br label %291
99: ; preds = %70
br label %100
100: ; preds = %123, %99
%101 = load i32, i32* %8
%102 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%103 = call i64 @memset(i8* %102, i32 0, i64 1)
%104 = inttoptr i64 %103 to i8*
%105 = call i32 @read(i32 %101, i8* %104, i64 1)
store i32 %105, i32* %15
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %124
107: ; preds = %100
%108 = load i32, i32* %15
%109 = icmp eq i32 %108, -1
br i1 %109, label %110, label %114
110: ; preds = %107
%111 = load i32, i32* @errno
store i32 %111, i32* %6
%112 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%113 = load i32, i32* %6
store i32 %113, i32* %3
br label %291
114: ; preds = %107
%115 = load i32, i32* @stdout
%116 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%117 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %116)
store i32 %117, i32* %7
%118 = load i32, i32* %7
%119 = icmp slt i32 %118, 0
br i1 %119, label %120, label %123
120: ; preds = %114
%121 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%122 = load i32, i32* %7
store i32 %122, i32* %3
br label %291
123: ; preds = %114
br label %100
124: ; preds = %100
%125 = call i32 @wait(i32* %11)
store i32 %125, i32* %13
%126 = load i32, i32* %13
%127 = icmp eq i32 %126, -1
br i1 %127, label %128, label %132
128: ; preds = %124
%129 = load i32, i32* @errno
store i32 %129, i32* %6
%130 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%131 = load i32, i32* %6
store i32 %131, i32* %3
br label %291
132: ; preds = %124
store i32 0, i32* %3
br label %291
133: ; preds = %59
br label %134
134: ; preds = %157, %133
%135 = load i32, i32* %8
%136 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%137 = call i64 @memset(i8* %136, i32 0, i64 1)
%138 = inttoptr i64 %137 to i8*
%139 = call i32 @read(i32 %135, i8* %138, i64 1)
store i32 %139, i32* %15
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %158
141: ; preds = %134
%142 = load i32, i32* %15
%143 = icmp eq i32 %142, -1
br i1 %143, label %144, label %148
144: ; preds = %141
%145 = load i32, i32* @errno
store i32 %145, i32* %6
%146 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%147 = load i32, i32* %6
store i32 %147, i32* %3
br label %291
148: ; preds = %141
%149 = load i32, i32* @stdout
%150 = getelementptr inbounds [2 x i8], [2 x i8]* %16, i64 0, i64 0
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %150)
store i32 %151, i32* %7
%152 = load i32, i32* %7
%153 = icmp slt i32 %152, 0
br i1 %153, label %154, label %157
154: ; preds = %148
%155 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%156 = load i32, i32* %7
store i32 %156, i32* %3
br label %291
157: ; preds = %148
br label %134
158: ; preds = %134
%159 = load i32, i32* %8
%160 = call i32 @close(i32 %159)
store i32 %160, i32* %10
%161 = load i32, i32* %10
%162 = icmp eq i32 %161, -1
br i1 %162, label %163, label %167
163: ; preds = %158
%164 = load i32, i32* @errno
store i32 %164, i32* %6
%165 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%166 = load i32, i32* %6
store i32 %166, i32* %3
br label %291
167: ; preds = %158
br label %168
168: ; preds = %167, %32
%169 = load i8**, i8*** %5
%170 = getelementptr inbounds i8*, i8** %169, i64 1
%171 = load i8*, i8** %170
%172 = call i64 @strcmp(i8* %171, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%173 = icmp eq i64 %172, 0
br i1 %173, label %174, label %281
174: ; preds = %168
%175 = load i8**, i8*** %5
%176 = getelementptr inbounds i8*, i8** %175, i64 2
%177 = load i8*, i8** %176
%178 = call i32* @fopen(i8* %177, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32* %178, i32** %12
%179 = load i32*, i32** %12
%180 = icmp eq i32* %179, null
br i1 %180, label %181, label %185
181: ; preds = %174
%182 = load i32, i32* @errno
store i32 %182, i32* %6
%183 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%184 = load i32, i32* %6
store i32 %184, i32* %3
br label %291
185: ; preds = %174
%186 = call i32 (...) @fork()
store i32 %186, i32* %14
%187 = load i32, i32* %14
%188 = icmp eq i32 %187, -1
br i1 %188, label %189, label %193
189: ; preds = %185
%190 = load i32, i32* @errno
store i32 %190, i32* %6
%191 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%192 = load i32, i32* %6
store i32 %192, i32* %3
br label %291
193: ; preds = %185
%194 = load i32, i32* %14
%195 = icmp eq i32 %194, 0
br i1 %195, label %196, label %253
196: ; preds = %193
%197 = call i32 (...) @fork()
store i32 %197, i32* %14
%198 = load i32, i32* %14
%199 = icmp eq i32 %198, -1
br i1 %199, label %200, label %204
200: ; preds = %196
%201 = load i32, i32* @errno
store i32 %201, i32* %6
%202 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%203 = load i32, i32* %6
store i32 %203, i32* %3
br label %291
204: ; preds = %196
%205 = load i32, i32* %14
%206 = icmp eq i32 %205, 0
br i1 %206, label %207, label %226
207: ; preds = %204
br label %208
208: ; preds = %224, %207
%209 = load i32*, i32** %12
%210 = call i32 @fgetc(i32* %209)
store i32 %210, i32* %9
%211 = load i32, i32* @EOF
%212 = icmp ne i32 %210, %211
br i1 %212, label %213, label %225
213: ; preds = %208
%214 = load i32, i32* @stdout
%215 = load i32, i32* %9
%216 = trunc i32 %215 to i8
%217 = zext i8 %216 to i32
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %214, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i32 %217)
store i32 %218, i32* %7
%219 = load i32, i32* %7
%220 = icmp slt i32 %219, 0
br i1 %220, label %221, label %224
221: ; preds = %213
%222 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%223 = load i32, i32* %7
store i32 %223, i32* %3
br label %291
224: ; preds = %213
br label %208
225: ; preds = %208
store i32 0, i32* %3
br label %291
226: ; preds = %204
br label %227
227: ; preds = %243, %226
%228 = load i32*, i32** %12
%229 = call i32 @fgetc(i32* %228)
store i32 %229, i32* %9
%230 = load i32, i32* @EOF
%231 = icmp ne i32 %229, %230
br i1 %231, label %232, label %244
232: ; preds = %227
%233 = load i32, i32* @stdout
%234 = load i32, i32* %9
%235 = trunc i32 %234 to i8
%236 = zext i8 %235 to i32
%237 = call i32 (i32, i8*, ...) @fprintf(i32 %233, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), i32 %236)
store i32 %237, i32* %7
%238 = load i32, i32* %7
%239 = icmp slt i32 %238, 0
br i1 %239, label %240, label %243
240: ; preds = %232
%241 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%242 = load i32, i32* %7
store i32 %242, i32* %3
br label %291
243: ; preds = %232
br label %227
244: ; preds = %227
%245 = call i32 @wait(i32* %11)
store i32 %245, i32* %13
%246 = load i32, i32* %13
%247 = icmp eq i32 %246, -1
br i1 %247, label %248, label %252
248: ; preds = %244
%249 = load i32, i32* @errno
store i32 %249, i32* %6
%250 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%251 = load i32, i32* %6
store i32 %251, i32* %3
br label %291
252: ; preds = %244
store i32 0, i32* %3
br label %291
253: ; preds = %193
br label %254
254: ; preds = %270, %253
%255 = load i32*, i32** %12
%256 = call i32 @fgetc(i32* %255)
store i32 %256, i32* %9
%257 = load i32, i32* @EOF
%258 = icmp ne i32 %256, %257
br i1 %258, label %259, label %271
259: ; preds = %254
%260 = load i32, i32* @stdout
%261 = load i32, i32* %9
%262 = trunc i32 %261 to i8
%263 = zext i8 %262 to i32
%264 = call i32 (i32, i8*, ...) @fprintf(i32 %260, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0), i32 %263)
store i32 %264, i32* %7
%265 = load i32, i32* %7
%266 = icmp slt i32 %265, 0
br i1 %266, label %267, label %270
267: ; preds = %259
%268 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%269 = load i32, i32* %7
store i32 %269, i32* %3
br label %291
270: ; preds = %259
br label %254
271: ; preds = %254
%272 = load i32, i32* %8
%273 = call i32 @close(i32 %272)
store i32 %273, i32* %10
%274 = load i32, i32* %10
%275 = icmp eq i32 %274, -1
br i1 %275, label %276, label %280
276: ; preds = %271
%277 = load i32, i32* @errno
store i32 %277, i32* %6
%278 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%279 = load i32, i32* %6
store i32 %279, i32* %3
br label %291
280: ; preds = %271
br label %281
281: ; preds = %280, %168
%282 = call i32 @wait(i32* %11)
store i32 %282, i32* %13
%283 = load i32, i32* %13
%284 = icmp eq i32 %283, -1
br i1 %284, label %285, label %289
285: ; preds = %281
%286 = load i32, i32* @errno
store i32 %286, i32* %6
%287 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%288 = load i32, i32* %6
store i32 %288, i32* %3
br label %291
289: ; preds = %281
%290 = load i32, i32* @EXIT_SUCCESS
store i32 %290, i32* %3
br label %291
291: ; preds = %289, %285, %276, %267, %252, %248, %240, %225, %221, %200, %189, %181, %163, %154, %144, %132, %128, %120, %110, %98, %94, %84, %66, %55, %47, %31, %28
%292 = load i32, i32* %3
ret i32 %292
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [45 x i8] c"Usage: %s <option: -p -c> <fichier a lire> \0A\00"
@.str.1 = [14 x i8] c"Error fprintf\00"
@.str.2 = [3 x i8] c"-p\00"
@O_RDONLY = global i32 0
@errno = global i32 0
@.str.3 = [11 x i8] c"Error open\00"
@.str.4 = [11 x i8] c"Error fork\00"
@.str.5 = [11 x i8] c"Error read\00"
@.str.6 = [28 x i8] c"Petit fils chaine lue: %s \0A\00"
@.str.7 = [23 x i8] c"Fils, chaine lue: %s \0A\00"
@.str.8 = [11 x i8] c"Error wait\00"
@.str.9 = [23 x i8] c"Pere, chaine lue: %s \0A\00"
@.str.10 = [12 x i8] c"Error close\00"
@.str.11 = [3 x i8] c"-c\00"
@.str.12 = [2 x i8] c"r\00"
@EOF = global i32 0
@.str.13 = [31 x i8] c"Petit fils, Caractere lu: %c \0A\00"
@.str.14 = [25 x i8] c"Fils, caractere lu: %c \0A\00"
@.str.15 = [25 x i8] c"Pere, caractere lu: %c \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i16
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast i16* %4 to i8*
store i16 0, i16* %4
%7 = icmp eq i32 %0, 3
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = load i32, i32* @stdout
%10 = load i8*, i8** %1
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %168
13: ; preds = %8
%14 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
15: ; preds = %2
%16 = getelementptr inbounds i16, i16* %4, i64 1
%17 = bitcast i16* %16 to i8*
store i8 0, i8* %17
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %92
22: ; preds = %15
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = load i32, i32* @O_RDONLY
%26 = tail call i32 @open(i8* %24, i32 %25)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = load i32, i32* @errno
%30 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %168
31: ; preds = %22
%32 = tail call i32 (...) @fork()
switch i32 %32, label %73 [
i32 -1, label %33
i32 0, label %36
]
33: ; preds = %31
%34 = load i32, i32* @errno
%35 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %168
36: ; preds = %31
%37 = tail call i32 (...) @fork()
switch i32 %37, label %54 [
i32 -1, label %38
i32 0, label %41
]
38: ; preds = %36
%39 = load i32, i32* @errno
%40 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %168
41: ; preds = %36, %48
%42 = call i64 @memset(i8* %6, i32 0, i64 1)
%43 = inttoptr i64 %42 to i8*
%44 = call i32 @read(i32 %26, i8* %43, i64 1)
switch i32 %44, label %48 [
i32 0, label %168
i32 -1, label %45
]
45: ; preds = %41
%46 = load i32, i32* @errno
%47 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %168
48: ; preds = %41
%49 = load i32, i32* @stdout
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i16* %4)
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %41
52: ; preds = %48
%53 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
54: ; preds = %36, %61
%55 = call i64 @memset(i8* %6, i32 0, i64 1)
%56 = inttoptr i64 %55 to i8*
%57 = call i32 @read(i32 %26, i8* %56, i64 1)
switch i32 %57, label %61 [
i32 0, label %67
i32 -1, label %58
]
58: ; preds = %54
%59 = load i32, i32* @errno
%60 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %168
61: ; preds = %54
%62 = load i32, i32* @stdout
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i16* %4)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %54
65: ; preds = %61
%66 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
67: ; preds = %54
%68 = call i32 @wait(i32* %3)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %168
70: ; preds = %67
%71 = load i32, i32* @errno
%72 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %168
73: ; preds = %31, %80
%74 = call i64 @memset(i8* %6, i32 0, i64 1)
%75 = inttoptr i64 %74 to i8*
%76 = call i32 @read(i32 %26, i8* %75, i64 1)
switch i32 %76, label %80 [
i32 0, label %86
i32 -1, label %77
]
77: ; preds = %73
%78 = load i32, i32* @errno
%79 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %168
80: ; preds = %73
%81 = load i32, i32* @stdout
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i16* %4)
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %73
84: ; preds = %80
%85 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
86: ; preds = %73
%87 = call i32 @close(i32 %26)
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %92
89: ; preds = %86
%90 = load i32, i32* @errno
%91 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %168
92: ; preds = %86, %15
%93 = phi i32 [ %26, %86 ], [ 0, %15 ]
%94 = load i8*, i8** %18
%95 = call i64 @strcmp(i8* %94, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %160
97: ; preds = %92
%98 = getelementptr inbounds i8*, i8** %1, i64 2
%99 = load i8*, i8** %98
%100 = call i32* @fopen(i8* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%101 = icmp eq i32* %100, null
br i1 %101, label %102, label %105
102: ; preds = %97
%103 = load i32, i32* @errno
%104 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %168
105: ; preds = %97
%106 = call i32 (...) @fork()
switch i32 %106, label %143 [
i32 -1, label %107
i32 0, label %110
]
107: ; preds = %105
%108 = load i32, i32* @errno
%109 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %168
110: ; preds = %105
%111 = call i32 (...) @fork()
switch i32 %111, label %126 [
i32 -1, label %112
i32 0, label %115
]
112: ; preds = %110
%113 = load i32, i32* @errno
%114 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %168
115: ; preds = %110, %119
%116 = call i32 @fgetc(i32* %100)
%117 = load i32, i32* @EOF
%118 = icmp eq i32 %116, %117
br i1 %118, label %168, label %119
119: ; preds = %115
%120 = load i32, i32* @stdout
%121 = and i32 %116, 255
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i32 %121)
%123 = icmp slt i32 %122, 0
br i1 %123, label %124, label %115
124: ; preds = %119
%125 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
126: ; preds = %110, %130
%127 = call i32 @fgetc(i32* %100)
%128 = load i32, i32* @EOF
%129 = icmp eq i32 %127, %128
br i1 %129, label %137, label %130
130: ; preds = %126
%131 = load i32, i32* @stdout
%132 = and i32 %127, 255
%133 = call i32 (i32, i8*, ...) @fprintf(i32 %131, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.14, i64 0, i64 0), i32 %132)
%134 = icmp slt i32 %133, 0
br i1 %134, label %135, label %126
135: ; preds = %130
%136 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
137: ; preds = %126
%138 = call i32 @wait(i32* %3)
%139 = icmp eq i32 %138, -1
br i1 %139, label %140, label %168
140: ; preds = %137
%141 = load i32, i32* @errno
%142 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %168
143: ; preds = %105, %147
%144 = call i32 @fgetc(i32* %100)
%145 = load i32, i32* @EOF
%146 = icmp eq i32 %144, %145
br i1 %146, label %154, label %147
147: ; preds = %143
%148 = load i32, i32* @stdout
%149 = and i32 %144, 255
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.15, i64 0, i64 0), i32 %149)
%151 = icmp slt i32 %150, 0
br i1 %151, label %152, label %143
152: ; preds = %147
%153 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %168
154: ; preds = %143
%155 = call i32 @close(i32 %93)
%156 = icmp eq i32 %155, -1
br i1 %156, label %157, label %160
157: ; preds = %154
%158 = load i32, i32* @errno
%159 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
br label %168
160: ; preds = %154, %92
%161 = call i32 @wait(i32* %3)
%162 = icmp eq i32 %161, -1
br i1 %162, label %163, label %166
163: ; preds = %160
%164 = load i32, i32* @errno
%165 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %168
166: ; preds = %160
%167 = load i32, i32* @EXIT_SUCCESS
br label %168
168: ; preds = %41, %115, %137, %67, %8, %166, %163, %157, %152, %140, %135, %124, %112, %107, %102, %89, %84, %77, %70, %65, %58, %52, %45, %38, %33, %28, %13
%169 = phi i32 [ %11, %13 ], [ %29, %28 ], [ %34, %33 ], [ %39, %38 ], [ %46, %45 ], [ %50, %52 ], [ %59, %58 ], [ %63, %65 ], [ %71, %70 ], [ %78, %77 ], [ %82, %84 ], [ %90, %89 ], [ %103, %102 ], [ %108, %107 ], [ %113, %112 ], [ %122, %124 ], [ %133, %135 ], [ %141, %140 ], [ %150, %152 ], [ %158, %157 ], [ %164, %163 ], [ %167, %166 ], [ -1, %8 ], [ 0, %67 ], [ 0, %137 ], [ 0, %115 ], [ %44, %41 ]
ret i32 %169
}