#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 */

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fils(int);
int fork();
int /*<<< orphan*/ pere();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
void main(int argc, char *argv[]) {
  int Nbre_de_Proc, i_fils, pid_fils;
  if (argc != 2) {
    printf(" Utilisation : %s nbre-de-processus ! \n", argv[0]);
    exit(2);
  }
  Nbre_de_Proc = atoi(argv[1]);
  for (i_fils = 1; i_fils <= Nbre_de_Proc; i_fils++) {
    pid_fils = fork();
    switch (pid_fils) {
    case 0:
      fils(i_fils);
      break;
    case -1:
      perror("Le fork n'a pas reussi ");
      exit(33);
    }
  }
  pere();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     11a6 <main+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     122d <main+0xbd>
xor    %eax,%eax
call   1090 <fork@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0xffffffff,%eax
je     1204 <main+0x94>
jmp    11e7 <main+0x77>
mov    -0x20(%rbp),%eax
test   %eax,%eax
jne    121a <main+0xaa>
jmp    11f7 <main+0x87>
mov    -0x18(%rbp),%edi
call   1080 <fils@plt>
jmp    121a <main+0xaa>
lea    0xe1d(%rip),%rdi
call   1050 <perror@plt>
mov    $0x21,%edi
call   1070 <exit@plt>
jmp    121f <main+0xaf>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11bd <main+0x4d>
mov    $0x0,%al
call   1040 <pere@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11ee <main+0x7e>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jle    11e0 <main+0x70>
mov    %eax,%r14d
neg    %r14d
mov    $0x1,%ebx
jmp    11ba <main+0x4a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1080 <fils@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     11e0 <main+0x70>
xor    %eax,%eax
call   1090 <fork@plt>
test   %eax,%eax
je     11a0 <main+0x30>
cmp    $0xffffffff,%eax
jne    11a7 <main+0x37>
lea    0xe57(%rip),%rdi
call   1050 <perror@plt>
mov    $0x21,%edi
call   1070 <exit@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <pere@plt>
mov    (%rsi),%rsi
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c" Utilisation : %s nbre-de-processus ! \0A\00"
@.str.1 = [24 x i8] c"Le fork n'a pas reussi \00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 2)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %5
store i32 1, i32* %6
br label %21
21: ; preds = %35, %16
%22 = load i32, i32* %6
%23 = load i32, i32* %5
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %38
25: ; preds = %21
%26 = call i32 (...) @fork()
store i32 %26, i32* %7
%27 = load i32, i32* %7
switch i32 %27, label %34 [
i32 0, label %28
i32 -1, label %31
]
28: ; preds = %25
%29 = load i32, i32* %6
%30 = call i32 @fils(i32 %29)
br label %34
31: ; preds = %25
%32 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 33)
unreachable
34: ; preds = %25, %28
br label %35
35: ; preds = %34
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %21
38: ; preds = %21
%39 = call i32 (...) @pere()
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c" Utilisation : %s nbre-de-processus ! \0A\00"
@.str.1 = [24 x i8] c"Le fork n'a pas reussi \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp slt i32 %11, 1
br i1 %12, label %24, label %13
13: ; preds = %8, %21
%14 = phi i32 [ %22, %21 ], [ 1, %8 ]
%15 = tail call i32 (...) @fork()
switch i32 %15, label %21 [
i32 0, label %16
i32 -1, label %18
]
16: ; preds = %13
%17 = tail call i32 @fils(i32 %14)
br label %21
18: ; preds = %13
%19 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @exit(i32 33)
unreachable
21: ; preds = %16, %13
%22 = add nuw i32 %14, 1
%23 = icmp eq i32 %14, %11
br i1 %23, label %24, label %13
24: ; preds = %21, %8
%25 = tail call i32 (...) @pere()
ret void
}