#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*/ cmd_keyboard(int);
int /*<<< orphan*/ io_out8(int, int);
int /*<<< orphan*/ open_PIC(int);
void init_keyboard(void) {
  io_out8(0x0021, 0xff);
  io_out8(0x00a1, 0xff);
  io_out8(0x0020, 0x11);
  io_out8(0x0021, 0x20);
  io_out8(0x0021, 1 << 2);
  io_out8(0x0021, 0x01);
  io_out8(0x00a0, 0x11);
  io_out8(0x00a1, 0x20 + 0x8);
  io_out8(0x00a1, 2);
  io_out8(0x00a1, 0x01);
  io_out8(0x0021, 0xfb);
  io_out8(0x00a1, 0xff);
  cmd_keyboard(0xED);
  cmd_keyboard(0x00);
  cmd_keyboard(0xF4);
  open_PIC(1);
  return;
}


x86 assembly (clang, -O0):
<init_keyboard>:
push   %rbp
mov    %rsp,%rbp
mov    $0x21,%edi
mov    $0xff,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1040 <io_out8@plt>
mov    $0x20,%edi
mov    $0x11,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1040 <io_out8@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0xfb,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1040 <io_out8@plt>
mov    $0xed,%edi
call   1030 <cmd_keyboard@plt>
xor    %edi,%edi
call   1030 <cmd_keyboard@plt>
mov    $0xf4,%edi
call   1030 <cmd_keyboard@plt>
mov    $0x1,%edi
call   1050 <open_PIC@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_keyboard>:
push   %rax
mov    $0x21,%edi
mov    $0xff,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1040 <io_out8@plt>
mov    $0x20,%edi
mov    $0x11,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1040 <io_out8@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1040 <io_out8@plt>
mov    $0x21,%edi
mov    $0xfb,%esi
call   1040 <io_out8@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1040 <io_out8@plt>
mov    $0xed,%edi
call   1030 <cmd_keyboard@plt>
xor    %edi,%edi
call   1030 <cmd_keyboard@plt>
mov    $0xf4,%edi
call   1030 <cmd_keyboard@plt>
mov    $0x1,%edi
pop    %rax
jmp    1050 <open_PIC@plt>

LLVM IR (-O0):
define void @init_keyboard() {
%1 = call i32 @io_out8(i32 33, i32 255)
%2 = call i32 @io_out8(i32 161, i32 255)
%3 = call i32 @io_out8(i32 32, i32 17)
%4 = call i32 @io_out8(i32 33, i32 32)
%5 = call i32 @io_out8(i32 33, i32 4)
%6 = call i32 @io_out8(i32 33, i32 1)
%7 = call i32 @io_out8(i32 160, i32 17)
%8 = call i32 @io_out8(i32 161, i32 40)
%9 = call i32 @io_out8(i32 161, i32 2)
%10 = call i32 @io_out8(i32 161, i32 1)
%11 = call i32 @io_out8(i32 33, i32 251)
%12 = call i32 @io_out8(i32 161, i32 255)
%13 = call i32 @cmd_keyboard(i32 237)
%14 = call i32 @cmd_keyboard(i32 0)
%15 = call i32 @cmd_keyboard(i32 244)
%16 = call i32 @open_PIC(i32 1)
ret void
}

LLVM IR (-O2):
define void @init_keyboard() {
%1 = tail call i32 @io_out8(i32 33, i32 255)
%2 = tail call i32 @io_out8(i32 161, i32 255)
%3 = tail call i32 @io_out8(i32 32, i32 17)
%4 = tail call i32 @io_out8(i32 33, i32 32)
%5 = tail call i32 @io_out8(i32 33, i32 4)
%6 = tail call i32 @io_out8(i32 33, i32 1)
%7 = tail call i32 @io_out8(i32 160, i32 17)
%8 = tail call i32 @io_out8(i32 161, i32 40)
%9 = tail call i32 @io_out8(i32 161, i32 2)
%10 = tail call i32 @io_out8(i32 161, i32 1)
%11 = tail call i32 @io_out8(i32 33, i32 251)
%12 = tail call i32 @io_out8(i32 161, i32 255)
%13 = tail call i32 @cmd_keyboard(i32 237)
%14 = tail call i32 @cmd_keyboard(i32 0)
%15 = tail call i32 @cmd_keyboard(i32 244)
%16 = tail call i32 @open_PIC(i32 1)
ret void
}