#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 EMACIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  if (ui32IntFlags & (0x00000001 | 0x00000040 | 0x00004000 | 0x00000004)) {
    ui32IntFlags |= 0x00010000;
  }
  if (ui32IntFlags &
      (0x00000002 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000080 |
       0x00000100 | 0x00000200 | 0x00000400 | 0x00002000)) {
    ui32IntFlags |= 0x00008000;
  }
  if (ui32IntFlags & ~0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000C1C))) |=
        ui32IntFlags & ~0x80000000;
  }
  if (ui32IntFlags & 0x80000000) {
    (*((volatile uint32_t *)(ui32Base + 0x00000FD4))) |= 0x00000001;
  }
}


x86 assembly (clang, -O0):
<EMACIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x4045,%eax
cmp    $0x0,%eax
je     1126 <EMACIntEnable+0x26>
mov    -0x8(%rbp),%eax
or     $0x10000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x27ba,%eax
cmp    $0x0,%eax
je     1142 <EMACIntEnable+0x42>
mov    -0x8(%rbp),%eax
or     $0x8000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7fffffff,%eax
cmp    $0x0,%eax
je     116c <EMACIntEnable+0x6c>
mov    -0x8(%rbp),%edx
and    $0x7fffffff,%edx
mov    -0x4(%rbp),%eax
add    $0xc1c,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     118e <EMACIntEnable+0x8e>
mov    -0x4(%rbp),%eax
add    $0xfd4,%eax
cltq
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACIntEnable>:
mov    %esi,%ecx
or     $0x10000,%ecx
test   $0x4045,%esi
cmove  %esi,%ecx
mov    %ecx,%eax
or     $0x8000,%eax
test   $0x27ba,%ecx
cmove  %ecx,%eax
mov    %eax,%edx
movslq %edi,%rcx
and    $0x7fffffff,%edx
je     1134 <EMACIntEnable+0x34>
or     %edx,0xc1c(%rcx)
test   %eax,%eax
js     1139 <EMACIntEnable+0x39>
ret
orl    $0x1,0xfd4(%rcx)
ret

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

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