void IPCLiteCtoMClearBits_Protected(unsigned long ulFlag,
                                    unsigned long ulStatusFlag) {
  unsigned short *pusAddress;
  unsigned long *pulAddress;
  unsigned long ulWRALLOWtemp;
  while (
      !((*((volatile unsigned long *)(0x400FB700 + 0x000000004))) & ulFlag)) {
  }
  ulWRALLOWtemp = (*((volatile unsigned long *)(0x400FB980)));
  (*((volatile unsigned long *)(0x400FB980))) = 0xA5A5A5A5;
  if ((*((volatile unsigned long *)(0x400FB700 + 0x000000020))) == 0x0000000B) {
    pusAddress = (unsigned short *)(*(
        (volatile unsigned long *)(0x400FB700 + 0x000000024)));
    *pusAddress &= ~((unsigned short)(*(
        (volatile unsigned long *)(0x400FB700 + 0x000000028))));
    (*((volatile unsigned long *)(0x400FB700 + 0x00000002C))) =
        (unsigned long)*pusAddress;
    (*((volatile unsigned long *)(0x400FB700 + 0x000000000))) |=
        (ulStatusFlag | ulFlag);
  } else if ((*((volatile unsigned long *)(0x400FB700 + 0x000000020))) ==
             0x0000000C) {
    pulAddress = (unsigned long *)(*(
        (volatile unsigned long *)(0x400FB700 + 0x000000024)));
    *pulAddress &= ~((unsigned long)(*(
        (volatile unsigned long *)(0x400FB700 + 0x000000028))));
    (*((volatile unsigned long *)(0x400FB700 + 0x00000002C))) =
        (unsigned long)*pulAddress;
    (*((volatile unsigned long *)(0x400FB700 + 0x000000000))) |=
        (ulStatusFlag | ulFlag);
  } else {
    (*((volatile unsigned long *)(0x400FB700 + 0x000000000))) |= (ulFlag);
  }
  (*((volatile unsigned long *)(0x400FB980))) = ulWRALLOWtemp;
}


x86 assembly (clang, -O0):
<IPCLiteCtoMClearBits_Protected>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x400fb704,%eax
mov    (%rax),%rax
and    -0x8(%rbp),%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112e <IPCLiteCtoMClearBits_Protected+0x2e>
jmp    1133 <IPCLiteCtoMClearBits_Protected+0x33>
jmp    110c <IPCLiteCtoMClearBits_Protected+0xc>
mov    $0x400fb980,%eax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    $0x400fb980,%eax
mov    $0xa5a5a5a5,%ecx
mov    %rcx,(%rax)
mov    $0x400fb720,%eax
mov    (%rax),%rax
cmp    $0xb,%rax
jne    11b5 <IPCLiteCtoMClearBits_Protected+0xb5>
mov    $0x400fb724,%eax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    $0x400fb728,%eax
mov    (%rax),%rax
movzwl %ax,%edx
xor    $0xffffffff,%edx
mov    -0x18(%rbp),%rax
movzwl (%rax),%ecx
and    %edx,%ecx
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
mov    %eax,%ecx
mov    $0x400fb72c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
or     -0x8(%rbp),%rax
mov    $0x400fb700,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb700,%eax
mov    %rcx,(%rax)
jmp    1234 <IPCLiteCtoMClearBits_Protected+0x134>
mov    $0x400fb720,%eax
mov    (%rax),%rax
cmp    $0xc,%rax
jne    1218 <IPCLiteCtoMClearBits_Protected+0x118>
mov    $0x400fb724,%eax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x400fb728,%eax
mov    (%rax),%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x20(%rbp),%rax
and    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
mov    $0x400fb72c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
or     -0x8(%rbp),%rax
mov    $0x400fb700,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb700,%eax
mov    %rcx,(%rax)
jmp    122f <IPCLiteCtoMClearBits_Protected+0x12f>
mov    -0x8(%rbp),%rax
mov    $0x400fb700,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb700,%eax
mov    %rcx,(%rax)
jmp    1234 <IPCLiteCtoMClearBits_Protected+0x134>
mov    -0x28(%rbp),%rcx
mov    $0x400fb980,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<IPCLiteCtoMClearBits_Protected>:
mov    0x400fb704,%rax
40
and    %rdi,%rax
je     1100 <IPCLiteCtoMClearBits_Protected>
mov    0x400fb980,%rax
40
mov    $0xa5a5a5a5,%ecx
mov    %rcx,0x400fb980
40
mov    0x400fb720,%rcx
40
cmp    $0xb,%rcx
jne    114d <IPCLiteCtoMClearBits_Protected+0x4d>
mov    0x400fb724,%rcx
40
mov    0x400fb728,%rdx
40
not    %edx
and    (%rcx),%dx
movzwl %dx,%edx
mov    %dx,(%rcx)
jmp    1174 <IPCLiteCtoMClearBits_Protected+0x74>
mov    0x400fb720,%rcx
40
cmp    $0xc,%rcx
jne    1189 <IPCLiteCtoMClearBits_Protected+0x89>
mov    0x400fb724,%rcx
40
mov    0x400fb728,%rdx
40
not    %rdx
and    (%rcx),%rdx
mov    %rdx,(%rcx)
mov    %rdx,0x400fb72c
40
or     %rdi,%rsi
mov    0x400fb700,%rdi
40
jmp    1191 <IPCLiteCtoMClearBits_Protected+0x91>
mov    0x400fb700,%rsi
40
or     %rsi,%rdi
mov    %rdi,0x400fb700
40
mov    %rax,0x400fb980
40
ret

