#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 eint4_11_irq(void) {
  int i;
  printf("eint4_11_irq\n\r");
  for (i = 4; i < 6; 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):
<eint4_11_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x4,-0x4(%rbp)
cmpl   $0x6,-0x4(%rbp)
jge    11c4 <eint4_11_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 <eint4_11_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 <eint4_11_irq+0x88>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ac <eint4_11_irq+0x9c>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <eint4_11_irq+0xa1>
jmp    11b6 <eint4_11_irq+0xa6>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112d <eint4_11_irq+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eint4_11_irq>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
testq  $0x10,0x7f008924
je     1157 <eint4_11_irq+0x47>
testq  $0x10,0x7f008834
lea    0xede(%rip),%rax
lea    0xec8(%rip),%rdi
cmove  %rax,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
testq  $0x20,0x7f008924
jne    1167 <eint4_11_irq+0x57>
pop    %rax
ret
testq  $0x20,0x7f008834
lea    0xea4(%rip),%rax
lea    0xe8e(%rip),%rdi
cmove  %rax,%rdi
mov    $0x6,%esi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"eint4_11_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 @eint4_11_irq() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 4, i32* %1
br label %3
3: ; preds = %30, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 6
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 = [15 x i8] c"eint4_11_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 @eint4_11_irq() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%3 = and i64 %2, 16
%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, 16
%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 5)
br label %11
11: ; preds = %5, %0
%12 = load volatile i64, i64* inttoptr (i64 2130741540 to i64*)
%13 = and i64 %12, 32
%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, 32
%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 6)
br label %21
21: ; preds = %15, %11
ret void
}