#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 inportb(int);
int /*<<< orphan*/ outportb(int, unsigned char);
int /*<<< orphan*/ send_mouse(int);
int /*<<< orphan*/ wait_kb_input();
void enable_mouse(void) {
  unsigned char command;
  wait_kb_input();
  outportb(0x64, 0xA8);
  wait_kb_input();
  outportb(0x64, 0x20);
  command = inportb(0x60) | 3;
  wait_kb_input();
  outportb(0x64, 0x60);
  wait_kb_input();
  outportb(0x60, command);
  send_mouse(0xE8);
  send_mouse(0x03);
  send_mouse(0xE7);
  send_mouse(0xF4);
}


x86 assembly (clang, -O0):
<enable_mouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <wait_kb_input@plt>
mov    $0x64,%edi
mov    $0xa8,%esi
call   1060 <outportb@plt>
mov    $0x0,%al
call   1030 <wait_kb_input@plt>
mov    $0x64,%edi
mov    $0x20,%esi
call   1060 <outportb@plt>
mov    $0x60,%edi
call   1050 <inportb@plt>
or     $0x3,%eax
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <wait_kb_input@plt>
mov    $0x64,%edi
mov    $0x60,%esi
call   1060 <outportb@plt>
mov    $0x0,%al
call   1030 <wait_kb_input@plt>
mov    $0x60,%edi
movzbl -0x1(%rbp),%esi
call   1060 <outportb@plt>
mov    $0xe8,%edi
call   1040 <send_mouse@plt>
mov    $0x3,%edi
call   1040 <send_mouse@plt>
mov    $0xe7,%edi
call   1040 <send_mouse@plt>
mov    $0xf4,%edi
call   1040 <send_mouse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_mouse>:
push   %rbx
xor    %eax,%eax
call   1030 <wait_kb_input@plt>
mov    $0x64,%edi
mov    $0xa8,%esi
call   1060 <outportb@plt>
xor    %eax,%eax
call   1030 <wait_kb_input@plt>
mov    $0x64,%edi
mov    $0x20,%esi
call   1060 <outportb@plt>
mov    $0x60,%edi
call   1050 <inportb@plt>
mov    %eax,%ebx
or     $0x3,%bl
xor    %eax,%eax
call   1030 <wait_kb_input@plt>
mov    $0x64,%edi
mov    $0x60,%esi
call   1060 <outportb@plt>
xor    %eax,%eax
call   1030 <wait_kb_input@plt>
movzbl %bl,%esi
mov    $0x60,%edi
call   1060 <outportb@plt>
mov    $0xe8,%edi
call   1040 <send_mouse@plt>
mov    $0x3,%edi
call   1040 <send_mouse@plt>
mov    $0xe7,%edi
call   1040 <send_mouse@plt>
mov    $0xf4,%edi
pop    %rbx
jmp    1040 <send_mouse@plt>

LLVM IR (-O0):
define void @enable_mouse() {
%1 = alloca i8
%2 = call i32 (...) @wait_kb_input()
%3 = call i32 @outportb(i32 100, i8 zeroext -88)
%4 = call i32 (...) @wait_kb_input()
%5 = call i32 @outportb(i32 100, i8 zeroext 32)
%6 = call i32 @inportb(i32 96)
%7 = or i32 %6, 3
%8 = trunc i32 %7 to i8
store i8 %8, i8* %1
%9 = call i32 (...) @wait_kb_input()
%10 = call i32 @outportb(i32 100, i8 zeroext 96)
%11 = call i32 (...) @wait_kb_input()
%12 = load i8, i8* %1
%13 = call i32 @outportb(i32 96, i8 zeroext %12)
%14 = call i32 @send_mouse(i32 232)
%15 = call i32 @send_mouse(i32 3)
%16 = call i32 @send_mouse(i32 231)
%17 = call i32 @send_mouse(i32 244)
ret void
}

LLVM IR (-O2):
define void @enable_mouse() {
%1 = tail call i32 (...) @wait_kb_input()
%2 = tail call i32 @outportb(i32 100, i8 zeroext -88)
%3 = tail call i32 (...) @wait_kb_input()
%4 = tail call i32 @outportb(i32 100, i8 zeroext 32)
%5 = tail call i32 @inportb(i32 96)
%6 = trunc i32 %5 to i8
%7 = or i8 %6, 3
%8 = tail call i32 (...) @wait_kb_input()
%9 = tail call i32 @outportb(i32 100, i8 zeroext 96)
%10 = tail call i32 (...) @wait_kb_input()
%11 = tail call i32 @outportb(i32 96, i8 zeroext %7)
%12 = tail call i32 @send_mouse(i32 232)
%13 = tail call i32 @send_mouse(i32 3)
%14 = tail call i32 @send_mouse(i32 231)
%15 = tail call i32 @send_mouse(i32 244)
ret void
}