#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 ASM(char *);
int /*<<< orphan*/ rx_interrupt();
int /*<<< orphan*/ timer_interrupt();
int /*<<< orphan*/ tx_interrupt();
void interrupt() {
  ASM(" MOVE RR, -(SP)");
  ASM(" MOVE LL, RR");
  ASM(" MOVE RR, -(SP)");
  if (ASM(" IN   (IN_STATUS), RU") & 0x10)
    rx_interrupt();
  if (ASM(" IN   (IN_STATUS), RU") & 0x20)
    tx_interrupt();
  if (ASM(" IN   (IN_STATUS), RU") & 0x40)
    timer_interrupt();
  ASM(" MOVE (SP)+, RR");
  ASM(" MOVE RR, LL");
  ASM(" MOVE (SP)+, RR");
  ASM(" RETI");
}


x86 assembly (clang, -O0):
<interrupt>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1060 <ASM@plt>
lea    0xeb9(%rip),%rdi
call   1060 <ASM@plt>
lea    0xe9d(%rip),%rdi
call   1060 <ASM@plt>
lea    0xeae(%rip),%rdi
call   1060 <ASM@plt>
and    $0x10,%eax
cmp    $0x0,%eax
je     1187 <interrupt+0x47>
mov    $0x0,%al
call   1030 <rx_interrupt@plt>
lea    0xe8f(%rip),%rdi
call   1060 <ASM@plt>
and    $0x20,%eax
cmp    $0x0,%eax
je     11a6 <interrupt+0x66>
mov    $0x0,%al
call   1040 <tx_interrupt@plt>
lea    0xe70(%rip),%rdi
call   1060 <ASM@plt>
and    $0x40,%eax
cmp    $0x0,%eax
je     11c5 <interrupt+0x85>
mov    $0x0,%al
call   1050 <timer_interrupt@plt>
lea    0xe67(%rip),%rdi
call   1060 <ASM@plt>
lea    0xe6b(%rip),%rdi
call   1060 <ASM@plt>
lea    0xe4f(%rip),%rdi
call   1060 <ASM@plt>
lea    0xe60(%rip),%rdi
call   1060 <ASM@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<interrupt>:
push   %rbx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
call   1060 <ASM@plt>
lea    0xeb9(%rip),%rdi
call   1060 <ASM@plt>
mov    %rbx,%rdi
call   1060 <ASM@plt>
lea    0xeb2(%rip),%rdi
call   1060 <ASM@plt>
test   $0x10,%al
je     117b <interrupt+0x3b>
xor    %eax,%eax
call   1030 <rx_interrupt@plt>
lea    0xe9b(%rip),%rdi
call   1060 <ASM@plt>
test   $0x20,%al
je     1192 <interrupt+0x52>
xor    %eax,%eax
call   1040 <tx_interrupt@plt>
lea    0xe84(%rip),%rdi
call   1060 <ASM@plt>
test   $0x40,%al
je     11a9 <interrupt+0x69>
xor    %eax,%eax
call   1050 <timer_interrupt@plt>
lea    0xe83(%rip),%rbx
mov    %rbx,%rdi
call   1060 <ASM@plt>
lea    0xe84(%rip),%rdi
call   1060 <ASM@plt>
mov    %rbx,%rdi
call   1060 <ASM@plt>
lea    0xe7d(%rip),%rdi
pop    %rbx
jmp    1060 <ASM@plt>

LLVM IR (-O0):
@.str = [16 x i8] c" MOVE RR, -(SP)\00"
@.str.1 = [13 x i8] c" MOVE LL, RR\00"
@.str.2 = [22 x i8] c" IN (IN_STATUS), RU\00"
@.str.3 = [16 x i8] c" MOVE (SP)+, RR\00"
@.str.4 = [13 x i8] c" MOVE RR, LL\00"
@.str.5 = [6 x i8] c" RETI\00"
define void @interrupt() {
%1 = call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @ASM(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @ASM(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = and i32 %4, 16
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @rx_interrupt()
br label %9
9: ; preds = %7, %0
%10 = call i32 @ASM(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = and i32 %10, 32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (...) @tx_interrupt()
br label %15
15: ; preds = %13, %9
%16 = call i32 @ASM(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%17 = and i32 %16, 64
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 (...) @timer_interrupt()
br label %21
21: ; preds = %19, %15
%22 = call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @ASM(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 @ASM(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c" MOVE RR, -(SP)\00"
@.str.1 = [13 x i8] c" MOVE LL, RR\00"
@.str.2 = [22 x i8] c" IN (IN_STATUS), RU\00"
@.str.3 = [16 x i8] c" MOVE (SP)+, RR\00"
@.str.4 = [13 x i8] c" MOVE RR, LL\00"
@.str.5 = [6 x i8] c" RETI\00"
define void @interrupt() {
%1 = tail call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ASM(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @ASM(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = and i32 %4, 16
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 (...) @rx_interrupt()
br label %9
9: ; preds = %7, %0
%10 = tail call i32 @ASM(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = and i32 %10, 32
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 (...) @tx_interrupt()
br label %15
15: ; preds = %13, %9
%16 = tail call i32 @ASM(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%17 = and i32 %16, 64
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = tail call i32 (...) @timer_interrupt()
br label %21
21: ; preds = %19, %15
%22 = tail call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%23 = tail call i32 @ASM(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%24 = tail call i32 @ASM(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%25 = tail call i32 @ASM(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}