#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 */
unsigned int keyboard_get_keyport(int);
unsigned int in(int h, int l) {
  if (l == 0xfe)
    switch (h) {
    case 0xfe:
      return (keyboard_get_keyport(0));
    case 0xfd:
      return (keyboard_get_keyport(1));
    case 0xfb:
      return (keyboard_get_keyport(2));
    case 0xf7:
      return (keyboard_get_keyport(3));
    case 0xef:
      return (keyboard_get_keyport(4));
    case 0xdf:
      return (keyboard_get_keyport(5));
    case 0xbf:
      return (keyboard_get_keyport(6));
    case 0x7f:
      return (keyboard_get_keyport(7));
    default:
      return (255);
    }
  return (255);
}


x86 assembly (clang, -O0):
<in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xfe,-0xc(%rbp)
jne    125d <in+0x14d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x7f,%eax
je     123f <in+0x12f>
jmp    113f <in+0x2f>
mov    -0x10(%rbp),%eax
sub    $0xbf,%eax
je     122d <in+0x11d>
jmp    1152 <in+0x42>
mov    -0x10(%rbp),%eax
sub    $0xdf,%eax
je     121b <in+0x10b>
jmp    1165 <in+0x55>
mov    -0x10(%rbp),%eax
sub    $0xef,%eax
je     1209 <in+0xf9>
jmp    1178 <in+0x68>
mov    -0x10(%rbp),%eax
sub    $0xf7,%eax
je     11f7 <in+0xe7>
jmp    118b <in+0x7b>
mov    -0x10(%rbp),%eax
sub    $0xfb,%eax
je     11e5 <in+0xd5>
jmp    119e <in+0x8e>
mov    -0x10(%rbp),%eax
sub    $0xfd,%eax
je     11d3 <in+0xc3>
jmp    11b1 <in+0xa1>
mov    -0x10(%rbp),%eax
sub    $0xfe,%eax
jne    1251 <in+0x141>
jmp    11c4 <in+0xb4>
xor    %edi,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x1,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x2,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x3,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x4,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x5,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x6,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
mov    $0x7,%edi
call   1030 <keyboard_get_keyport@plt>
mov    %eax,-0x4(%rbp)
jmp    1264 <in+0x154>
movl   $0xff,-0x4(%rbp)
jmp    1264 <in+0x154>
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in>:
cmp    $0xfe,%esi
jne    114e <in+0x3e>
lea    -0xbf(%rdi),%eax
cmp    $0x3f,%eax
ja     113f <in+0x2f>
xor    %edi,%edi
lea    0xed4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x6,%edi
jmp    1030 <keyboard_get_keyport@plt>
cmp    $0x7f,%edi
jne    114e <in+0x3e>
mov    $0x7,%edi
jmp    1030 <keyboard_get_keyport@plt>
mov    $0xff,%eax
ret
mov    $0x5,%edi
jmp    1030 <keyboard_get_keyport@plt>
mov    $0x4,%edi
jmp    1030 <keyboard_get_keyport@plt>
mov    $0x3,%edi
jmp    1030 <keyboard_get_keyport@plt>
mov    $0x2,%edi
jmp    1030 <keyboard_get_keyport@plt>
mov    $0x1,%edi
jmp    1030 <keyboard_get_keyport@plt>

LLVM IR (-O0):
define i32 @in(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 254
br i1 %7, label %8, label %27
8: ; preds = %2
%9 = load i32, i32* %4
switch i32 %9, label %26 [
i32 254, label %10
i32 253, label %12
i32 251, label %14
i32 247, label %16
i32 239, label %18
i32 223, label %20
i32 191, label %22
i32 127, label %24
]
10: ; preds = %8
%11 = call i32 @keyboard_get_keyport(i32 0)
store i32 %11, i32* %3
br label %28
12: ; preds = %8
%13 = call i32 @keyboard_get_keyport(i32 1)
store i32 %13, i32* %3
br label %28
14: ; preds = %8
%15 = call i32 @keyboard_get_keyport(i32 2)
store i32 %15, i32* %3
br label %28
16: ; preds = %8
%17 = call i32 @keyboard_get_keyport(i32 3)
store i32 %17, i32* %3
br label %28
18: ; preds = %8
%19 = call i32 @keyboard_get_keyport(i32 4)
store i32 %19, i32* %3
br label %28
20: ; preds = %8
%21 = call i32 @keyboard_get_keyport(i32 5)
store i32 %21, i32* %3
br label %28
22: ; preds = %8
%23 = call i32 @keyboard_get_keyport(i32 6)
store i32 %23, i32* %3
br label %28
24: ; preds = %8
%25 = call i32 @keyboard_get_keyport(i32 7)
store i32 %25, i32* %3
br label %28
26: ; preds = %8
store i32 255, i32* %3
br label %28
27: ; preds = %2
store i32 255, i32* %3
br label %28
28: ; preds = %27, %26, %24, %22, %20, %18, %16, %14, %12, %10
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @in(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 254
br i1 %3, label %4, label %15
4: ; preds = %2
switch i32 %0, label %15 [
i32 254, label %12
i32 253, label %5
i32 251, label %6
i32 247, label %7
i32 239, label %8
i32 223, label %9
i32 191, label %10
i32 127, label %11
]
5: ; preds = %4
br label %12
6: ; preds = %4
br label %12
7: ; preds = %4
br label %12
8: ; preds = %4
br label %12
9: ; preds = %4
br label %12
10: ; preds = %4
br label %12
11: ; preds = %4
br label %12
12: ; preds = %4, %5, %6, %7, %8, %9, %10, %11
%13 = phi i32 [ 7, %11 ], [ 6, %10 ], [ 5, %9 ], [ 4, %8 ], [ 3, %7 ], [ 2, %6 ], [ 1, %5 ], [ 0, %4 ]
%14 = tail call i32 @keyboard_get_keyport(i32 %13)
br label %15
15: ; preds = %12, %2, %4
%16 = phi i32 [ 255, %4 ], [ 255, %2 ], [ %14, %12 ]
ret i32 %16
}