#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*/ i8042_wait_write();
int /*<<< orphan*/ outb(int, int);
int /*<<< orphan*/ udelay(int);
void i8042_reboot(void) {
  int i;
  for (i = 0; i < 10; i++) {
    i8042_wait_write();
    udelay(50);
    outb(0xfe, 0x0064);
    udelay(50);
  }
}


x86 assembly (clang, -O0):
<i8042_reboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1181 <i8042_reboot+0x51>
mov    $0x0,%al
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113f <i8042_reboot+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i8042_reboot>:
push   %rax
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
xor    %eax,%eax
call   1040 <i8042_wait_write@plt>
mov    $0x32,%edi
call   1050 <udelay@plt>
mov    $0xfe,%edi
mov    $0x64,%esi
call   1030 <outb@plt>
mov    $0x32,%edi
pop    %rax
jmp    1050 <udelay@plt>

LLVM IR (-O0):
define void @i8042_reboot() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %10, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %13
5: ; preds = %2
%6 = call i32 (...) @i8042_wait_write()
%7 = call i32 @udelay(i32 50)
%8 = call i32 @outb(i32 254, i32 100)
%9 = call i32 @udelay(i32 50)
br label %10
10: ; preds = %5
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %2
13: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @i8042_reboot() {
%1 = tail call i32 (...) @i8042_wait_write()
%2 = tail call i32 @udelay(i32 50)
%3 = tail call i32 @outb(i32 254, i32 100)
%4 = tail call i32 @udelay(i32 50)
%5 = tail call i32 (...) @i8042_wait_write()
%6 = tail call i32 @udelay(i32 50)
%7 = tail call i32 @outb(i32 254, i32 100)
%8 = tail call i32 @udelay(i32 50)
%9 = tail call i32 (...) @i8042_wait_write()
%10 = tail call i32 @udelay(i32 50)
%11 = tail call i32 @outb(i32 254, i32 100)
%12 = tail call i32 @udelay(i32 50)
%13 = tail call i32 (...) @i8042_wait_write()
%14 = tail call i32 @udelay(i32 50)
%15 = tail call i32 @outb(i32 254, i32 100)
%16 = tail call i32 @udelay(i32 50)
%17 = tail call i32 (...) @i8042_wait_write()
%18 = tail call i32 @udelay(i32 50)
%19 = tail call i32 @outb(i32 254, i32 100)
%20 = tail call i32 @udelay(i32 50)
%21 = tail call i32 (...) @i8042_wait_write()
%22 = tail call i32 @udelay(i32 50)
%23 = tail call i32 @outb(i32 254, i32 100)
%24 = tail call i32 @udelay(i32 50)
%25 = tail call i32 (...) @i8042_wait_write()
%26 = tail call i32 @udelay(i32 50)
%27 = tail call i32 @outb(i32 254, i32 100)
%28 = tail call i32 @udelay(i32 50)
%29 = tail call i32 (...) @i8042_wait_write()
%30 = tail call i32 @udelay(i32 50)
%31 = tail call i32 @outb(i32 254, i32 100)
%32 = tail call i32 @udelay(i32 50)
%33 = tail call i32 (...) @i8042_wait_write()
%34 = tail call i32 @udelay(i32 50)
%35 = tail call i32 @outb(i32 254, i32 100)
%36 = tail call i32 @udelay(i32 50)
%37 = tail call i32 (...) @i8042_wait_write()
%38 = tail call i32 @udelay(i32 50)
%39 = tail call i32 @outb(i32 254, i32 100)
%40 = tail call i32 @udelay(i32 50)
ret void
}