#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*/ printf(char *, ...);
void eint0_3_irq(void) {
  int i;
  printf("eint0_3_irq\n\r");
  for (i = 0; i < 4; i++) {
    if ((*((volatile unsigned long *)0x7F008924)) & (1 << i)) {
      if ((*((volatile unsigned long *)0x7F008834)) & (1 << i)) {
        printf("K%d released\n\r", i + 1);
      } else {
        printf("K%d pressed\n\r", i + 1);
      }
    }
  }
}


x86 assembly (clang, -O0):
<eint0_3_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    11c4 <eint0_3_irq+0xb4>
mov    $0x7f008924,%eax
mov    (%rax),%rax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     11b1 <eint0_3_irq+0xa1>
mov    $0x7f008834,%eax
mov    (%rax),%rax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1198 <eint0_3_irq+0x88>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ac <eint0_3_irq+0x9c>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <eint0_3_irq+0xa1>
jmp    11b6 <eint0_3_irq+0xa6>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112d <eint0_3_irq+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eint0_3_irq>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
testq  $0x1,0x7f008924
jne    1161 <eint0_3_irq+0x51>
testq  $0x2,0x7f008924
jne    1199 <eint0_3_irq+0x89>
testq  $0x4,0x7f008924
jne    11d5 <eint0_3_irq+0xc5>
testq  $0x8,0x7f008924
jne    1211 <eint0_3_irq+0x101>
pop    %rax
ret
testq  $0x1,0x7f008834
lea    0xea9(%rip),%rax
lea    0xe93(%rip),%rdi
cmove  %rax,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
testq  $0x2,0x7f008924
je     113b <eint0_3_irq+0x2b>
testq  $0x2,0x7f008834
lea    0xe71(%rip),%rax
lea    0xe5b(%rip),%rdi
cmove  %rax,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
testq  $0x4,0x7f008924
je     114d <eint0_3_irq+0x3d>
testq  $0x4,0x7f008834
lea    0xe35(%rip),%rax
lea    0xe1f(%rip),%rdi
cmove  %rax,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
testq  $0x8,0x7f008924
je     115f <eint0_3_irq+0x4f>
testq  $0x8,0x7f008834
lea    0xdf9(%rip),%rax
lea    0xde3(%rip),%rdi
cmove  %rax,%rdi
mov    $0x4,%esi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"eint0_3_irq\0A\0D\00"
@.str.1 = [15 x i8] c"K%d released\0A\0D\00"
@.str.2 = [14 x i8] c"K%d pressed\0A\0D\00"
define void @eint0_3_irq() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %3
3: ; preds = %30, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 4
br i1 %5, label %6, label %33
6: ; preds = %3
%7 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%8 = load i32, i32* %1
%9 = shl i32 1, %8
%10 = sext i32 %9 to i64
%11 = and i64 %7, %10
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %29
13: ; preds = %6
%14 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%15 = load i32, i32* %1
%16 = shl i32 1, %15
%17 = sext i32 %16 to i64
%18 = and i64 %14, %17
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %13
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %28
24: ; preds = %13
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %24, %20
br label %29
29: ; preds = %28, %6
br label %30
30: ; preds = %29
%31 = load i32, i32* %1
%32 = add nsw i32 %31, 1
store i32 %32, i32* %1
br label %3
33: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"eint0_3_irq\0A\0D\00"
@.str.1 = [15 x i8] c"K%d released\0A\0D\00"
@.str.2 = [14 x i8] c"K%d pressed\0A\0D\00"
define void @eint0_3_irq() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%3 = and i64 %2, 1
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %0
%6 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%7 = and i64 %6, 1
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %9, i32 1)
br label %11
11: ; preds = %5, %0
%12 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%13 = and i64 %12, 2
%14 = icmp eq i64 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %11
%16 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%17 = and i64 %16, 2
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %19, i32 2)
br label %21
21: ; preds = %15, %11
%22 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%23 = and i64 %22, 4
%24 = icmp eq i64 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %21
%26 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%27 = and i64 %26, 4
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %29, i32 3)
br label %31
31: ; preds = %25, %21
%32 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%33 = and i64 %32, 8
%34 = icmp eq i64 %33, 0
br i1 %34, label %41, label %35
35: ; preds = %31
%36 = load volatile i64, i64* inttoptr (i64 2130741300 to i64*)
%37 = and i64 %36, 8
%38 = icmp eq i64 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %39, i32 4)
br label %41
41: ; preds = %35, %31
ret void
}