#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 */
typedef int uint32_t;

/* Variables and functions */
void EMACIntDisable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  uint32_t ui32Mask;
  ;
  ;
  ui32Mask = (*((volatile uint32_t *)(ui32Base + 0x00000C1C)));
  ui32Mask &= ~(ui32IntFlags & ~0x80000000);
  if (!(ui32Mask & (0x00000001 | 0x00000040 | 0x00004000 | 0x00000004))) {
    ui32Mask &= ~0x00010000;
  }
  if (!(ui32Mask &
        (0x00000002 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000080 |
         0x00000100 | 0x00000200 | 0x00000400 | 0x00002000))) {
    ui32Mask &= ~0x00008000;
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000C1C))) = ui32Mask;
  if (ui32IntFlags & 0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000FD4))) &= ~0x00000001;
  }
}


x86 assembly (clang, -O0):
<EMACIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc1c,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7fffffff,%eax
xor    $0xffffffff,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x4045,%eax
cmp    $0x0,%eax
jne    1146 <EMACIntDisable+0x46>
mov    -0xc(%rbp),%eax
and    $0xfffeffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x27ba,%eax
cmp    $0x0,%eax
jne    1162 <EMACIntDisable+0x62>
mov    -0xc(%rbp),%eax
and    $0xffff7fff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xc1c,%eax
cltq
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1193 <EMACIntDisable+0x93>
mov    -0x4(%rbp),%eax
add    $0xfd4,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACIntDisable>:
mov    %esi,%ecx
not    %ecx
movslq %edi,%rax
or     $0x80000000,%ecx
and    0xc1c(%rax),%ecx
mov    %ecx,%edx
and    $0xfffeffff,%edx
test   $0x4045,%ecx
cmovne %ecx,%edx
mov    %edx,%ecx
and    $0xffff7fff,%ecx
test   $0x27ba,%edx
cmovne %edx,%ecx
mov    %ecx,0xc1c(%rax)
test   %esi,%esi
js     1140 <EMACIntDisable+0x40>
ret
andl   $0xfffffffe,0xfd4(%rax)
ret

LLVM IR (-O0):
define void @EMACIntDisable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 3100
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
store i32 %10, i32* %5
%11 = load i32, i32* %4
%12 = and i32 %11, 2147483647
%13 = xor i32 %12, -1
%14 = load i32, i32* %5
%15 = and i32 %14, %13
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = and i32 %16, 16453
%18 = icmp ne i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %2
%20 = load i32, i32* %5
%21 = and i32 %20, -65537
store i32 %21, i32* %5
br label %22
22: ; preds = %19, %2
%23 = load i32, i32* %5
%24 = and i32 %23, 10170
%25 = icmp ne i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %22
%27 = load i32, i32* %5
%28 = and i32 %27, -32769
store i32 %28, i32* %5
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* %5
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 3100
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i32*
store volatile i32 %30, i32* %34
%35 = load i32, i32* %4
%36 = and i32 %35, -2147483648
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %45
38: ; preds = %29
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 4052
%41 = sext i32 %40 to i64
%42 = inttoptr i64 %41 to i32*
%43 = load volatile i32, i32* %42
%44 = and i32 %43, -2
store volatile i32 %44, i32* %42
br label %45
45: ; preds = %38, %29
ret void
}

LLVM IR (-O2):
define void @EMACIntDisable(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 3100
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %1, 2147483647
%8 = xor i32 %7, -1
%9 = and i32 %6, %8
%10 = and i32 %9, 16453
%11 = icmp eq i32 %10, 0
%12 = and i32 %9, -65537
%13 = select i1 %11, i32 %12, i32 %9
%14 = and i32 %13, 10170
%15 = icmp eq i32 %14, 0
%16 = and i32 %13, -32769
%17 = select i1 %15, i32 %16, i32 %13
store volatile i32 %17, i32* %5
%18 = icmp sgt i32 %1, -1
br i1 %18, label %25, label %19
19: ; preds = %2
%20 = add nsw i32 %0, 4052
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
%24 = and i32 %23, -2
store volatile i32 %24, i32* %22
br label %25
25: ; preds = %19, %2
ret void
}