#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*/ crearIPC();
int /*<<< orphan*/ execl(char *, char *, char *);
scalar_t__ fork();
int /*<<< orphan*/ perror(char *);
main(int argc, char **argv) {
  crearIPC();
  if (fork() == 0) {
    execl("./cajero", "./cajero", (char *)NULL);
    perror("Exec fallo");
    return -1;
  }
  if (fork() == 0) {
    execl("./heladero", "./heladero", (char *)NULL);
    perror("Exec fallo");
    return -1;
  }
  if (fork() == 0) {
    execl("./heladero", "./heladero", (char *)NULL);
    perror("Exec fallo");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <crearIPC@plt>
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%rax
jne    1199 <main+0x59>
lea    0xe8b(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1050 <execl@plt>
lea    0xe81(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1218 <main+0xd8>
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%rax
jne    11d5 <main+0x95>
lea    0xe63(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1050 <execl@plt>
lea    0xe45(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1218 <main+0xd8>
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%rax
jne    1211 <main+0xd1>
lea    0xe27(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   1050 <execl@plt>
lea    0xe09(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1218 <main+0xd8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <crearIPC@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     117b <main+0x3b>
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     1172 <main+0x32>
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     1172 <main+0x32>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xe9b(%rip),%rdi
jmp    1182 <main+0x42>
lea    0xe7e(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   1050 <execl@plt>
lea    0xe76(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%ebx
jmp    116e <main+0x2e>

LLVM IR (-O0):
@.str = [9 x i8] c"./cajero\00"
@.str.1 = [11 x i8] c"Exec fallo\00"
@.str.2 = [11 x i8] c"./heladero\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @crearIPC()
%7 = call i64 (...) @fork()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @execl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* null)
%11 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %25
12: ; preds = %2
%13 = call i64 (...) @fork()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @execl(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* null)
%17 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %25
18: ; preds = %12
%19 = call i64 (...) @fork()
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @execl(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* null)
%23 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %25
24: ; preds = %18
store i32 0, i32* %3
br label %25
25: ; preds = %24, %21, %15, %9
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [9 x i8] c"./cajero\00"
@.str.1 = [11 x i8] c"Exec fallo\00"
@.str.2 = [11 x i8] c"./heladero\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @crearIPC()
%4 = tail call i64 (...) @fork()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @execl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* null)
br label %18
8: ; preds = %2
%9 = tail call i64 (...) @fork()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @execl(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* null)
br label %18
13: ; preds = %8
%14 = tail call i64 (...) @fork()
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = tail call i32 @execl(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* null)
br label %18
18: ; preds = %6, %11, %16
%19 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %13
%21 = phi i32 [ 0, %13 ], [ -1, %18 ]
ret i32 %21
}