#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*/ key_1_handler();
int /*<<< orphan*/ key_2_handler();
int /*<<< orphan*/ key_3_handler();
int /*<<< orphan*/ key_4_handler();
int /*<<< orphan*/ key_5_handler();
int /*<<< orphan*/ key_6_handler();
void key_isr(void) {
  unsigned int val = (*(volatile unsigned int *)(0x7F008924)) & 0x3F;
  switch (val) {
  case 1:
    key_1_handler();
    break;
  case 2:
    key_2_handler();
    break;
  case 4:
    key_3_handler();
    break;
  case 8:
    key_4_handler();
    break;
  case 0x10:
    key_5_handler();
    break;
  case 0x20:
    key_6_handler();
    break;
  default:
    break;
  }
  (*(volatile unsigned int *)(0x7F008924)) |= 0x3F;
  (*(volatile unsigned int *)(0x71200F00)) = 0;
  return;
}


x86 assembly (clang, -O0):
<key_isr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x7f008924,%eax
and    $0x3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x1f,%eax
ja     11e6 <key_isr+0x86>
mov    -0x10(%rbp),%rax
lea    0xe6b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <key_1_handler@plt>
jmp    11eb <key_isr+0x8b>
mov    $0x0,%al
call   1060 <key_2_handler@plt>
jmp    11eb <key_isr+0x8b>
mov    $0x0,%al
call   1080 <key_3_handler@plt>
jmp    11eb <key_isr+0x8b>
mov    $0x0,%al
call   1050 <key_4_handler@plt>
jmp    11eb <key_isr+0x8b>
mov    $0x0,%al
call   1070 <key_5_handler@plt>
jmp    11eb <key_isr+0x8b>
mov    $0x0,%al
call   1040 <key_6_handler@plt>
jmp    11eb <key_isr+0x8b>
jmp    11eb <key_isr+0x8b>
mov    $0x7f008924,%eax
mov    (%rax),%ecx
or     $0x3f,%ecx
mov    $0x7f008924,%eax
mov    %ecx,(%rax)
mov    $0x71200f00,%eax
movl   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_isr>:
push   %rax
mov    0x7f008924,%eax
and    $0x3f,%eax
add    $0xffffffff,%eax
cmp    $0x1f,%eax
ja     11b7 <key_isr+0x57>
lea    0xe86(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <key_1_handler@plt>
jmp    11b7 <key_isr+0x57>
xor    %eax,%eax
call   1060 <key_2_handler@plt>
jmp    11b7 <key_isr+0x57>
xor    %eax,%eax
call   1080 <key_3_handler@plt>
jmp    11b7 <key_isr+0x57>
xor    %eax,%eax
call   1050 <key_4_handler@plt>
jmp    11b7 <key_isr+0x57>
xor    %eax,%eax
call   1070 <key_5_handler@plt>
jmp    11b7 <key_isr+0x57>
xor    %eax,%eax
call   1040 <key_6_handler@plt>
orl    $0x3f,0x7f008924
3f
movl   $0x0,0x71200f00
pop    %rax
ret

LLVM IR (-O0):
define void @key_isr() {
%1 = alloca i32
%2 = load volatile i32, i32* inttoptr (i64 2130741540 to i32*)
%3 = and i32 %2, 63
store i32 %3, i32* %1
%4 = load i32, i32* %1
switch i32 %4, label %17 [
i32 1, label %5
i32 2, label %7
i32 4, label %9
i32 8, label %11
i32 16, label %13
i32 32, label %15
]
5: ; preds = %0
%6 = call i32 (...) @key_1_handler()
br label %18
7: ; preds = %0
%8 = call i32 (...) @key_2_handler()
br label %18
9: ; preds = %0
%10 = call i32 (...) @key_3_handler()
br label %18
11: ; preds = %0
%12 = call i32 (...) @key_4_handler()
br label %18
13: ; preds = %0
%14 = call i32 (...) @key_5_handler()
br label %18
15: ; preds = %0
%16 = call i32 (...) @key_6_handler()
br label %18
17: ; preds = %0
br label %18
18: ; preds = %17, %15, %13, %11, %9, %7, %5
%19 = load volatile i32, i32* inttoptr (i64 2130741540 to i32*)
%20 = or i32 %19, 63
store volatile i32 %20, i32* inttoptr (i64 2130741540 to i32*)
store volatile i32 0, i32* inttoptr (i64 1897926400 to i32*)
ret void
}

LLVM IR (-O2):
define void @key_isr() {
%1 = load volatile i32, i32* inttoptr (i64 2130741540 to i32*)
%2 = and i32 %1, 63
switch i32 %2, label %15 [
i32 1, label %3
i32 2, label %5
i32 4, label %7
i32 8, label %9
i32 16, label %11
i32 32, label %13
]
3: ; preds = %0
%4 = tail call i32 (...) @key_1_handler()
br label %15
5: ; preds = %0
%6 = tail call i32 (...) @key_2_handler()
br label %15
7: ; preds = %0
%8 = tail call i32 (...) @key_3_handler()
br label %15
9: ; preds = %0
%10 = tail call i32 (...) @key_4_handler()
br label %15
11: ; preds = %0
%12 = tail call i32 (...) @key_5_handler()
br label %15
13: ; preds = %0
%14 = tail call i32 (...) @key_6_handler()
br label %15
15: ; preds = %0, %13, %11, %9, %7, %5, %3
%16 = load volatile i32, i32* inttoptr (i64 2130741540 to i32*)
%17 = or i32 %16, 63
store volatile i32 %17, i32* inttoptr (i64 2130741540 to i32*)
store volatile i32 0, i32* inttoptr (i64 1897926400 to i32*)
ret void
}