#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;
struct TYPE_3__ {
  scalar_t__ si_signo;
  int si_pid;
};
typedef TYPE_1__ siginfo_t;
typedef int pid_t;

/* Variables and functions */
scalar_t__ EBUSY;
int EXIT_FAILURE;
int /*<<< orphan*/ RB_AUTOBOOT;
int /*<<< orphan*/ RB_POWER_OFF;
scalar_t__ SIGCHLD;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ SIGTERM;
scalar_t__ SIGUSR1;
scalar_t__ SIGUSR2;
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ _PATH_DEV;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int kill(int, int /*<<< orphan*/);
int mount(char *, int /*<<< orphan*/, char *, unsigned long,
          int /*<<< orphan*/ *);
int /*<<< orphan*/ reboot(int /*<<< orphan*/);
int sigaddset(int /*<<< orphan*/ *, scalar_t__);
int sigemptyset(int /*<<< orphan*/ *);
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int sigwaitinfo(int /*<<< orphan*/ *, TYPE_1__ *);
int /*<<< orphan*/ sleep(int);
int start_child();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ sync();
scalar_t__ vfork();
int waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  sigset_t mask;
  siginfo_t sig;
  pid_t child;
  int ret;
  if (1 != argc) {
    (void)fprintf(stderr, "Usage: %s\n", argv[0]);
    goto end;
  }
  if (-1 == mount("dev", _PATH_DEV, "devtmpfs", 0UL, NULL)) {
    if (EBUSY != errno)
      goto end;
  }
  if (-1 == sigemptyset(&mask))
    goto end;
  if (-1 == sigaddset(&mask, SIGUSR1))
    goto end;
  if (-1 == sigaddset(&mask, SIGUSR2))
    goto end;
  if (-1 == sigaddset(&mask, SIGCHLD))
    goto end;
  if (-1 == sigprocmask(SIG_SETMASK, &mask, NULL))
    goto end;
  sig.si_signo = SIGUSR2;
  child = start_child();
  if (-1 == child)
    goto shutdown;
  do {
    if (-1 == sigwaitinfo(&mask, &sig))
      break;
    if (SIGCHLD != sig.si_signo)
      break;
    if (sig.si_pid != waitpid(sig.si_pid, NULL, WNOHANG))
      break;
    if (child == sig.si_pid)
      break;
  } while (1);
shutdown:
  ret = kill(-1, SIGTERM);
  (void)sleep(2);
  if (0 == ret)
    (void)kill(-1, SIGKILL);
  sync();
  if (0 == vfork()) {
    if (SIGUSR1 == sig.si_signo)
      (void)reboot(RB_POWER_OFF);
    else
      (void)reboot(RB_AUTOBOOT);
  }
