#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*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ marker();
int vfork();
int main(void) {
  int pid;
  pid = vfork();
  if (pid == -1) {
    return 1;
  } else if (pid != 0) {
  } else {
    _exit(0);
  }
  pid = vfork();
  if (pid == -1) {
    return 1;
  } else if (pid != 0) {
  } else {
    _exit(0);
  }
  pid = vfork();
  if (pid == -1) {
    return 1;
  } else if (pid != 0) {
  } else {
    _exit(0);
  }
  marker();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
call   1040 <vfork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    115d <main+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xc8>
cmpl   $0x0,-0x8(%rbp)
je     116c <main+0x3c>
jmp    1173 <main+0x43>
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    1178 <main+0x48>
call   1040 <vfork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1196 <main+0x66>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xc8>
cmpl   $0x0,-0x8(%rbp)
je     11a5 <main+0x75>
jmp    11ac <main+0x7c>
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    11b1 <main+0x81>
call   1040 <vfork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    11cf <main+0x9f>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xc8>
cmpl   $0x0,-0x8(%rbp)
je     11de <main+0xae>
jmp    11e5 <main+0xb5>
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    11ea <main+0xba>
mov    $0x0,%al
call   1050 <marker@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%ebx
call   1040 <vfork@plt>
cmp    $0xffffffff,%eax
je     1169 <main+0x39>
test   %eax,%eax
je     116d <main+0x3d>
call   1040 <vfork@plt>
cmp    $0xffffffff,%eax
je     1169 <main+0x39>
test   %eax,%eax
je     116d <main+0x3d>
call   1040 <vfork@plt>
cmp    $0xffffffff,%eax
je     1169 <main+0x39>
test   %eax,%eax
je     116d <main+0x3d>
xor    %ebx,%ebx
mov    %ebx,%eax
call   1050 <marker@plt>
mov    %ebx,%eax
pop    %rbx
ret
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @vfork()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1, i32* %1
br label %40
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
br label %13
11: ; preds = %7
%12 = call i32 @_exit(i32 0)
unreachable
13: ; preds = %10
br label %14
14: ; preds = %13
%15 = call i32 @vfork()
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 1, i32* %1
br label %40
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
br label %25
23: ; preds = %19
%24 = call i32 @_exit(i32 0)
unreachable
25: ; preds = %22
br label %26
26: ; preds = %25
%27 = call i32 @vfork()
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 1, i32* %1
br label %40
31: ; preds = %26
%32 = load i32, i32* %2
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %31
br label %37
35: ; preds = %31
%36 = call i32 @_exit(i32 0)
unreachable
37: ; preds = %34
br label %38
38: ; preds = %37
%39 = call i32 (...) @marker()
store i32 0, i32* %1
br label %40
40: ; preds = %38, %30, %18, %6
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
define i32 @main() {
%1 = call i32 @vfork()
switch i32 %1, label %4 [
i32 -1, label %14
i32 0, label %2
]
2: ; preds = %0
%3 = call i32 @_exit(i32 0)
unreachable
4: ; preds = %0
%5 = call i32 @vfork()
switch i32 %5, label %8 [
i32 -1, label %14
i32 0, label %6
]
6: ; preds = %4
%7 = call i32 @_exit(i32 0)
unreachable
8: ; preds = %4
%9 = call i32 @vfork()
switch i32 %9, label %12 [
i32 -1, label %14
i32 0, label %10
]
10: ; preds = %8
%11 = call i32 @_exit(i32 0)
unreachable
12: ; preds = %8
%13 = call i32 (...) @marker()
br label %14
14: ; preds = %8, %4, %0, %12
%15 = phi i32 [ 0, %12 ], [ 1, %0 ], [ 1, %4 ], [ 1, %8 ]
ret i32 %15
}