void AcknowledgeInterrupt(const unsigned int nIRQ) {
  const unsigned int mod = nIRQ % 32;
  const unsigned int div = nIRQ / 32;
  switch (div) {
  case 0:
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x280)))) = (0x1 << mod);
    break;
  case 1:
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x284)))) = (0x1 << mod);
    break;
  case 2:
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x288)))) = (0x1 << mod);
    break;
  case 3:
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x28C)))) = (0x1 << mod);
    break;
  default:;
    char *str = malloc(22);
    sprintf(str, "nIRQ %d > 127\n", nIRQ);
    kernelpanic(str);
  }
  __asm volatile("nop; nop; nop; nop; nop; nop; nop; nop;");
}


x86 assembly (clang, -O0):
<AcknowledgeInterrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x5,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x3,%rax
ja     11d2 <AcknowledgeInterrupt+0xa2>
mov    -0x20(%rbp),%rax
lea    0xe97(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0xfffc280,%eax
mov    %ecx,(%rax)
jmp    1200 <AcknowledgeInterrupt+0xd0>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0xfffc284,%eax
mov    %ecx,(%rax)
jmp    1200 <AcknowledgeInterrupt+0xd0>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0xfffc288,%eax
mov    %ecx,(%rax)
jmp    1200 <AcknowledgeInterrupt+0xd0>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0xfffc28c,%eax
mov    %ecx,(%rax)
jmp    1200 <AcknowledgeInterrupt+0xd0>
mov    $0x16,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <kernelpanic@plt>
nop
nop
nop
nop
nop
nop
nop
nop
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AcknowledgeInterrupt>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%eax
shr    $0x5,%eax
cmp    $0x3,%eax
ja     1165 <AcknowledgeInterrupt+0x35>
and    $0x1f,%ebx
lea    0xeb6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0xfffc280
jmp    11c5 <AcknowledgeInterrupt+0x95>
mov    $0x16,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
lea    0xe97(%rip),%rsi
mov    %rax,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <kernelpanic@plt>
jmp    11c5 <AcknowledgeInterrupt+0x95>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0xfffc284
jmp    11c5 <AcknowledgeInterrupt+0x95>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0xfffc288
jmp    11c5 <AcknowledgeInterrupt+0x95>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %eax,0xfffc28c
nop
nop
nop
nop
nop
nop
nop
nop
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"nIRQ %d > 127\0A\00"
define void @AcknowledgeInterrupt(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = urem i32 %6, 32
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = udiv i32 %8, 32
store i32 %9, i32* %4
%10 = load i32, i32* %4
switch i32 %10, label %23 [
i32 0, label %11
i32 1, label %14
i32 2, label %17
i32 3, label %20
]
11: ; preds = %1
%12 = load i32, i32* %3
%13 = shl i32 1, %12
store volatile i32 %13, i32* inttoptr (i64 268419712 to i32*)
br label %30
14: ; preds = %1
%15 = load i32, i32* %3
%16 = shl i32 1, %15
store volatile i32 %16, i32* inttoptr (i64 268419716 to i32*)
br label %30
17: ; preds = %1
%18 = load i32, i32* %3
%19 = shl i32 1, %18
store volatile i32 %19, i32* inttoptr (i64 268419720 to i32*)
br label %30
20: ; preds = %1
%21 = load i32, i32* %3
%22 = shl i32 1, %21
store volatile i32 %22, i32* inttoptr (i64 268419724 to i32*)
br label %30
23: ; preds = %1
%24 = call i8* @malloc(i64 22)
store i8* %24, i8** %5
%25 = load i8*, i8** %5
%26 = load i32, i32* %2
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %25, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i8*, i8** %5
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @kernelpanic to i32 (i8*, ...)*)(i8* %28)
br label %30
30: ; preds = %23, %20, %17, %14, %11
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"nIRQ %d > 127\0A\00"
define void @AcknowledgeInterrupt(i32 %0) {
%2 = and i32 %0, 31
%3 = lshr i32 %0, 5
switch i32 %3, label %12 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
4: ; preds = %1
%5 = shl nuw i32 1, %2
store volatile i32 %5, i32* inttoptr (i64 268419712 to i32*)
br label %16
6: ; preds = %1
%7 = shl nuw i32 1, %2
store volatile i32 %7, i32* inttoptr (i64 268419716 to i32*)
br label %16
8: ; preds = %1
%9 = shl nuw i32 1, %2
store volatile i32 %9, i32* inttoptr (i64 268419720 to i32*)
br label %16
10: ; preds = %1
%11 = shl nuw i32 1, %2
store volatile i32 %11, i32* inttoptr (i64 268419724 to i32*)
br label %16
12: ; preds = %1
%13 = tail call dereferenceable_or_null(22) i8* @malloc(i64 22)
%14 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %13, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
%15 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kernelpanic to i32 (i8*, ...)*)(i8* %13)
br label %16
16: ; preds = %12, %10, %8, %6, %4
tail call void asm sideeffect "nop; nop; nop; nop; nop; nop; nop; nop;", "~{dirflag},~{fpsr},~{flags}"()
ret void
}