#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 */
typedef scalar_t__ pid_t;

/* Variables and functions */
scalar_t__ fork();
int /*<<< orphan*/ run_adviser();
int /*<<< orphan*/ run_weeder_tfbs(char *, char *, char *, char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
void run_medium_analysis() {
  pid_t pid = fork();
  if (pid == 0)
    run_weeder_tfbs("-W", "6", "-e", "1");
  else {
    wait(NULL);
    pid = fork();
    if (pid == 0)
      run_weeder_tfbs("-W", "8", "-e", "2");
    else {
      wait(NULL);
      pid = fork();
      if (pid == 0)
        run_weeder_tfbs("-W", "10", "-e", "3");
      else
        run_adviser();
    }
  }
}


x86 assembly (clang, -O0):
<run_medium_analysis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <fork@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1184 <run_medium_analysis+0x44>
lea    0xe9b(%rip),%rdi
lea    0xe97(%rip),%rsi
lea    0xe92(%rip),%rdx
lea    0xe8e(%rip),%rcx
call   1030 <run_weeder_tfbs@plt>
jmp    121f <run_medium_analysis+0xdf>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <wait@plt>
mov    $0x0,%al
call   1060 <fork@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11c9 <run_medium_analysis+0x89>
lea    0xe56(%rip),%rdi
lea    0xe59(%rip),%rsi
lea    0xe4d(%rip),%rdx
lea    0xe4d(%rip),%rcx
call   1030 <run_weeder_tfbs@plt>
jmp    121a <run_medium_analysis+0xda>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <wait@plt>
mov    $0x0,%al
call   1060 <fork@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    120e <run_medium_analysis+0xce>
lea    0xe11(%rip),%rdi
lea    0xe18(%rip),%rsi
lea    0xe08(%rip),%rdx
lea    0xe0d(%rip),%rcx
call   1030 <run_weeder_tfbs@plt>
jmp    1215 <run_medium_analysis+0xd5>
mov    $0x0,%al
call   1040 <run_adviser@plt>
jmp    121a <run_medium_analysis+0xda>
jmp    121f <run_medium_analysis+0xdf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_medium_analysis>:
push   %rax
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     117b <run_medium_analysis+0x3b>
xor    %edi,%edi
call   1050 <wait@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     119d <run_medium_analysis+0x5d>
xor    %edi,%edi
call   1050 <wait@plt>
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     11bf <run_medium_analysis+0x7f>
xor    %eax,%eax
pop    %rcx
jmp    1040 <run_adviser@plt>
lea    0xe7e(%rip),%rdi
lea    0xe7a(%rip),%rsi
lea    0xe75(%rip),%rdx
lea    0xe71(%rip),%rcx
pop    %rax
jmp    1030 <run_weeder_tfbs@plt>
lea    0xe5c(%rip),%rdi
lea    0xe5f(%rip),%rsi
lea    0xe53(%rip),%rdx
lea    0xe53(%rip),%rcx
pop    %rax
jmp    1030 <run_weeder_tfbs@plt>
lea    0xe3a(%rip),%rdi
lea    0xe41(%rip),%rsi
lea    0xe31(%rip),%rdx
lea    0xe36(%rip),%rcx
pop    %rax
jmp    1030 <run_weeder_tfbs@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"-W\00"
@.str.1 = [2 x i8] c"6\00"
@.str.2 = [3 x i8] c"-e\00"
@.str.3 = [2 x i8] c"1\00"
@.str.4 = [2 x i8] c"8\00"
@.str.5 = [2 x i8] c"2\00"
@.str.6 = [3 x i8] c"10\00"
@.str.7 = [2 x i8] c"3\00"
define void @run_medium_analysis() {
%1 = tail call i64 (...) @fork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @run_weeder_tfbs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %19
5: ; preds = %0
%6 = tail call i32 @wait(i32* null)
%7 = tail call i64 (...) @fork()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @run_weeder_tfbs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %19
11: ; preds = %5
%12 = tail call i32 @wait(i32* null)
%13 = tail call i64 (...) @fork()
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 @run_weeder_tfbs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = tail call i32 (...) @run_adviser()
br label %19
19: ; preds = %9, %17, %15, %3
ret void
}