#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*/ execl(char *, char *, char *, char *, int /*<<< orphan*/ *);
int fork();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ wait(int *);
int main(int argc, char **argv) {
  int status;
  printf("Création d'un fils\n");
  int ret = fork();
  if (ret == 0) {
    execl("/home/pascalfares/add", "addhehe", "3", "4", NULL);
    printf("Ne viendra jamais ici\n");
  }
  printf("Attendre le fils\n");
  wait(&status);
  printf("status = %d\n", status);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11ac <main+0x6c>
lea    0xe96(%rip),%rdi
lea    0xea5(%rip),%rsi
lea    0xea6(%rip),%rdx
lea    0xea1(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <execl@plt>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rdi
call   1050 <wait@plt>
mov    -0x14(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
jne    1198 <main+0x48>
lea    0xe91(%rip),%rdi
lea    0xea0(%rip),%rsi
lea    0xea1(%rip),%rdx
lea    0xe9c(%rip),%rcx
xor    %r8d,%r8d
call   1050 <execl@plt>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
call   1060 <wait@plt>
mov    0x4(%rsp),%esi
lea    0xe69(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Cr\C3\A9ation d'un fils\0A\00"
@.str.1 = [22 x i8] c"/home/pascalfares/add\00"
@.str.2 = [8 x i8] c"addhehe\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.5 = [23 x i8] c"Ne viendra jamais ici\0A\00"
@.str.6 = [18 x i8] c"Attendre le fils\0A\00"
@.str.7 = [13 x i8] c"status = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @fork()
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @execl(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* null)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %15
15: ; preds = %12, %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @wait(i32* %6)
%18 = load i32, i32* %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"/home/pascalfares/add\00"
@.str.2 = [8 x i8] c"addhehe\00"
@.str.3 = [2 x i8] c"3\00"
@.str.4 = [2 x i8] c"4\00"
@.str.7 = [13 x i8] c"status = %d\0A\00"
@str = [20 x i8] c"Cr\C3\A9ation d'un fils\00"
@str.8 = [17 x i8] c"Attendre le fils\00"
@str.9 = [22 x i8] c"Ne viendra jamais ici\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @fork()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @execl(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* null)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
br label %11
11: ; preds = %8, %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.8, i64 0, i64 0))
%13 = call i32 @wait(i32* %3)
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %14)
ret i32 0
}