end:
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     1215 <main+0x45>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf5(%rip),%rsi
call   1060 <fprintf@plt>
jmp    1482 <main+0x2b2>
mov    0x2db4(%rip),%rax
mov    (%rax),%esi
lea    0xde6(%rip),%rdi
lea    0xde3(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1050 <mount@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    126c <main+0x9c>
mov    0x2d31(%rip),%rax
mov    (%rax),%rax
mov    0x2d3f(%rip),%rcx
cmp    (%rcx),%rax
je     1267 <main+0x97>
jmp    1482 <main+0x2b2>
jmp    126c <main+0x9c>
lea    -0x14(%rbp),%rdi
call   1070 <sigemptyset@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1289 <main+0xb9>
jmp    1482 <main+0x2b2>
mov    0x2d50(%rip),%rax
mov    (%rax),%rsi
lea    -0x14(%rbp),%rdi
call   10f0 <sigaddset@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    12b0 <main+0xe0>
jmp    1482 <main+0x2b2>
mov    0x2ce9(%rip),%rax
mov    (%rax),%rsi
lea    -0x14(%rbp),%rdi
call   10f0 <sigaddset@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    12d7 <main+0x107>
jmp    1482 <main+0x2b2>
mov    0x2cda(%rip),%rax
mov    (%rax),%rsi
lea    -0x14(%rbp),%rdi
call   10f0 <sigaddset@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    12fe <main+0x12e>
jmp    1482 <main+0x2b2>
mov    0x2cbb(%rip),%rax
mov    (%rax),%edi
lea    -0x14(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1328 <main+0x158>
jmp    1482 <main+0x2b2>
mov    0x2c71(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <start_child@plt>
mov    %eax,-0x2c(%rbp)
mov    $0xffffffff,%eax
cmp    -0x2c(%rbp),%eax
jne    1353 <main+0x183>
jmp    13e9 <main+0x219>
jmp    1358 <main+0x188>
lea    -0x14(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <sigwaitinfo@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1379 <main+0x1a9>
jmp    13e4 <main+0x214>
mov    0x2c38(%rip),%rax
mov    (%rax),%rax
cmp    -0x28(%rbp),%rax
je     1392 <main+0x1c2>
jmp    13e4 <main+0x214>
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%edi
mov    0x2c26(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <waitpid@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
je     13bf <main+0x1ef>
jmp    13e4 <main+0x214>
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    13d0 <main+0x200>
jmp    13e4 <main+0x214>
jmp    13d5 <main+0x205>
mov    $0x1,%al
test   $0x1,%al
jne    1358 <main+0x188>
jmp    13e4 <main+0x214>
jmp    13e9 <main+0x219>
mov    0x2be8(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
call   1080 <kill@plt>
mov    %eax,-0x30(%rbp)
mov    $0x2,%edi
call   10e0 <sleep@plt>
xor    %eax,%eax
cmp    -0x30(%rbp),%eax
jne    1427 <main+0x257>
mov    0x2b6d(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
call   1080 <kill@plt>
mov    $0x0,%al
call   10a0 <sync@plt>
mov    $0x0,%al
call   10c0 <vfork@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    147d <main+0x2ad>
mov    0x2b96(%rip),%rax
mov    (%rax),%rax
cmp    -0x28(%rbp),%rax
jne    146a <main+0x29a>
mov    0x2b92(%rip),%rax
mov    (%rax),%edi
call   10d0 <reboot@plt>
jmp    1478 <main+0x2a8>
mov    0x2b07(%rip),%rax
mov    (%rax),%edi
call   10d0 <reboot@plt>
jmp    147d <main+0x2ad>
jmp    1482 <main+0x2b2>
mov    0x2b07(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x1,%edi
jne    1379 <main+0x1a9>
mov    0x2de2(%rip),%rax
mov    (%rax),%esi
lea    0xe14(%rip),%rdi
lea    0xe11(%rip),%rdx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <mount@plt>
cmp    $0xffffffff,%eax
jne    1227 <main+0x57>
mov    0x2d6c(%rip),%rax
mov    (%rax),%rax
mov    0x2d7a(%rip),%rcx
cmp    (%rcx),%rax
jne    1391 <main+0x1c1>
lea    0x4(%rsp),%rdi
call   1070 <sigemptyset@plt>
cmp    $0xffffffff,%eax
je     1391 <main+0x1c1>
mov    0x2d9f(%rip),%rax
mov    (%rax),%rsi
lea    0x4(%rsp),%rdi
call   10f0 <sigaddset@plt>
cmp    $0xffffffff,%eax
je     1391 <main+0x1c1>
mov    0x2d42(%rip),%rbx
mov    (%rbx),%rsi
lea    0x4(%rsp),%rdi
call   10f0 <sigaddset@plt>
cmp    $0xffffffff,%eax
je     1391 <main+0x1c1>
mov    0x2d3d(%rip),%r13
mov    0x0(%r13),%rsi
lea    0x4(%rsp),%rdi
call   10f0 <sigaddset@plt>
cmp    $0xffffffff,%eax
je     1391 <main+0x1c1>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
cmp    $0xffffffff,%eax
je     1391 <main+0x1c1>
mov    (%rbx),%rax
mov    %rax,0x8(%rsp)
xor    %eax,%eax
call   1040 <start_child@plt>
cmp    $0xffffffff,%eax
je     1316 <main+0x146>
mov    %eax,%ebx
lea    0x4(%rsp),%r14
lea    0x8(%rsp),%r15
mov    0x2cf1(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <sigwaitinfo@plt>
cmp    $0xffffffff,%eax
je     1316 <main+0x146>
mov    0x0(%r13),%rax
cmp    0x8(%rsp),%rax
jne    1316 <main+0x146>
mov    0x10(%rsp),%ebp
mov    (%r12),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   10b0 <waitpid@plt>
cmp    %eax,%ebp
jne    1316 <main+0x146>
cmp    0x10(%rsp),%ebx
jne    12e0 <main+0x110>
mov    0x2cbb(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
call   1080 <kill@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   10e0 <sleep@plt>
test   %ebx,%ebx
jne    134c <main+0x17c>
mov    0x2c48(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
call   1080 <kill@plt>
xor    %eax,%eax
call   10a0 <sync@plt>
xor    %eax,%eax
call   10c0 <vfork@plt>
test   %rax,%rax
mov    0x2c7c(%rip),%rax
jne    1391 <main+0x1c1>
mov    (%rax),%rax
cmp    0x8(%rsp),%rax
jne    13a9 <main+0x1d9>
mov    0x2c79(%rip),%rax
jmp    13b0 <main+0x1e0>
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xc74(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2bf8(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bc8(%rip),%rax
mov    (%rax),%edi
call   10d0 <reboot@plt>
jmp    1391 <main+0x1c1>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i32 }
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
@.str.1 = [4 x i8] c"dev\00"
@_PATH_DEV = global i32 0
@.str.2 = [9 x i8] c"devtmpfs\00"
@EBUSY = global i64 0
@errno = global i64 0
@SIGUSR1 = global i64 0
@SIGUSR2 = global i64 0
@SIGCHLD = global i64 0
@SIG_SETMASK = global i32 0
@WNOHANG = global i32 0
@SIGTERM = global i32 0
@SIGKILL = global i32 0
@RB_POWER_OFF = global i32 0
@RB_AUTOBOOT = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.TYPE_3__
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 1, %10
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %114
18: ; preds = %2
%19 = load i32, i32* @_PATH_DEV
%20 = call i32 @mount(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 0, i32* null)
%21 = icmp eq i32 -1, %20
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = load i64, i64* @EBUSY
%24 = load i64, i64* @errno
%25 = icmp ne i64 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22
br label %114
27: ; preds = %22
br label %28
28: ; preds = %27, %18
%29 = call i32 @sigemptyset(i32* %6)
%30 = icmp eq i32 -1, %29
br i1 %30, label %31, label %32
31: ; preds = %28
br label %114
32: ; preds = %28
%33 = load i64, i64* @SIGUSR1
%34 = call i32 @sigaddset(i32* %6, i64 %33)
%35 = icmp eq i32 -1, %34
br i1 %35, label %36, label %37
36: ; preds = %32
br label %114
37: ; preds = %32
%38 = load i64, i64* @SIGUSR2
%39 = call i32 @sigaddset(i32* %6, i64 %38)
%40 = icmp eq i32 -1, %39
br i1 %40, label %41, label %42
41: ; preds = %37
br label %114
42: ; preds = %37
%43 = load i64, i64* @SIGCHLD
%44 = call i32 @sigaddset(i32* %6, i64 %43)
%45 = icmp eq i32 -1, %44
br i1 %45, label %46, label %47
46: ; preds = %42
br label %114
47: ; preds = %42
%48 = load i32, i32* @SIG_SETMASK
%49 = call i32 @sigprocmask(i32 %48, i32* %6, i32* null)
%50 = icmp eq i32 -1, %49
br i1 %50, label %51, label %52
51: ; preds = %47
br label %114
52: ; preds = %47
%53 = load i64, i64* @SIGUSR2
%54 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
store i64 %53, i64* %54
%55 = call i32 (...) @start_child()
store i32 %55, i32* %8
%56 = load i32, i32* %8
%57 = icmp eq i32 -1, %56
br i1 %57, label %58, label %59
58: ; preds = %52
br label %88
59: ; preds = %52
br label %60
60: ; preds = %86, %59
%61 = call i32 @sigwaitinfo(i32* %6, %struct.TYPE_3__* %7)
%62 = icmp eq i32 -1, %61
br i1 %62, label %63, label %64
63: ; preds = %60
br label %87
64: ; preds = %60
%65 = load i64, i64* @SIGCHLD
%66 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%67 = load i64, i64* %66
%68 = icmp ne i64 %65, %67
br i1 %68, label %69, label %70
69: ; preds = %64
br label %87
70: ; preds = %64
%71 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 1
%72 = load i32, i32* %71
%73 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 1
%74 = load i32, i32* %73
%75 = load i32, i32* @WNOHANG
%76 = call i32 @waitpid(i32 %74, i32* null, i32 %75)
%77 = icmp ne i32 %72, %76
br i1 %77, label %78, label %79
78: ; preds = %70
br label %87
79: ; preds = %70
%80 = load i32, i32* %8
%81 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 1
%82 = load i32, i32* %81
%83 = icmp eq i32 %80, %82
br i1 %83, label %84, label %85
84: ; preds = %79
br label %87
85: ; preds = %79
br label %86
86: ; preds = %85
br i1 true, label %60, label %87
87: ; preds = %86, %84, %78, %69, %63
br label %88
88: ; preds = %87, %58
%89 = load i32, i32* @SIGTERM
%90 = call i32 @kill(i32 -1, i32 %89)
store i32 %90, i32* %9
%91 = call i32 @sleep(i32 2)
%92 = load i32, i32* %9
%93 = icmp eq i32 0, %92
br i1 %93, label %94, label %97
94: ; preds = %88
%95 = load i32, i32* @SIGKILL
%96 = call i32 @kill(i32 -1, i32 %95)
br label %97
97: ; preds = %94, %88
%98 = call i32 (...) @sync()
%99 = call i64 (...) @vfork()
%100 = icmp eq i64 0, %99
br i1 %100, label %101, label %113
101: ; preds = %97
%102 = load i64, i64* @SIGUSR1
%103 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %7, i32 0, i32 0
%104 = load i64, i64* %103
%105 = icmp eq i64 %102, %104
br i1 %105, label %106, label %109
106: ; preds = %101
%107 = load i32, i32* @RB_POWER_OFF
%108 = call i32 @reboot(i32 %107)
br label %112
109: ; preds = %101
%110 = load i32, i32* @RB_AUTOBOOT
%111 = call i32 @reboot(i32 %110)
br label %112
112: ; preds = %109, %106
br label %113
113: ; preds = %112, %97
br label %114
114: ; preds = %113, %51, %46, %41, %36, %31, %26, %12
%115 = load i32, i32* @EXIT_FAILURE
ret i32 %115
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64, i32 }
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
@.str.1 = [4 x i8] c"dev\00"
@_PATH_DEV = global i32 0
@.str.2 = [9 x i8] c"devtmpfs\00"
@EBUSY = global i64 0
@errno = global i64 0
@SIGUSR1 = global i64 0
@SIGUSR2 = global i64 0
@SIGCHLD = global i64 0
@SIG_SETMASK = global i32 0
@WNOHANG = global i32 0
@SIGTERM = global i32 0
@SIGKILL = global i32 0
@RB_POWER_OFF = global i32 0
@RB_AUTOBOOT = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.TYPE_3__
%5 = bitcast i32* %3 to i8*
%6 = bitcast %struct.TYPE_3__* %4 to i8*
%7 = icmp eq i32 %0, 1
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %83
12: ; preds = %2
%13 = load i32, i32* @_PATH_DEV
%14 = tail call i32 @mount(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 0, i32* null)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i64, i64* @EBUSY
%18 = load i64, i64* @errno
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %83
20: ; preds = %16, %12
%21 = call i32 @sigemptyset(i32* %3)
%22 = icmp eq i32 %21, -1
br i1 %22, label %83, label %23
23: ; preds = %20
%24 = load i64, i64* @SIGUSR1
%25 = call i32 @sigaddset(i32* %3, i64 %24)
%26 = icmp eq i32 %25, -1
br i1 %26, label %83, label %27
27: ; preds = %23
%28 = load i64, i64* @SIGUSR2
%29 = call i32 @sigaddset(i32* %3, i64 %28)
%30 = icmp eq i32 %29, -1
br i1 %30, label %83, label %31
31: ; preds = %27
%32 = load i64, i64* @SIGCHLD
%33 = call i32 @sigaddset(i32* %3, i64 %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %83, label %35
35: ; preds = %31
%36 = load i32, i32* @SIG_SETMASK
%37 = call i32 @sigprocmask(i32 %36, i32* %3, i32* null)
%38 = icmp eq i32 %37, -1
br i1 %38, label %83, label %39
39: ; preds = %35
%40 = load i64, i64* @SIGUSR2
%41 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 0
store i64 %40, i64* %41
%42 = call i32 (...) @start_child()
%43 = icmp eq i32 %42, -1
br i1 %43, label %61, label %44
44: ; preds = %39
%45 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i64 0, i32 1
br label %46
46: ; preds = %44, %53
%47 = call i32 @sigwaitinfo(i32* %3, %struct.TYPE_3__* %4)
%48 = icmp eq i32 %47, -1
br i1 %48, label %61, label %49
49: ; preds = %46
%50 = load i64, i64* @SIGCHLD
%51 = load i64, i64* %41
%52 = icmp eq i64 %50, %51
br i1 %52, label %53, label %61
53: ; preds = %49
%54 = load i32, i32* %45
%55 = load i32, i32* @WNOHANG
%56 = call i32 @waitpid(i32 %54, i32* null, i32 %55)
%57 = icmp ne i32 %54, %56
%58 = load i32, i32* %45
%59 = icmp eq i32 %42, %58
%60 = select i1 %57, i1 true, i1 %59
br i1 %60, label %61, label %46
61: ; preds = %46, %49, %53, %39
%62 = load i32, i32* @SIGTERM
%63 = call i32 @kill(i32 -1, i32 %62)
%64 = call i32 @sleep(i32 2)
%65 = icmp eq i32 %63, 0
br i1 %65, label %66, label %69
66: ; preds = %61
%67 = load i32, i32* @SIGKILL
%68 = call i32 @kill(i32 -1, i32 %67)
br label %69
69: ; preds = %66, %61
%70 = call i32 (...) @sync()
%71 = call i64 (...) @vfork()
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %83
73: ; preds = %69
%74 = load i64, i64* @SIGUSR1
%75 = load i64, i64* %41
%76 = icmp eq i64 %74, %75
br i1 %76, label %77, label %80
77: ; preds = %73
%78 = load i32, i32* @RB_POWER_OFF
%79 = call i32 @reboot(i32 %78)
br label %83
80: ; preds = %73
%81 = load i32, i32* @RB_AUTOBOOT
%82 = call i32 @reboot(i32 %81)
br label %83
83: ; preds = %69, %80, %77, %35, %31, %27, %23, %20, %16, %8
%84 = load i32, i32* @EXIT_FAILURE
ret i32 %84
}