#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 /*<<< orphan*/ bombTimer(int);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ perror(char *);
void makeChildren(unsigned int nbChild) {
  int pid;
  for (unsigned int i = 0; i < nbChild; ++i) {
    pid = fork();
    switch (pid) {
    case -1:
      perror("Erreur au niveau du fork\n");
      exit(1);
      break;
    case 0:
      bombTimer(10);
      exit(0);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<makeChildren>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    11c6 <makeChildren+0x86>
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xffffffff,%eax
je     118c <makeChildren+0x4c>
jmp    117c <makeChildren+0x3c>
mov    -0x10(%rbp),%eax
test   %eax,%eax
je     11a2 <makeChildren+0x62>
jmp    11b3 <makeChildren+0x73>
lea    0xe6d(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    $0xa,%edi
call   1040 <bombTimer@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    11b8 <makeChildren+0x78>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <makeChildren+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeChildren>:
push   %rbx
test   %edi,%edi
je     1165 <makeChildren+0x25>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     1167 <makeChildren+0x27>
cmp    $0xffffffff,%eax
je     1178 <makeChildren+0x38>
add    $0xffffffff,%ebx
jne    1150 <makeChildren+0x10>
pop    %rbx
ret
mov    $0xa,%edi
call   1040 <bombTimer@plt>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xe81(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Erreur au niveau du fork\0A\00"
define void @makeChildren(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
br label %5
5: ; preds = %19, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %2
%8 = icmp ult i32 %6, %7
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = call i32 (...) @fork()
store i32 %10, i32* %3
%11 = load i32, i32* %3
switch i32 %11, label %18 [
i32 -1, label %12
i32 0, label %15
]
12: ; preds = %9
%13 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %9
%16 = call i32 @bombTimer(i32 10)
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %9
br label %19
19: ; preds = %18
%20 = load i32, i32* %4
%21 = add i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Erreur au niveau du fork\0A\00"
define void @makeChildren(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %13, %1
ret void
4: ; preds = %1, %13
%5 = phi i32 [ %14, %13 ], [ 0, %1 ]
%6 = tail call i32 (...) @fork()
switch i32 %6, label %13 [
i32 -1, label %7
i32 0, label %10
]
7: ; preds = %4
%8 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4
%11 = tail call i32 @bombTimer(i32 10)
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %4
%14 = add nuw i32 %5, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %3, label %4
}