#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*/ test_do_fork_exec(int, char **);
int /*<<< orphan*/ test_do_fork_exec_redirect(int, char **);
int /*<<< orphan*/ test_do_sleep(int, char **);
int /*<<< orphan*/ test_do_write_file(int, char **);
int main(int argc, char *argv[]) {
  if (argc == 2)
    test_do_sleep(argc, argv);
  else if (argc == 3)
    test_do_write_file(argc, argv);
  test_do_fork_exec(argc, argv);
  test_do_fork_exec_redirect(argc, argv);
  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)
cmpl   $0x2,-0x8(%rbp)
jne    1171 <main+0x31>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_do_sleep@plt>
jmp    118c <main+0x4c>
cmpl   $0x3,-0x8(%rbp)
jne    1187 <main+0x47>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <test_do_write_file@plt>
jmp    118c <main+0x4c>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <test_do_fork_exec@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <test_do_fork_exec_redirect@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x3,%edi
je     1161 <main+0x21>
cmp    $0x2,%ebp
jne    116e <main+0x2e>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1030 <test_do_sleep@plt>
jmp    116e <main+0x2e>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1050 <test_do_write_file@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <test_do_fork_exec@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <test_do_fork_exec_redirect@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
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 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @test_do_sleep(i32 %9, i8** %10)
br label %20
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @test_do_write_file(i32 %16, i8** %17)
br label %19
19: ; preds = %15, %12
br label %20
20: ; preds = %19, %8
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @test_do_fork_exec(i32 %21, i8** %22)
%24 = load i32, i32* %4
%25 = load i8**, i8*** %5
%26 = call i32 @test_do_fork_exec_redirect(i32 %24, i8** %25)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
switch i32 %0, label %7 [
i32 2, label %3
i32 3, label %5
]
3: ; preds = %2
%4 = tail call i32 @test_do_sleep(i32 2, i8** %1)
br label %7
5: ; preds = %2
%6 = tail call i32 @test_do_write_file(i32 3, i8** %1)
br label %7
7: ; preds = %2, %5, %3
%8 = tail call i32 @test_do_fork_exec(i32 %0, i8** %1)
%9 = tail call i32 @test_do_fork_exec_redirect(i32 %0, i8** %1)
ret i32 0
}