#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*/ __boot_app();
int /*<<< orphan*/ bootloader_apply();
scalar_t__ bootloader_buttonpressed();
scalar_t__ bootloader_check();
int /*<<< orphan*/ bootloader_cleanup();
int /*<<< orphan*/ bootloader_download();
int /*<<< orphan*/ bootloader_inithardware();
int /*<<< orphan*/ bootloader_stophardware();
__attribute__((section(".boot.text"))) __attribute__((noreturn)) void
__boot_start(void) {
  bootloader_inithardware();
  if (bootloader_buttonpressed()) {
    bootloader_download();
    while (1)
      ;
  }
  if (bootloader_check()) {
    bootloader_apply();
    bootloader_cleanup();
  }
  bootloader_stophardware();
  __boot_app();
}


x86 assembly (clang, -O0):
<__boot_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <bootloader_inithardware@plt>
mov    $0x0,%al
call   1070 <bootloader_buttonpressed@plt>
cmp    $0x0,%rax
je     11a8 <__boot_start+0x28>
mov    $0x0,%al
call   1040 <bootloader_download@plt>
jmp    11a3 <__boot_start+0x23>
mov    $0x0,%al
call   1030 <bootloader_check@plt>
cmp    $0x0,%rax
je     11c7 <__boot_start+0x47>
mov    $0x0,%al
call   1090 <bootloader_apply@plt>
mov    $0x0,%al
call   10a0 <bootloader_cleanup@plt>
mov    $0x0,%al
call   1060 <bootloader_stophardware@plt>
mov    $0x0,%al
call   1050 <__boot_app@plt>

x86 assembly (clang, -O2):
<__boot_start>:
push   %rax
xor    %eax,%eax
call   1080 <bootloader_inithardware@plt>
xor    %eax,%eax
call   1070 <bootloader_buttonpressed@plt>
test   %rax,%rax
je     11a2 <__boot_start+0x22>
xor    %eax,%eax
call   1040 <bootloader_download@plt>
nopl   0x0(%rax,%rax,1)
jmp    11a0 <__boot_start+0x20>
xor    %eax,%eax
call   1030 <bootloader_check@plt>
test   %rax,%rax
je     11bc <__boot_start+0x3c>
xor    %eax,%eax
call   1090 <bootloader_apply@plt>
xor    %eax,%eax
call   10a0 <bootloader_cleanup@plt>
xor    %eax,%eax
call   1060 <bootloader_stophardware@plt>
xor    %eax,%eax
call   1050 <__boot_app@plt>

LLVM IR (-O0):
define void @__boot_start() section ".boot.text" {
%1 = call i32 (...) @bootloader_inithardware()
%2 = call i64 (...) @bootloader_buttonpressed()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 (...) @bootloader_download()
br label %6
6: ; preds = %4, %6
br label %6
7: ; preds = %0
%8 = call i64 (...) @bootloader_check()
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i32 (...) @bootloader_apply()
%12 = call i32 (...) @bootloader_cleanup()
br label %13
13: ; preds = %10, %7
%14 = call i32 (...) @bootloader_stophardware()
%15 = call i32 (...) @__boot_app()
unreachable
}

LLVM IR (-O2):
define void @__boot_start() section ".boot.text" {
%1 = tail call i32 (...) @bootloader_inithardware()
%2 = tail call i64 (...) @bootloader_buttonpressed()
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 (...) @bootloader_download()
br label %6
6: ; preds = %4, %6
br label %6
7: ; preds = %0
%8 = tail call i64 (...) @bootloader_check()
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 (...) @bootloader_apply()
%12 = tail call i32 (...) @bootloader_cleanup()
br label %13
13: ; preds = %10, %7
%14 = tail call i32 (...) @bootloader_stophardware()
%15 = tail call i32 (...) @__boot_app()
unreachable
}