#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 PM_inpb(int);
int /*<<< orphan*/ PM_outpb(int, int);
int /*<<< orphan*/ processRawScanCode(int);
void _EVT_pumpMessages(void) {
  char kbval;
  while (PM_inpb(0x64) & 0x1) {
    processRawScanCode(PM_inpb(0x60));
    kbval = PM_inpb(0x61);
    PM_outpb(0x61, kbval | 0x80);
    PM_outpb(0x61, kbval);
    PM_outpb(0x20, 0x20);
  }
}


x86 assembly (clang, -O0):
<_EVT_pumpMessages>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1030 <PM_inpb@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     119f <_EVT_pumpMessages+0x6f>
mov    $0x60,%edi
call   1030 <PM_inpb@plt>
mov    %eax,%edi
call   1050 <processRawScanCode@plt>
mov    $0x61,%edi
call   1030 <PM_inpb@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%esi
or     $0x80,%esi
mov    $0x61,%edi
call   1040 <PM_outpb@plt>
movsbl -0x1(%rbp),%esi
mov    $0x61,%edi
call   1040 <PM_outpb@plt>
mov    $0x20,%esi
mov    %esi,%edi
call   1040 <PM_outpb@plt>
jmp    1138 <_EVT_pumpMessages+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_EVT_pumpMessages>:
push   %rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1030 <PM_inpb@plt>
test   $0x1,%al
je     119b <_EVT_pumpMessages+0x6b>
mov    $0x60,%edi
call   1030 <PM_inpb@plt>
mov    %eax,%edi
call   1050 <processRawScanCode@plt>
mov    $0x61,%edi
call   1030 <PM_inpb@plt>
movsbl %al,%ebx
mov    %ebx,%esi
or     $0x80,%esi
mov    $0x61,%edi
call   1040 <PM_outpb@plt>
mov    $0x61,%edi
mov    %ebx,%esi
call   1040 <PM_outpb@plt>
mov    $0x20,%edi
mov    $0x20,%esi
call   1040 <PM_outpb@plt>
jmp    1140 <_EVT_pumpMessages+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @_EVT_pumpMessages() {
%1 = alloca i8
br label %2
2: ; preds = %6, %0
%3 = call i32 @PM_inpb(i32 100)
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = call i32 @PM_inpb(i32 96)
%8 = call i32 @processRawScanCode(i32 %7)
%9 = call i32 @PM_inpb(i32 97)
%10 = trunc i32 %9 to i8
store i8 %10, i8* %1
%11 = load i8, i8* %1
%12 = sext i8 %11 to i32
%13 = or i32 %12, 128
%14 = call i32 @PM_outpb(i32 97, i32 %13)
%15 = load i8, i8* %1
%16 = sext i8 %15 to i32
%17 = call i32 @PM_outpb(i32 97, i32 %16)
%18 = call i32 @PM_outpb(i32 32, i32 32)
br label %2
19: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @_EVT_pumpMessages() {
%1 = tail call i32 @PM_inpb(i32 100)
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %0, %4
%5 = tail call i32 @PM_inpb(i32 96)
%6 = tail call i32 @processRawScanCode(i32 %5)
%7 = tail call i32 @PM_inpb(i32 97)
%8 = shl i32 %7, 24
%9 = ashr exact i32 %8, 24
%10 = or i32 %9, 128
%11 = tail call i32 @PM_outpb(i32 97, i32 %10)
%12 = tail call i32 @PM_outpb(i32 97, i32 %9)
%13 = tail call i32 @PM_outpb(i32 32, i32 32)
%14 = tail call i32 @PM_inpb(i32 100)
%15 = and i32 %14, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4, %0
ret void
}