#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 char USBNRead(int);
int /*<<< orphan*/ USBNWrite(int, unsigned char);
int /*<<< orphan*/ _USBNAlternateEvent();
int /*<<< orphan*/ _USBNNackEvent();
int /*<<< orphan*/ _USBNReceiveEvent();
int /*<<< orphan*/ _USBNTransmitEvent();
void USBNInterrupt(void) {
  unsigned char maev, mask;
  maev = USBNRead(0x06);
  if (maev & 0x10)
    _USBNNackEvent();
  if (maev & 0x40)
    _USBNReceiveEvent();
  if (maev & 0x04)
    _USBNTransmitEvent();
  if (maev & 0x02)
    _USBNAlternateEvent();
  mask = USBNRead(0x07);
  USBNWrite(0x07, 0x00);
  USBNWrite(0x07, mask);
}


x86 assembly (clang, -O0):
<USBNInterrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
call   1030 <USBNRead@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     118c <USBNInterrupt+0x2c>
mov    $0x0,%al
call   1080 <_USBNNackEvent@plt>
movzbl -0x1(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     11a3 <USBNInterrupt+0x43>
mov    $0x0,%al
call   1060 <_USBNReceiveEvent@plt>
movzbl -0x1(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     11ba <USBNInterrupt+0x5a>
mov    $0x0,%al
call   1040 <_USBNTransmitEvent@plt>
movzbl -0x1(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11d1 <USBNInterrupt+0x71>
mov    $0x0,%al
call   1070 <_USBNAlternateEvent@plt>
mov    $0x7,%edi
call   1030 <USBNRead@plt>
mov    %al,-0x2(%rbp)
mov    $0x7,%edi
xor    %esi,%esi
call   1050 <USBNWrite@plt>
mov    $0x7,%edi
movzbl -0x2(%rbp),%esi
call   1050 <USBNWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBNInterrupt>:
push   %rbx
mov    $0x6,%edi
call   1030 <USBNRead@plt>
mov    %eax,%ebx
test   $0x10,%al
jne    11ad <USBNInterrupt+0x4d>
test   $0x40,%bl
jne    11b9 <USBNInterrupt+0x59>
test   $0x4,%bl
jne    11c5 <USBNInterrupt+0x65>
test   $0x2,%bl
je     1187 <USBNInterrupt+0x27>
xor    %eax,%eax
call   1070 <_USBNAlternateEvent@plt>
mov    $0x7,%edi
call   1030 <USBNRead@plt>
mov    %eax,%ebx
mov    $0x7,%edi
xor    %esi,%esi
call   1050 <USBNWrite@plt>
movzbl %bl,%esi
mov    $0x7,%edi
pop    %rbx
jmp    1050 <USBNWrite@plt>
xor    %eax,%eax
call   1080 <_USBNNackEvent@plt>
test   $0x40,%bl
je     1176 <USBNInterrupt+0x16>
xor    %eax,%eax
call   1060 <_USBNReceiveEvent@plt>
test   $0x4,%bl
je     117b <USBNInterrupt+0x1b>
xor    %eax,%eax
call   1040 <_USBNTransmitEvent@plt>
test   $0x2,%bl
jne    1180 <USBNInterrupt+0x20>
jmp    1187 <USBNInterrupt+0x27>

LLVM IR (-O0):
define void @USBNInterrupt() {
%1 = alloca i8
%2 = alloca i8
%3 = call zeroext i8 @USBNRead(i32 6)
store i8 %3, i8* %1
%4 = load i8, i8* %1
%5 = zext i8 %4 to i32
%6 = and i32 %5, 16
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @_USBNNackEvent()
br label %10
10: ; preds = %8, %0
%11 = load i8, i8* %1
%12 = zext i8 %11 to i32
%13 = and i32 %12, 64
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 (...) @_USBNReceiveEvent()
br label %17
17: ; preds = %15, %10
%18 = load i8, i8* %1
%19 = zext i8 %18 to i32
%20 = and i32 %19, 4
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %17
%23 = call i32 (...) @_USBNTransmitEvent()
br label %24
24: ; preds = %22, %17
%25 = load i8, i8* %1
%26 = zext i8 %25 to i32
%27 = and i32 %26, 2
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = call i32 (...) @_USBNAlternateEvent()
br label %31
31: ; preds = %29, %24
%32 = call zeroext i8 @USBNRead(i32 7)
store i8 %32, i8* %2
%33 = call i32 @USBNWrite(i32 7, i8 zeroext 0)
%34 = load i8, i8* %2
%35 = call i32 @USBNWrite(i32 7, i8 zeroext %34)
ret void
}

LLVM IR (-O2):
define void @USBNInterrupt() {
%1 = tail call zeroext i8 @USBNRead(i32 6)
%2 = zext i8 %1 to i32
%3 = and i32 %2, 16
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 (...) @_USBNNackEvent()
br label %7
7: ; preds = %5, %0
%8 = and i32 %2, 64
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 (...) @_USBNReceiveEvent()
br label %12
12: ; preds = %10, %7
%13 = and i32 %2, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = tail call i32 (...) @_USBNTransmitEvent()
br label %17
17: ; preds = %15, %12
%18 = and i32 %2, 2
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %17
%21 = tail call i32 (...) @_USBNAlternateEvent()
br label %22
22: ; preds = %20, %17
%23 = tail call zeroext i8 @USBNRead(i32 7)
%24 = tail call i32 @USBNWrite(i32 7, i8 zeroext 0)
%25 = tail call i32 @USBNWrite(i32 7, i8 zeroext %23)
ret void
}