#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*/ out_char(char);
int /*<<< orphan*/ out_description(char *, unsigned int);
int /*<<< orphan*/ out_string(char *);
int /*<<< orphan*/ reboot();
int /*<<< orphan*/ wait(int);
void __exit(unsigned status) {
  out_char('\n');
  out_description("exit()", status);
  for (unsigned i = 0; i < 16; i++) {
    wait(1000);
    out_char('.');
  }
  out_string("-> OK, reboot now!\n");
  reboot();
}


x86 assembly (clang, -O0):
<__exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xa,%edi
call   1070 <out_char@plt>
mov    -0x4(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1040 <out_description@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jae    11a7 <__exit+0x57>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <__exit+0x2b>
lea    0xe59(%rip),%rdi
call   1030 <out_string@plt>
mov    $0x0,%al
call   1050 <reboot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__exit>:
push   %rbx
mov    %edi,%ebx
mov    $0xa,%edi
call   1070 <out_char@plt>
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
call   1040 <out_description@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
mov    $0x3e8,%edi
call   1060 <wait@plt>
mov    $0x2e,%edi
call   1070 <out_char@plt>
lea    0xd55(%rip),%rdi
call   1030 <out_string@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <reboot@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"exit()\00"
@.str.1 = [20 x i8] c"-> OK, reboot now!\0A\00"
define void @__exit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @out_char(i8 signext 10)
%5 = load i32, i32* %2
%6 = call i32 @out_description(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 0, i32* %3
br label %7
7: ; preds = %13, %1
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 16
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = call i32 @wait(i32 1000)
%12 = call i32 @out_char(i8 signext 46)
br label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = add i32 %14, 1
store i32 %15, i32* %3
br label %7
16: ; preds = %7
%17 = call i32 @out_string(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (...) @reboot()
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"exit()\00"
@.str.1 = [20 x i8] c"-> OK, reboot now!\0A\00"
define void @__exit(i32 %0) {
%2 = tail call i32 @out_char(i8 signext 10)
%3 = tail call i32 @out_description(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @wait(i32 1000)
%5 = tail call i32 @out_char(i8 signext 46)
%6 = tail call i32 @wait(i32 1000)
%7 = tail call i32 @out_char(i8 signext 46)
%8 = tail call i32 @wait(i32 1000)
%9 = tail call i32 @out_char(i8 signext 46)
%10 = tail call i32 @wait(i32 1000)
%11 = tail call i32 @out_char(i8 signext 46)
%12 = tail call i32 @wait(i32 1000)
%13 = tail call i32 @out_char(i8 signext 46)
%14 = tail call i32 @wait(i32 1000)
%15 = tail call i32 @out_char(i8 signext 46)
%16 = tail call i32 @wait(i32 1000)
%17 = tail call i32 @out_char(i8 signext 46)
%18 = tail call i32 @wait(i32 1000)
%19 = tail call i32 @out_char(i8 signext 46)
%20 = tail call i32 @wait(i32 1000)
%21 = tail call i32 @out_char(i8 signext 46)
%22 = tail call i32 @wait(i32 1000)
%23 = tail call i32 @out_char(i8 signext 46)
%24 = tail call i32 @wait(i32 1000)
%25 = tail call i32 @out_char(i8 signext 46)
%26 = tail call i32 @wait(i32 1000)
%27 = tail call i32 @out_char(i8 signext 46)
%28 = tail call i32 @wait(i32 1000)
%29 = tail call i32 @out_char(i8 signext 46)
%30 = tail call i32 @wait(i32 1000)
%31 = tail call i32 @out_char(i8 signext 46)
%32 = tail call i32 @wait(i32 1000)
%33 = tail call i32 @out_char(i8 signext 46)
%34 = tail call i32 @wait(i32 1000)
%35 = tail call i32 @out_char(i8 signext 46)
%36 = tail call i32 @out_string(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%37 = tail call i32 (...) @reboot()
ret void
}