#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 */
uint32_t ADCIntStatus(uint32_t ui32Base, uint32_t ui32SequenceNum,
                      bool bMasked) {
  uint32_t ui32Temp;
  ;
  ;
  if (bMasked) {
    ui32Temp = (*((volatile uint32_t *)(ui32Base + 0x0000000C))) &
               (0x10001 << ui32SequenceNum);
  } else {
    ui32Temp = ((*((volatile uint32_t *)(ui32Base + 0x00000004))) &
                (0x10000 | (1 << ui32SequenceNum)));
    if (ui32Temp & 0x10000) {
      ui32Temp |= 0xF0000;
      ui32Temp &= ~(0x10000 << ui32SequenceNum);
    }
  }
  return (ui32Temp);
}


x86 assembly (clang, -O0):
<ADCIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1137 <ADCIntStatus+0x37>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
mov    $0x10001,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <ADCIntStatus+0x8c>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     $0x10000,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x10000,%eax
cmp    $0x0,%eax
je     1187 <ADCIntStatus+0x87>
mov    -0x10(%rbp),%eax
or     $0xf0000,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x10000,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    118c <ADCIntStatus+0x8c>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCIntStatus>:
test   %edx,%edx
je     1114 <ADCIntStatus+0x14>
mov    $0x10001,%eax
mov    %esi,%ecx
shl    %cl,%eax
movslq %edi,%rcx
and    0xc(%rcx),%eax
ret
movslq %edi,%rax
mov    0x4(%rax),%ecx
mov    $0x10000,%edx
mov    $0x10000,%eax
bts    %esi,%eax
and    %ecx,%eax
test   $0x10000,%ecx
je     113e <ADCIntStatus+0x3e>
mov    %esi,%ecx
shl    %cl,%edx
or     $0xf0000,%eax
not    %edx
and    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @ADCIntStatus(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = add nsw i32 %0, 12
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = shl i32 65537, %1
%11 = and i32 %9, %10
br label %27
12: ; preds = %3
%13 = add nsw i32 %0, 4
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = shl nuw i32 1, %1
%18 = or i32 %17, 65536
%19 = and i32 %16, %18
%20 = and i32 %16, 65536
%21 = icmp eq i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %12
%23 = or i32 %19, 983040
%24 = shl i32 65536, %1
%25 = xor i32 %24, -1
%26 = and i32 %23, %25
br label %27
27: ; preds = %12, %22, %5
%28 = phi i32 [ %11, %5 ], [ %26, %22 ], [ %19, %12 ]
ret i32 %28
}