#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 */
struct utsname {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RB_AUTOBOOT;
int /*<<< orphan*/ enable_logging();
int /*<<< orphan*/ kmod_selftests();
int /*<<< orphan*/ launch_tests();
int /*<<< orphan*/ linux_4_8_or_higher(struct utsname *);
int /*<<< orphan*/ mount_filesystems();
int /*<<< orphan*/ panic(char *);
int /*<<< orphan*/ poweroff();
int /*<<< orphan*/ print_banner(struct utsname *);
int /*<<< orphan*/ reboot(int /*<<< orphan*/);
int /*<<< orphan*/ seed_rng();
scalar_t__ uname(struct utsname *);
scalar_t__ write(int, char *, int);
int main(int argc, char *argv[]) {
  struct utsname utsname;
  if (write(1, "\0\0\0\0\n", 5) < 0)
    reboot(RB_AUTOBOOT);
  if (uname(&utsname) < 0)
    panic("uname");
  print_banner(&utsname);
  mount_filesystems();
  kmod_selftests();
  if (!linux_4_8_or_higher(&utsname))
    seed_rng();
  enable_logging();
  launch_tests();
  poweroff();
  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)
mov    $0x1,%edi
lea    0xe1e(%rip),%rsi
mov    $0x5,%edx
call   1040 <write@plt>
cmp    $0x0,%rax
jge    1204 <main+0x44>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   10d0 <reboot@plt>
lea    -0x18(%rbp),%rdi
call   1070 <uname@plt>
cmp    $0x0,%rax
jge    1223 <main+0x63>
lea    0xde8(%rip),%rdi
call   1080 <panic@plt>
lea    -0x18(%rbp),%rdi
call   10b0 <print_banner@plt>
mov    $0x0,%al
call   1060 <mount_filesystems@plt>
mov    $0x0,%al
call   1050 <kmod_selftests@plt>
lea    -0x18(%rbp),%rdi
call   1030 <linux_4_8_or_higher@plt>
cmp    $0x0,%eax
jne    1253 <main+0x93>
mov    $0x0,%al
call   1090 <seed_rng@plt>
mov    $0x0,%al
call   10e0 <enable_logging@plt>
mov    $0x0,%al
call   10a0 <launch_tests@plt>
mov    $0x0,%al
call   10c0 <poweroff@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe34(%rip),%rsi
mov    $0x1,%edi
mov    $0x5,%edx
call   1040 <write@plt>
test   %rax,%rax
jns    11ee <main+0x2e>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   10d0 <reboot@plt>
lea    0x8(%rsp),%rdi
call   1070 <uname@plt>
test   %rax,%rax
jns    1209 <main+0x49>
lea    0xe02(%rip),%rdi
call   1080 <panic@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <print_banner@plt>
xor    %eax,%eax
call   1060 <mount_filesystems@plt>
xor    %eax,%eax
call   1050 <kmod_selftests@plt>
mov    %rbx,%rdi
call   1030 <linux_4_8_or_higher@plt>
test   %eax,%eax
jne    1237 <main+0x77>
xor    %eax,%eax
call   1090 <seed_rng@plt>
xor    %eax,%eax
call   10e0 <enable_logging@plt>
xor    %eax,%eax
call   10a0 <launch_tests@plt>
xor    %eax,%eax
call   10c0 <poweroff@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.utsname = type { i32 }
@.str = [6 x i8] c"\00\00\00\00\0A\00"
@RB_AUTOBOOT = global i32 0
@.str.1 = [6 x i8] c"uname\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.utsname
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @RB_AUTOBOOT
%11 = call i32 @reboot(i32 %10)
br label %12
12: ; preds = %9, %2
%13 = call i64 @uname(%struct.utsname* %6)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @panic(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %12
%18 = call i32 @print_banner(%struct.utsname* %6)
%19 = call i32 (...) @mount_filesystems()
%20 = call i32 (...) @kmod_selftests()
%21 = call i32 @linux_4_8_or_higher(%struct.utsname* %6)
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %17
%24 = call i32 (...) @seed_rng()
br label %25
25: ; preds = %23, %17
%26 = call i32 (...) @enable_logging()
%27 = call i32 (...) @launch_tests()
%28 = call i32 (...) @poweroff()
ret i32 1
}

LLVM IR (-O2):
%struct.utsname = type { i32 }
@.str = [6 x i8] c"\00\00\00\00\0A\00"
@RB_AUTOBOOT = global i32 0
@.str.1 = [6 x i8] c"uname\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.utsname
%4 = bitcast %struct.utsname* %3 to i8*
%5 = tail call i64 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* @RB_AUTOBOOT
%9 = tail call i32 @reboot(i32 %8)
br label %10
10: ; preds = %7, %2
%11 = call i64 @uname(%struct.utsname* %3)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @panic(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = call i32 @print_banner(%struct.utsname* %3)
%17 = call i32 (...) @mount_filesystems()
%18 = call i32 (...) @kmod_selftests()
%19 = call i32 @linux_4_8_or_higher(%struct.utsname* %3)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = call i32 (...) @seed_rng()
br label %23
23: ; preds = %21, %15
%24 = call i32 (...) @enable_logging()
%25 = call i32 (...) @launch_tests()
%26 = call i32 (...) @poweroff()
ret i32 1
}