#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 irq_getmask();
unsigned int irq_pending();
int /*<<< orphan*/ timer0_isr();
int /*<<< orphan*/ timer1_isr();
int /*<<< orphan*/ uart_isr();
void isr(void) {
  unsigned int irqs;
  irqs = irq_pending() & irq_getmask();
  if (irqs & (0x00000008))
    uart_isr();
  if (irqs & (0x00000020))
    timer0_isr();
  if (irqs & (0x00000040))
    timer1_isr();
}


x86 assembly (clang, -O0):
<isr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <irq_pending@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1060 <irq_getmask@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1189 <isr+0x39>
mov    $0x0,%al
call   1070 <uart_isr@plt>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     119f <isr+0x4f>
mov    $0x0,%al
call   1030 <timer0_isr@plt>
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     11b5 <isr+0x65>
mov    $0x0,%al
call   1050 <timer1_isr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isr>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <irq_pending@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1060 <irq_getmask@plt>
mov    %eax,%ebx
and    %ebp,%ebx
test   $0x8,%bl
jne    117d <isr+0x2d>
test   $0x20,%bl
jne    1189 <isr+0x39>
test   $0x40,%bl
jne    1195 <isr+0x45>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
call   1070 <uart_isr@plt>
test   $0x20,%bl
je     1171 <isr+0x21>
xor    %eax,%eax
call   1030 <timer0_isr@plt>
test   $0x40,%bl
je     1176 <isr+0x26>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <timer1_isr@plt>

LLVM IR (-O0):
define void @isr() {
%1 = alloca i32
%2 = call i32 (...) @irq_pending()
%3 = call i32 (...) @irq_getmask()
%4 = and i32 %2, %3
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = and i32 %5, 8
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @uart_isr()
br label %10
10: ; preds = %8, %0
%11 = load i32, i32* %1
%12 = and i32 %11, 32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (...) @timer0_isr()
br label %16
16: ; preds = %14, %10
%17 = load i32, i32* %1
%18 = and i32 %17, 64
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (...) @timer1_isr()
br label %22
22: ; preds = %20, %16
ret void
}

LLVM IR (-O2):
define void @isr() {
%1 = tail call i32 (...) @irq_pending()
%2 = tail call i32 (...) @irq_getmask()
%3 = and i32 %2, %1
%4 = and i32 %3, 8
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = tail call i32 (...) @uart_isr()
br label %8
8: ; preds = %6, %0
%9 = and i32 %3, 32
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 (...) @timer0_isr()
br label %13
13: ; preds = %11, %8
%14 = and i32 %3, 64
%15 = icmp eq i32 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 (...) @timer1_isr()
br label %18
18: ; preds = %16, %13
ret void
}