#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 CheckIRQ();
int /*<<< orphan*/ DisableInterrupts();
int /*<<< orphan*/ EnableInterrupts();
void ClearAllInterrupts() {
  const unsigned int enabled = CheckIRQ();
  if (enabled == 1) {
    DisableInterrupts();
  }
  {
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x280)))) = 0xFFFFFFFF;
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x284)))) = 0xFFFFFFFF;
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x288)))) = 0xFFFFFFFF;
    (*((volatile unsigned int *)(((0x0FFFC000) + 0x28C)))) = 0xFFFFFFFF;
  }
  if (enabled == 1) {
    EnableInterrupts();
  }
}


x86 assembly (clang, -O0):
<ClearAllInterrupts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <CheckIRQ@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1153 <ClearAllInterrupts+0x23>
mov    $0x0,%al
call   1040 <DisableInterrupts@plt>
mov    $0xfffc280,%eax
movl   $0xffffffff,(%rax)
mov    $0xfffc284,%eax
movl   $0xffffffff,(%rax)
mov    $0xfffc288,%eax
movl   $0xffffffff,(%rax)
mov    $0xfffc28c,%eax
movl   $0xffffffff,(%rax)
cmpl   $0x1,-0x4(%rbp)
jne    1190 <ClearAllInterrupts+0x60>
mov    $0x0,%al
call   1050 <EnableInterrupts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClearAllInterrupts>:
push   %rax
xor    %eax,%eax
call   1030 <CheckIRQ@plt>
cmp    $0x1,%eax
jne    1178 <ClearAllInterrupts+0x48>
xor    %eax,%eax
call   1040 <DisableInterrupts@plt>
movl   $0xffffffff,0xfffc280
ff ff ff ff
movl   $0xffffffff,0xfffc284
ff ff ff ff
movl   $0xffffffff,0xfffc288
ff ff ff ff
movl   $0xffffffff,0xfffc28c
ff ff ff ff
xor    %eax,%eax
pop    %rcx
jmp    1050 <EnableInterrupts@plt>
movl   $0xffffffff,0xfffc280
ff ff ff ff
movl   $0xffffffff,0xfffc284
ff ff ff ff
movl   $0xffffffff,0xfffc288
ff ff ff ff
movl   $0xffffffff,0xfffc28c
ff ff ff ff
pop    %rax
ret

LLVM IR (-O0):
define void @ClearAllInterrupts() {
%1 = alloca i32
%2 = call i32 (...) @CheckIRQ()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @DisableInterrupts()
br label %7
7: ; preds = %5, %0
store volatile i32 -1, i32* inttoptr (i64 268419712 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419716 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419720 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419724 to i32*)
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (...) @EnableInterrupts()
br label %12
12: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @ClearAllInterrupts() {
%1 = tail call i32 (...) @CheckIRQ()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (...) @DisableInterrupts()
store volatile i32 -1, i32* inttoptr (i64 268419712 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419716 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419720 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419724 to i32*)
%5 = tail call i32 (...) @EnableInterrupts()
br label %7
6: ; preds = %0
store volatile i32 -1, i32* inttoptr (i64 268419712 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419716 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419720 to i32*)
store volatile i32 -1, i32* inttoptr (i64 268419724 to i32*)
br label %7
7: ; preds = %6, %3
ret void
}