void IPCLiteCtoMSetBits_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))) == 0x00000009) {
    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))) ==
             0x0000000A) {
    pulAddress = (unsigned long *)(*(
        (volatile unsigned long *)(0x400FB700 + 0x000000024)));
    *pulAddress |= (unsigned long)(*(
        (volatile unsigned long *)(0x400FB700 + 0x000000028)));
    (*((volatile unsigned long *)(0x400FB700 + 0x00000002C))) = *pulAddress;
    (*((volatile unsigned long *)(0x400FB700 + 0x000000000))) |=
        (ulStatusFlag | ulFlag);
  } else {
    (*((volatile unsigned long *)(0x400FB700 + 0x000000000))) |= (ulFlag);
  }
  (*((volatile unsigned long *)(0x400FB980))) = ulWRALLOWtemp;
}


x86 assembly (clang, -O0):
<IPCLiteCtoMSetBits_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 <IPCLiteCtoMSetBits_Protected+0x2e>
jmp    1133 <IPCLiteCtoMSetBits_Protected+0x33>
jmp    110c <IPCLiteCtoMSetBits_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    $0x9,%rax
jne    11b2 <IPCLiteCtoMSetBits_Protected+0xb2>
mov    $0x400fb724,%eax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    $0x400fb728,%eax
mov    (%rax),%rax
movzwl %ax,%edx
mov    -0x18(%rbp),%rax
movzwl (%rax),%ecx
or     %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    122d <IPCLiteCtoMSetBits_Protected+0x12d>
mov    $0x400fb720,%eax
mov    (%rax),%rax
cmp    $0xa,%rax
jne    1211 <IPCLiteCtoMSetBits_Protected+0x111>
mov    $0x400fb724,%eax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x400fb728,%eax
mov    (%rax),%rcx
mov    -0x20(%rbp),%rax
or     (%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    1228 <IPCLiteCtoMSetBits_Protected+0x128>
mov    -0x8(%rbp),%rax
mov    $0x400fb700,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb700,%eax
mov    %rcx,(%rax)
jmp    122d <IPCLiteCtoMSetBits_Protected+0x12d>
mov    -0x28(%rbp),%rcx
mov    $0x400fb980,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<IPCLiteCtoMSetBits_Protected>:
mov    0x400fb704,%rax
40
and    %rdi,%rax
je     1100 <IPCLiteCtoMSetBits_Protected>
mov    0x400fb980,%rax
40
mov    $0xa5a5a5a5,%ecx
mov    %rcx,0x400fb980
40
mov    0x400fb720,%rcx
40
cmp    $0x9,%rcx
jne    114b <IPCLiteCtoMSetBits_Protected+0x4b>
mov    0x400fb724,%rcx
40
mov    0x400fb728,%rdx
40
or     (%rcx),%dx
movzwl %dx,%edx
mov    %dx,(%rcx)
jmp    116f <IPCLiteCtoMSetBits_Protected+0x6f>
mov    0x400fb720,%rcx
40
cmp    $0xa,%rcx
jne    1184 <IPCLiteCtoMSetBits_Protected+0x84>
mov    0x400fb724,%rcx
40
mov    0x400fb728,%rdx
40
or     (%rcx),%rdx
mov    %rdx,(%rcx)
mov    %rdx,0x400fb72c
40
or     %rdi,%rsi
mov    0x400fb700,%rdi
40
jmp    118c <IPCLiteCtoMSetBits_Protected+0x8c>
mov    0x400fb700,%rsi
40
or     %rsi,%rdi
mov    %rdi,0x400fb700
40
mov    %rax,0x400fb980
40
ret

LLVM IR (-O0):
define void @IPCLiteCtoMSetBits_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, 9
br i1 %18, label %19, label %38
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 = load i16*, i16** %5
%26 = load i16, i16* %25
%27 = zext i16 %26 to i32
%28 = or i32 %27, %24
%29 = trunc i32 %28 to i16
store i16 %29, i16* %25
%30 = load i16*, i16** %5
%31 = load i16, i16* %30
%32 = zext i16 %31 to i64
store volatile i64 %32, i64* inttoptr (i64 1074771756 to i64*)
%33 = load i64, i64* %4
%34 = load i64, i64* %3
%35 = or i64 %33, %34
%36 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
%37 = or i64 %36, %35
store volatile i64 %37, i64* inttoptr (i64 1074771712 to i64*)
br label %60
38: ; preds = %15
%39 = load volatile i64, i64* inttoptr (i64 1074771744 to i64*)
%40 = icmp eq i64 %39, 10
br i1 %40, label %41, label %55
41: ; preds = %38
%42 = load volatile i64, i64* inttoptr (i64 1074771748 to i64*)
%43 = inttoptr i64 %42 to i64*
store i64* %43, i64** %6
%44 = load volatile i64, i64* inttoptr (i64 1074771752 to i64*)
%45 = load i64*, i64** %6
%46 = load i64, i64* %45
%47 = or i64 %46, %44
store i64 %47, i64* %45
%48 = load i64*, i64** %6
%49 = load i64, i64* %48
store volatile i64 %49, i64* inttoptr (i64 1074771756 to i64*)
%50 = load i64, i64* %4
%51 = load i64, i64* %3
%52 = or i64 %50, %51
%53 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
%54 = or i64 %53, %52
store volatile i64 %54, i64* inttoptr (i64 1074771712 to i64*)
br label %59
55: ; preds = %38
%56 = load i64, i64* %3
%57 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
%58 = or i64 %57, %56
store volatile i64 %58, i64* inttoptr (i64 1074771712 to i64*)
br label %59
59: ; preds = %55, %41
br label %60
60: ; preds = %59, %19
%61 = load i64, i64* %7
store volatile i64 %61, i64* inttoptr (i64 1074772352 to i64*)
ret void
}

LLVM IR (-O2):
define void @IPCLiteCtoMSetBits_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, 9
br i1 %10, label %11, label %21
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 = load i16, i16* %13
%17 = or i16 %16, %15
store i16 %17, i16* %13
%18 = zext i16 %17 to i64
store volatile i64 %18, i64* inttoptr (i64 1074771756 to i64*)
%19 = or i64 %1, %0
%20 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
br label %34
21: ; preds = %7
%22 = load volatile i64, i64* inttoptr (i64 1074771744 to i64*)
%23 = icmp eq i64 %22, 10
br i1 %23, label %24, label %32
24: ; preds = %21
%25 = load volatile i64, i64* inttoptr (i64 1074771748 to i64*)
%26 = inttoptr i64 %25 to i64*
%27 = load volatile i64, i64* inttoptr (i64 1074771752 to i64*)
%28 = load i64, i64* %26
%29 = or i64 %28, %27
store i64 %29, i64* %26
store volatile i64 %29, i64* inttoptr (i64 1074771756 to i64*)
%30 = or i64 %1, %0
%31 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
br label %34
32: ; preds = %21
%33 = load volatile i64, i64* inttoptr (i64 1074771712 to i64*)
br label %34
34: ; preds = %24, %32, %11
%35 = phi i64 [ %31, %24 ], [ %0, %32 ], [ %20, %11 ]
%36 = phi i64 [ %30, %24 ], [ %33, %32 ], [ %19, %11 ]
%37 = or i64 %36, %35
store volatile i64 %37, i64* inttoptr (i64 1074771712 to i64*)
store volatile i64 %8, i64* inttoptr (i64 1074772352 to i64*)
ret void
}