#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 */
long uninstall_irq(long IntNumber) {
  long i;
  long *vect_addr;
  long *vect_cntl;
  (*(volatile unsigned long *)(0xFFFFF000 + 0x014)) = 1 << IntNumber;
  for (i = 0; i < 16; i++) {
    vect_addr = (long *)(0xFFFFF000 + 0x100 + i * 4);
    vect_cntl = (long *)(0xFFFFF000 + 0x200 + i * 4);
    if ((*vect_cntl & ~0x20) == IntNumber) {
      *vect_addr = (long)NULL;
      *vect_cntl &= ~0x20;
      break;
    }
  }
  if (i == 16) {
    return (0);
  }
  (*(volatile unsigned long *)(0xFFFFF000 + 0x010)) = 1 << IntNumber;
  return (1);
}


x86 assembly (clang, -O0):
<uninstall_irq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0xfffff014,%eax
mov    %rcx,(%rax)
movq   $0x0,-0x18(%rbp)
cmpq   $0x10,-0x18(%rbp)
jge    11ae <uninstall_irq+0xae>
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
movabs $0xfffff100,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
movabs $0xfffff200,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
and    $0xffffffffffffffdf,%rax
cmp    -0x10(%rbp),%rax
jne    1198 <uninstall_irq+0x98>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
and    $0xffffffffffffffdf,%rcx
mov    %rcx,(%rax)
jmp    11ae <uninstall_irq+0xae>
jmp    119d <uninstall_irq+0x9d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <uninstall_irq+0x28>
cmpq   $0x10,-0x18(%rbp)
jne    11c6 <uninstall_irq+0xc6>
movq   $0x0,-0x8(%rbp)
jmp    11e6 <uninstall_irq+0xe6>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0xfffff010,%eax
mov    %rcx,(%rax)
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninstall_irq>:
mov    %rdi,%rcx
mov    $0xfffff200,%eax
mov    $0x1,%edx
shl    %cl,%edx
movslq %edx,%rdx
mov    %rdx,-0x1ec(%rax)
mov    (%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rdi,%rsi
jne    1136 <uninstall_irq+0x36>
lea    -0x100(%rax),%rsi
mov    $0xfffff200,%ecx
jmp    1323 <uninstall_irq+0x223>
mov    0x4(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    1158 <uninstall_irq+0x58>
lea    0x4(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff04,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x8(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    117a <uninstall_irq+0x7a>
lea    0x8(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff08,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0xc(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    119c <uninstall_irq+0x9c>
lea    0xc(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff0c,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x10(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    11be <uninstall_irq+0xbe>
lea    0x10(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff10,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x14(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    11e0 <uninstall_irq+0xe0>
lea    0x14(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff14,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x18(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    1202 <uninstall_irq+0x102>
lea    0x18(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff18,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x1c(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    1224 <uninstall_irq+0x124>
lea    0x1c(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff1c,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x20(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    1246 <uninstall_irq+0x146>
lea    0x20(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff20,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x24(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    1268 <uninstall_irq+0x168>
lea    0x24(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff24,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x28(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    128a <uninstall_irq+0x18a>
lea    0x28(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff28,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x2c(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    12a9 <uninstall_irq+0x1a9>
lea    0x2c(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff2c,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x30(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    12c8 <uninstall_irq+0x1c8>
lea    0x30(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff30,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x34(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    12e7 <uninstall_irq+0x1e7>
lea    0x34(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff34,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x38(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    1306 <uninstall_irq+0x206>
lea    0x38(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff38,%rsi
jmp    1323 <uninstall_irq+0x223>
mov    0x3c(%rax),%rsi
and    $0xffffffffffffffdf,%rsi
cmp    %rcx,%rsi
jne    133a <uninstall_irq+0x23a>
lea    0x3c(%rax),%rcx
mov    $0xfffff200,%esi
add    $0xffffffffffffff3c,%rsi
movq   $0x0,(%rsi)
andb   $0xdf,(%rcx)
mov    %rdx,-0x1f0(%rax)
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @uninstall_irq(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64*
store i64 %0, i64* %3
%7 = load i64, i64* %3
%8 = trunc i64 %7 to i32
%9 = shl i32 1, %8
%10 = sext i32 %9 to i64
store volatile i64 %10, i64* inttoptr (i64 4294963220 to i64*)
store i64 0, i64* %4
br label %11
11: ; preds = %34, %1
%12 = load i64, i64* %4
%13 = icmp slt i64 %12, 16
br i1 %13, label %14, label %37
14: ; preds = %11
%15 = load i64, i64* %4
%16 = mul nsw i64 %15, 4
%17 = add nsw i64 4294963456, %16
%18 = inttoptr i64 %17 to i64*
store i64* %18, i64** %5
%19 = load i64, i64* %4
%20 = mul nsw i64 %19, 4
%21 = add nsw i64 4294963712, %20
%22 = inttoptr i64 %21 to i64*
store i64* %22, i64** %6
%23 = load i64*, i64** %6
%24 = load i64, i64* %23
%25 = and i64 %24, -33
%26 = load i64, i64* %3
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %14
%29 = load i64*, i64** %5
store i64 0, i64* %29
%30 = load i64*, i64** %6
%31 = load i64, i64* %30
%32 = and i64 %31, -33
store i64 %32, i64* %30
br label %37
33: ; preds = %14
br label %34
34: ; preds = %33
%35 = load i64, i64* %4
%36 = add nsw i64 %35, 1
store i64 %36, i64* %4
br label %11
37: ; preds = %28, %11
%38 = load i64, i64* %4
%39 = icmp eq i64 %38, 16
br i1 %39, label %40, label %41
40: ; preds = %37
store i64 0, i64* %2
br label %46
41: ; preds = %37
%42 = load i64, i64* %3
%43 = trunc i64 %42 to i32
%44 = shl i32 1, %43
%45 = sext i32 %44 to i64
store volatile i64 %45, i64* inttoptr (i64 4294963216 to i64*)
store i64 1, i64* %2
br label %46
46: ; preds = %41, %40
%47 = load i64, i64* %2
ret i64 %47
}

LLVM IR (-O2):
define i64 @uninstall_irq(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = shl nuw i32 1, %2
%4 = sext i32 %3 to i64
store volatile i64 %4, i64* inttoptr (i64 4294963220 to i64*)
%5 = load i64, i64* inttoptr (i64 4294963712 to i64*)
%6 = and i64 %5, -33
%7 = icmp eq i64 %6, %0
br i1 %7, label %68, label %8
8: ; preds = %1
%9 = load i64, i64* inttoptr (i64 4294963716 to i64*)
%10 = and i64 %9, -33
%11 = icmp eq i64 %10, %0
br i1 %11, label %68, label %12
12: ; preds = %8
%13 = load i64, i64* inttoptr (i64 4294963720 to i64*)
%14 = and i64 %13, -33
%15 = icmp eq i64 %14, %0
br i1 %15, label %68, label %16
16: ; preds = %12
%17 = load i64, i64* inttoptr (i64 4294963724 to i64*)
%18 = and i64 %17, -33
%19 = icmp eq i64 %18, %0
br i1 %19, label %68, label %20
20: ; preds = %16
%21 = load i64, i64* inttoptr (i64 4294963728 to i64*)
%22 = and i64 %21, -33
%23 = icmp eq i64 %22, %0
br i1 %23, label %68, label %24
24: ; preds = %20
%25 = load i64, i64* inttoptr (i64 4294963732 to i64*)
%26 = and i64 %25, -33
%27 = icmp eq i64 %26, %0
br i1 %27, label %68, label %28
28: ; preds = %24
%29 = load i64, i64* inttoptr (i64 4294963736 to i64*)
%30 = and i64 %29, -33
%31 = icmp eq i64 %30, %0
br i1 %31, label %68, label %32
32: ; preds = %28
%33 = load i64, i64* inttoptr (i64 4294963740 to i64*)
%34 = and i64 %33, -33
%35 = icmp eq i64 %34, %0
br i1 %35, label %68, label %36
36: ; preds = %32
%37 = load i64, i64* inttoptr (i64 4294963744 to i64*)
%38 = and i64 %37, -33
%39 = icmp eq i64 %38, %0
br i1 %39, label %68, label %40
40: ; preds = %36
%41 = load i64, i64* inttoptr (i64 4294963748 to i64*)
%42 = and i64 %41, -33
%43 = icmp eq i64 %42, %0
br i1 %43, label %68, label %44
44: ; preds = %40
%45 = load i64, i64* inttoptr (i64 4294963752 to i64*)
%46 = and i64 %45, -33
%47 = icmp eq i64 %46, %0
br i1 %47, label %68, label %48
48: ; preds = %44
%49 = load i64, i64* inttoptr (i64 4294963756 to i64*)
%50 = and i64 %49, -33
%51 = icmp eq i64 %50, %0
br i1 %51, label %68, label %52
52: ; preds = %48
%53 = load i64, i64* inttoptr (i64 4294963760 to i64*)
%54 = and i64 %53, -33
%55 = icmp eq i64 %54, %0
br i1 %55, label %68, label %56
56: ; preds = %52
%57 = load i64, i64* inttoptr (i64 4294963764 to i64*)
%58 = and i64 %57, -33
%59 = icmp eq i64 %58, %0
br i1 %59, label %68, label %60
60: ; preds = %56
%61 = load i64, i64* inttoptr (i64 4294963768 to i64*)
%62 = and i64 %61, -33
%63 = icmp eq i64 %62, %0
br i1 %63, label %68, label %64
64: ; preds = %60
%65 = load i64, i64* inttoptr (i64 4294963772 to i64*)
%66 = and i64 %65, -33
%67 = icmp eq i64 %66, %0
br i1 %67, label %68, label %73
68: ; preds = %1, %8, %12, %16, %20, %24, %28, %32, %36, %40, %44, %48, %52, %56, %60, %64
%69 = phi i64* [ inttoptr (i64 4294963456 to i64*), %1 ], [ inttoptr (i64 4294963460 to i64*), %8 ], [ inttoptr (i64 4294963464 to i64*), %12 ], [ inttoptr (i64 4294963468 to i64*), %16 ], [ inttoptr (i64 4294963472 to i64*), %20 ], [ inttoptr (i64 4294963476 to i64*), %24 ], [ inttoptr (i64 4294963480 to i64*), %28 ], [ inttoptr (i64 4294963484 to i64*), %32 ], [ inttoptr (i64 4294963488 to i64*), %36 ], [ inttoptr (i64 4294963492 to i64*), %40 ], [ inttoptr (i64 4294963496 to i64*), %44 ], [ inttoptr (i64 4294963500 to i64*), %48 ], [ inttoptr (i64 4294963504 to i64*), %52 ], [ inttoptr (i64 4294963508 to i64*), %56 ], [ inttoptr (i64 4294963512 to i64*), %60 ], [ inttoptr (i64 4294963516 to i64*), %64 ]
%70 = phi i64* [ inttoptr (i64 4294963712 to i64*), %1 ], [ inttoptr (i64 4294963716 to i64*), %8 ], [ inttoptr (i64 4294963720 to i64*), %12 ], [ inttoptr (i64 4294963724 to i64*), %16 ], [ inttoptr (i64 4294963728 to i64*), %20 ], [ inttoptr (i64 4294963732 to i64*), %24 ], [ inttoptr (i64 4294963736 to i64*), %28 ], [ inttoptr (i64 4294963740 to i64*), %32 ], [ inttoptr (i64 4294963744 to i64*), %36 ], [ inttoptr (i64 4294963748 to i64*), %40 ], [ inttoptr (i64 4294963752 to i64*), %44 ], [ inttoptr (i64 4294963756 to i64*), %48 ], [ inttoptr (i64 4294963760 to i64*), %52 ], [ inttoptr (i64 4294963764 to i64*), %56 ], [ inttoptr (i64 4294963768 to i64*), %60 ], [ inttoptr (i64 4294963772 to i64*), %64 ]
store i64 0, i64* %69
%71 = load i64, i64* %70
%72 = and i64 %71, -33
store i64 %72, i64* %70
store volatile i64 %4, i64* inttoptr (i64 4294963216 to i64*)
br label %73
73: ; preds = %64, %68
%74 = phi i64 [ 1, %68 ], [ 0, %64 ]
ret i64 %74
}