#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 SPIDmaMaskGet(unsigned long);
void SPIIntClear(unsigned long ulBase, unsigned long ulIntFlags) {
  unsigned long ulDmaMsk;
  if (ulIntFlags & 0x20000000) {
    ulDmaMsk = SPIDmaMaskGet(ulBase);
    (*((volatile unsigned long *)(0x44026000 + 0x0000009C))) = ulDmaMsk;
  }
  if (ulIntFlags & 0x10000000) {
    ulDmaMsk = (SPIDmaMaskGet(ulBase) >> 1);
    (*((volatile unsigned long *)(0x44026000 + 0x0000009C))) = ulDmaMsk;
  }
  (*((volatile unsigned long *)(ulBase + 0x00000118))) =
      (ulIntFlags & 0x0003000F);
}


x86 assembly (clang, -O0):
<SPIIntClear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x20000000,%rax
cmp    $0x0,%rax
je     114f <SPIIntClear+0x3f>
mov    -0x8(%rbp),%rdi
call   1030 <SPIDmaMaskGet@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x4402609c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
and    $0x10000000,%rax
cmp    $0x0,%rax
je     1181 <SPIIntClear+0x71>
mov    -0x8(%rbp),%rdi
call   1030 <SPIDmaMaskGet@plt>
sar    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x4402609c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
and    $0x3000f,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x118(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPIIntClear>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   $0x20000000,%ebx
je     1134 <SPIIntClear+0x24>
mov    %r14,%rdi
call   1030 <SPIDmaMaskGet@plt>
cltq
mov    %rax,0x4402609c
44
test   $0x10000000,%ebx
je     1150 <SPIIntClear+0x40>
mov    %r14,%rdi
call   1030 <SPIDmaMaskGet@plt>
sar    %eax
cltq
mov    %rax,0x4402609c
44
and    $0x3000f,%ebx
mov    %rbx,0x118(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @SPIIntClear(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = and i64 %6, 536870912
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i64, i64* %3
%11 = call i32 @SPIDmaMaskGet(i64 %10)
%12 = sext i32 %11 to i64
store i64 %12, i64* %5
%13 = load i64, i64* %5
store volatile i64 %13, i64* inttoptr (i64 1141006492 to i64*)
br label %14
14: ; preds = %9, %2
%15 = load i64, i64* %4
%16 = and i64 %15, 268435456
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i64, i64* %3
%20 = call i32 @SPIDmaMaskGet(i64 %19)
%21 = ashr i32 %20, 1
%22 = sext i32 %21 to i64
store i64 %22, i64* %5
%23 = load i64, i64* %5
store volatile i64 %23, i64* inttoptr (i64 1141006492 to i64*)
br label %24
24: ; preds = %18, %14
%25 = load i64, i64* %4
%26 = and i64 %25, 196623
%27 = load i64, i64* %3
%28 = add i64 %27, 280
%29 = inttoptr i64 %28 to i64*
store volatile i64 %26, i64* %29
ret void
}

LLVM IR (-O2):
define void @SPIIntClear(i64 %0, i64 %1) {
%3 = and i64 %1, 536870912
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @SPIDmaMaskGet(i64 %0)
%7 = sext i32 %6 to i64
store volatile i64 %7, i64* inttoptr (i64 1141006492 to i64*)
br label %8
8: ; preds = %5, %2
%9 = and i64 %1, 268435456
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @SPIDmaMaskGet(i64 %0)
%13 = ashr i32 %12, 1
%14 = sext i32 %13 to i64
store volatile i64 %14, i64* inttoptr (i64 1141006492 to i64*)
br label %15
15: ; preds = %11, %8
%16 = and i64 %1, 196623
%17 = add i64 %0, 280
%18 = inttoptr i64 %17 to i64*
store volatile i64 %16, i64* %18
ret void
}