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


x86 assembly (clang, -O0):
<SPIIntDisable>:
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 <SPIIntDisable+0x3f>
mov    -0x8(%rbp),%rdi
call   1030 <SPIDmaMaskGet@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x44026090,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
and    $0x10000000,%rax
cmp    $0x0,%rax
je     1181 <SPIIntDisable+0x71>
mov    -0x8(%rbp),%rdi
call   1030 <SPIDmaMaskGet@plt>
sar    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x44026090,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdx
and    $0x3000f,%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0x11c(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x11c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @SPIIntDisable(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 1141006480 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 1141006480 to i64*)
br label %24
24: ; preds = %18, %14
%25 = load i64, i64* %4
%26 = and i64 %25, 196623
%27 = xor i64 %26, -1
%28 = load i64, i64* %3
%29 = add i64 %28, 284
%30 = inttoptr i64 %29 to i64*
%31 = load volatile i64, i64* %30
%32 = and i64 %31, %27
store volatile i64 %32, i64* %30
ret void
}

LLVM IR (-O2):
define void @SPIIntDisable(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 1141006480 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 1141006480 to i64*)
br label %15
15: ; preds = %11, %8
%16 = and i64 %1, 196623
%17 = xor i64 %16, -1
%18 = add i64 %0, 284
%19 = inttoptr i64 %18 to i64*
%20 = load volatile i64, i64* %19
%21 = and i64 %20, %17
store volatile i64 %21, i64* %19
ret void
}