#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*/ child_fcn();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ parent_fcn();
int sched_fork();
int /*<<< orphan*/ sched_nice(int);
int /*<<< orphan*/ stderr;
void init_fcn() {
  int i;
  for (i = -2; i < 2; ++i) {
    switch (sched_fork()) {
    case -1:
      fprintf(stderr, "Error in sched_fork\n");
      break;
    case 0:
      sched_nice(i * 10);
      child_fcn();
    }
  }
  parent_fcn();
}


x86 assembly (clang, -O0):
<init_fcn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xfffffffe,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    11d0 <init_fcn+0x80>
xor    %eax,%eax
call   1070 <sched_fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0xffffffff,%eax
je     1193 <init_fcn+0x43>
jmp    1183 <init_fcn+0x33>
mov    -0x8(%rbp),%eax
test   %eax,%eax
je     11ad <init_fcn+0x5d>
jmp    11bd <init_fcn+0x6d>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11bd <init_fcn+0x6d>
imul   $0xa,-0x4(%rbp),%edi
call   1030 <sched_nice@plt>
mov    $0x0,%al
call   1060 <child_fcn@plt>
jmp    11c2 <init_fcn+0x72>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <init_fcn+0xf>
mov    $0x0,%al
call   1050 <parent_fcn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_fcn>:
push   %rax
xor    %eax,%eax
call   1070 <sched_fork@plt>
test   %eax,%eax
je     1178 <init_fcn+0x28>
cmp    $0xffffffff,%eax
jne    1189 <init_fcn+0x39>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1189 <init_fcn+0x39>
mov    $0xffffffec,%edi
call   1030 <sched_nice@plt>
xor    %eax,%eax
call   1060 <child_fcn@plt>
xor    %eax,%eax
call   1070 <sched_fork@plt>
cmp    $0xffffffff,%eax
je     11ac <init_fcn+0x5c>
test   %eax,%eax
jne    11c1 <init_fcn+0x71>
mov    $0xfffffff6,%edi
call   1030 <sched_nice@plt>
xor    %eax,%eax
call   1060 <child_fcn@plt>
jmp    11c1 <init_fcn+0x71>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1070 <sched_fork@plt>
cmp    $0xffffffff,%eax
je     11e1 <init_fcn+0x91>
test   %eax,%eax
jne    11f6 <init_fcn+0xa6>
xor    %edi,%edi
call   1030 <sched_nice@plt>
xor    %eax,%eax
call   1060 <child_fcn@plt>
jmp    11f6 <init_fcn+0xa6>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xe0f(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1070 <sched_fork@plt>
cmp    $0xffffffff,%eax
je     1219 <init_fcn+0xc9>
test   %eax,%eax
jne    122e <init_fcn+0xde>
mov    $0xa,%edi
call   1030 <sched_nice@plt>
xor    %eax,%eax
call   1060 <child_fcn@plt>
jmp    122e <init_fcn+0xde>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
lea    0xdd7(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <parent_fcn@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Error in sched_fork\0A\00"
define void @init_fcn() {
%1 = alloca i32
store i32 -2, i32* %1
br label %2
2: ; preds = %16, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 2
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = call i32 (...) @sched_fork()
switch i32 %6, label %15 [
i32 -1, label %7
i32 0, label %10
]
7: ; preds = %5
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %15
10: ; preds = %5
%11 = load i32, i32* %1
%12 = mul nsw i32 %11, 10
%13 = call i32 @sched_nice(i32 %12)
%14 = call i32 (...) @child_fcn()
br label %15
15: ; preds = %10, %5, %7
br label %16
16: ; preds = %15
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
br label %2
19: ; preds = %2
%20 = call i32 (...) @parent_fcn()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Error in sched_fork\0A\00"
define void @init_fcn() {
%1 = tail call i32 (...) @sched_fork()
switch i32 %1, label %8 [
i32 -1, label %2
i32 0, label %5
]
2: ; preds = %0
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = tail call i32 @sched_nice(i32 -20)
%7 = tail call i32 (...) @child_fcn()
br label %8
8: ; preds = %2, %0, %5
%9 = tail call i32 (...) @sched_fork()
switch i32 %9, label %16 [
i32 -1, label %13
i32 0, label %10
]
10: ; preds = %8
%11 = tail call i32 @sched_nice(i32 -10)
%12 = tail call i32 (...) @child_fcn()
br label %16
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %13, %10, %8
%17 = tail call i32 (...) @sched_fork()
switch i32 %17, label %24 [
i32 -1, label %21
i32 0, label %18
]
18: ; preds = %16
%19 = tail call i32 @sched_nice(i32 0)
%20 = tail call i32 (...) @child_fcn()
br label %24
21: ; preds = %16
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %21, %18, %16
%25 = tail call i32 (...) @sched_fork()
switch i32 %25, label %32 [
i32 -1, label %29
i32 0, label %26
]
26: ; preds = %24
%27 = tail call i32 @sched_nice(i32 10)
%28 = tail call i32 (...) @child_fcn()
br label %32
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %29, %26, %24
%33 = tail call i32 (...) @parent_fcn()
ret void
}