#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*/ dup2(int, int);
int /*<<< orphan*/ execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ wait(int *);
int main(int argc, char **argv) {
  int p[2];
  char buffer[10];
  int nbc;
  pipe(p);
  int status;
  if (fork() == 0) {
    dup2(p[1], 1);
    execlp(argv[1], argv[1], NULL);
    exit(1);
  }
  if (fork() == 0) {
    dup2(p[0], 0);
    execlp(argv[2], argv[2], NULL);
    exit(1);
  }
  wait(&status);
  wait(&status);
  printf("Le lanceeur est fini\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <pipe@plt>
mov    $0x0,%al
call   1090 <fork@plt>
cmp    $0x0,%rax
jne    11d0 <main+0x60>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <execlp@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    $0x0,%al
call   1090 <fork@plt>
cmp    $0x0,%rax
jne    120e <main+0x9e>
mov    -0x18(%rbp),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <execlp@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    -0x2c(%rbp),%rdi
call   1080 <wait@plt>
lea    -0x2c(%rbp),%rdi
call   1080 <wait@plt>
lea    0xdd9(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x4(%rsp),%rdi
call   1050 <pipe@plt>
xor    %eax,%eax
call   1090 <fork@plt>
test   %rax,%rax
jne    11a2 <main+0x32>
mov    0x8(%rsp),%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
mov    0x8(%rbx),%rdi
jmp    11bd <main+0x4d>
xor    %eax,%eax
call   1090 <fork@plt>
test   %rax,%rax
jne    11d1 <main+0x61>
mov    0x4(%rsp),%edi
xor    %esi,%esi
call   1040 <dup2@plt>
mov    0x10(%rbx),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1070 <execlp@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <wait@plt>
mov    %rbx,%rdi
call   1080 <wait@plt>
lea    0xe13(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Le lanceeur est fini\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca [10 x i8]
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%11 = call i32 @pipe(i32* %10)
%12 = call i64 (...) @fork()
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %2
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%16 = load i32, i32* %15
%17 = call i32 @dup2(i32 %16, i32 1)
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @execlp(i8* %20, i8* %23, i32* null)
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %2
%27 = call i64 (...) @fork()
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %41
29: ; preds = %26
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%31 = load i32, i32* %30
%32 = call i32 @dup2(i32 %31, i32 0)
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 @execlp(i8* %35, i8* %38, i32* null)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %26
%42 = call i32 @wait(i32* %9)
%43 = call i32 @wait(i32* %9)
%44 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%45 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [21 x i8] c"Le lanceeur est fini\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = bitcast [2 x i32]* %3 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%7 = call i32 @pipe(i32* %6)
%8 = bitcast i32* %4 to i8*
%9 = call i64 (...) @fork()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%13 = load i32, i32* %12
%14 = call i32 @dup2(i32 %13, i32 1)
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @execlp(i8* %16, i8* %16, i32* null)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = call i64 (...) @fork()
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32, i32* %6
%24 = call i32 @dup2(i32 %23, i32 0)
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @execlp(i8* %26, i8* %26, i32* null)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %19
%30 = call i32 @wait(i32* %4)
%31 = call i32 @wait(i32* %4)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%33 = call i32 @exit(i32 0)
unreachable
}