#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*/ atoi(char *);
int /*<<< orphan*/ cliente(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  int pid, i;
  if (argc != 2) {
    printf("forma de uso: %s [sleep time]\n", argv[0]);
  }
  for (i = 0; i < 5; ++i) {
    if ((pid = fork()) < 0) {
      perror("fork");
      return -1;
    } else if (pid == 0) {
      cliente(atoi(argv[1]));
    } else {
    }
  }
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
je     1183 <main+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    11ff <main+0xaf>
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11bf <main+0x6f>
lea    0xe71(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1206 <main+0xb6>
cmpl   $0x0,-0x14(%rbp)
jne    11e2 <main+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <cliente@plt>
jmp    11e7 <main+0x97>
jmp    11e7 <main+0x97>
jmp    11ec <main+0x9c>
jmp    11f1 <main+0xa1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118a <main+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     116a <main+0x1a>
mov    (%rbx),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
js     1203 <main+0xb3>
jne    118b <main+0x3b>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <cliente@plt>
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
js     1203 <main+0xb3>
jne    11a8 <main+0x58>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <cliente@plt>
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
js     1203 <main+0xb3>
jne    11c5 <main+0x75>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <cliente@plt>
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
js     1203 <main+0xb3>
jne    11e2 <main+0x92>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <cliente@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
js     1203 <main+0xb3>
jne    1214 <main+0xc4>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1050 <cliente@plt>
jmp    1214 <main+0xc4>
lea    0xe15(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"forma de uso: %s [sleep time]\0A\00"
@.str.1 = [5 x i8] c"fork\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 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %10, %2
store i32 0, i32* %7
br label %16
16: ; preds = %36, %15
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %39
19: ; preds = %16
%20 = call i32 (...) @fork()
store i32 %20, i32* %6
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %40
24: ; preds = %19
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
%32 = call i32 @cliente(i32 %31)
br label %34
33: ; preds = %24
br label %34
34: ; preds = %33, %27
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %16
39: ; preds = %16
store i32 0, i32* %3
br label %40
40: ; preds = %39, %22
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [31 x i8] c"forma de uso: %s [sleep time]\0A\00"
@.str.1 = [5 x i8] c"fork\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %7
7: ; preds = %4, %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = tail call i32 (...) @fork()
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %46, %37, %28, %19, %7
%12 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %55
13: ; preds = %7
%14 = icmp eq i32 %9, 0
br i1 %14, label %15, label %19
15: ; preds = %13
%16 = load i8*, i8** %8
%17 = tail call i32 @atoi(i8* %16)
%18 = tail call i32 @cliente(i32 %17)
br label %19
19: ; preds = %13, %15
%20 = tail call i32 (...) @fork()
%21 = icmp slt i32 %20, 0
br i1 %21, label %11, label %22
22: ; preds = %19
%23 = icmp eq i32 %20, 0
br i1 %23, label %24, label %28
24: ; preds = %22
%25 = load i8*, i8** %8
%26 = tail call i32 @atoi(i8* %25)
%27 = tail call i32 @cliente(i32 %26)
br label %28
28: ; preds = %24, %22
%29 = tail call i32 (...) @fork()
%30 = icmp slt i32 %29, 0
br i1 %30, label %11, label %31
31: ; preds = %28
%32 = icmp eq i32 %29, 0
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = load i8*, i8** %8
%35 = tail call i32 @atoi(i8* %34)
%36 = tail call i32 @cliente(i32 %35)
br label %37
37: ; preds = %33, %31
%38 = tail call i32 (...) @fork()
%39 = icmp slt i32 %38, 0
br i1 %39, label %11, label %40
40: ; preds = %37
%41 = icmp eq i32 %38, 0
br i1 %41, label %42, label %46
42: ; preds = %40
%43 = load i8*, i8** %8
%44 = tail call i32 @atoi(i8* %43)
%45 = tail call i32 @cliente(i32 %44)
br label %46
46: ; preds = %42, %40
%47 = tail call i32 (...) @fork()
%48 = icmp slt i32 %47, 0
br i1 %48, label %11, label %49
49: ; preds = %46
%50 = icmp eq i32 %47, 0
br i1 %50, label %51, label %55
51: ; preds = %49
%52 = load i8*, i8** %8
%53 = tail call i32 @atoi(i8* %52)
%54 = tail call i32 @cliente(i32 %53)
br label %55
55: ; preds = %49, %51, %11
%56 = phi i32 [ -1, %11 ], [ 0, %51 ], [ 0, %49 ]
ret i32 %56
}