LLVM IR (-O0):
define void @IPCLiteCtoMClearBits_Protected(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i16*
%6 = alloca i64*
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
br label %8
8: ; preds = %14, %2
%9 = load volatile i64, i64* inttoptr (i64 1074771716 to i64*)
%10 = load i64, i64* %3
%11 = and i64 %9, %10
%12 = icmp ne i64 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %15
14: ; preds = %8
br label %8
15: ; preds = %8
%16 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store i64 %16, i64* %7
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
%17 = load volatile i64, i64* inttoptr (i64 1074771744 to i64*)
%18 = icmp eq i64 %17, 11
br i1 %18, label %19, label %39
19: ; preds = %15
%20 = load volatile i64, i64* inttoptr (i64 1074771748 to i64*)
%21 = inttoptr i64 %20 to i16*
store i16* %21, i16** %5
%22 = load volatile i64, i64* inttoptr (i64 1074771752 to i64*)
%23 = trunc i64 %22 to i16
%24 = zext i16 %23 to i32
%25 = xor i32 %24, -1
%26 = load i16*, i16** %5
%27 = load i16, i16* %26
%28 = zext i16 %27 to i32
%29 = and i32 %28, %25
%30 = trunc i32 %29 to i16
store i16 %30, i16* %26
%31 = load i16*, i16** %5
%32 = load i16, i16* %31
%33 = zext i16 %32 to i64
store volatile i64 %33, i64* inttoptr (i64 1074771756 to i64*)
%34 = load i64, i64* %4
%35 = load i64, i64* %3
%36 = or i64 %34, %35
%37 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
%38 = or i64 %37, %36
store volatile i64 %38, i64* inttoptr (i64 1074771712 to i64*)
br label %62
39: ; preds = %15
%40 = load volatile i64, i64* inttoptr (i64 1074771744 to i64*)
%41 = icmp eq i64 %40, 12
br i1 %41, label %42, label %57
42: ; preds = %39
%43 = load volatile i64, i64* inttoptr (i64 1074771748 to i64*)
%44 = inttoptr i64 %43 to i64*
store i64* %44, i64** %6
%45 = load volatile i64, i64* inttoptr (i64 1074771752 to i64*)
%46 = xor i64 %45, -1
%47 = load i64*, i64** %6
%48 = load i64, i64* %47
%49 = and i64 %48, %46
store i64 %49, i64* %47
%50 = load i64*, i64** %6
%51 = load i64, i64* %50
store volatile i64 %51, i64* inttoptr (i64 1074771756 to i64*)
%52 = load i64, i64* %4
%53 = load i64, i64* %3
%54 = or i64 %52, %53
%55 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
%56 = or i64 %55, %54
store volatile i64 %56, i64* inttoptr (i64 1074771712 to i64*)
br label %61
57: ; preds = %39
%58 = load i64, i64* %3
%59 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
%60 = or i64 %59, %58
store volatile i64 %60, i64* inttoptr (i64 1074771712 to i64*)
br label %61
61: ; preds = %57, %42
br label %62
62: ; preds = %61, %19
%63 = load i64, i64* %7
store volatile i64 %63, i64* inttoptr (i64 1074772352 to i64*)
ret void
}

LLVM IR (-O2):
define void @IPCLiteCtoMClearBits_Protected(i64 %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = load volatile i64, i64* inttoptr (i64 1074771716 to i64*)
%5 = and i64 %4, %0
%6 = icmp eq i64 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
%8 = load volatile i64, i64* inttoptr (i64 1074772352 to i64*)
store volatile i64 2779096485, i64* inttoptr (i64 1074772352 to i64*)
%9 = load volatile i64, i64* inttoptr (i64 1074771744 to i64*)
%10 = icmp eq i64 %9, 11
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load volatile i64, i64* inttoptr (i64 1074771748 to i64*)
%13 = inttoptr i64 %12 to i16*
%14 = load volatile i64, i64* inttoptr (i64 1074771752 to i64*)
%15 = trunc i64 %14 to i16
%16 = xor i16 %15, -1
%17 = load i16, i16* %13
%18 = and i16 %17, %16
store i16 %18, i16* %13
%19 = zext i16 %18 to i64
store volatile i64 %19, i64* inttoptr (i64 1074771756 to i64*)
%20 = or i64 %1, %0
%21 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
br label %36
22: ; preds = %7
%23 = load volatile i64, i64* inttoptr (i64 1074771744 to i64*)
%24 = icmp eq i64 %23, 12
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load volatile i64, i64* inttoptr (i64 1074771748 to i64*)
%27 = inttoptr i64 %26 to i64*
%28 = load volatile i64, i64* inttoptr (i64 1074771752 to i64*)
%29 = xor i64 %28, -1
%30 = load i64, i64* %27
%31 = and i64 %30, %29
store i64 %31, i64* %27
store volatile i64 %31, i64* inttoptr (i64 1074771756 to i64*)
%32 = or i64 %1, %0
%33 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
br label %36
34: ; preds = %22
%35 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
br label %36
36: ; preds = %25, %34, %11
%37 = phi i64 [ %33, %25 ], [ %0, %34 ], [ %21, %11 ]
%38 = phi i64 [ %32, %25 ], [ %35, %34 ], [ %20, %11 ]
%39 = or i64 %38, %37
store volatile i64 %39, i64* inttoptr (i64 1074771712 to i64*)
store volatile i64 %8, i64* inttoptr (i64 1074772352 to i64*)
ret void
}