#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);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ install_signal_handlers();
scalar_t__ pause();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ wait_for_ready_children(int);
int main(int argc, char *argv[]) {
  int nproc;
  nproc = 0;
  wait_for_ready_children(nproc);
  install_signal_handlers();
  if (nproc == 0) {
    fprintf(stderr, "Scheduler: No tasks. Exiting...\n");
    exit(1);
  }
  while (pause())
    ;
  fprintf(stderr, "Internal error: Reached unreachable point\n");
  return 1;
}


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)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <wait_for_ready_children@plt>
mov    $0x0,%al
call   1050 <install_signal_handlers@plt>
cmpl   $0x0,-0x14(%rbp)
jne    11a5 <main+0x55>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
lea    0xe6a(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    11aa <main+0x5a>
mov    $0x0,%al
call   1060 <pause@plt>
cmp    $0x0,%rax
je     11c0 <main+0x70>
jmp    11aa <main+0x5a>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <wait_for_ready_children@plt>
xor    %eax,%eax
call   1050 <install_signal_handlers@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Scheduler: No tasks. Exiting...\0A\00"
@.str.1 = [43 x i8] c"Internal error: Reached unreachable point\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %6
%8 = call i32 @wait_for_ready_children(i32 %7)
%9 = call i32 (...) @install_signal_handlers()
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
br label %17
17: ; preds = %20, %16
%18 = call i64 (...) @pause()
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
br label %17
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Scheduler: No tasks. Exiting...\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @wait_for_ready_children(i32 0)
%4 = tail call i32 (...) @install_signal_handlers()
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
}