unsigned short IPCLiteMtoCDataRead(unsigned long ulFlag,
                                   unsigned long ulAddress,
                                   unsigned short usLength,
                                   unsigned long ulStatusFlag) {
  unsigned short returnStatus;
  if ((*((volatile unsigned long *)(0x400FB700 + 0x000000010))) &
      (ulFlag | ulStatusFlag)) {
    returnStatus = 0x0001;
  } else {
    if (usLength == 0x00000001) {
      (*((volatile unsigned long *)(0x400FB700 + 0x000000030))) = 0x00000007;
    } else if (usLength == 0x00000002) {
      (*((volatile unsigned long *)(0x400FB700 + 0x000000030))) = 0x00000008;
    }
    (*((volatile unsigned long *)(0x400FB700 + 0x000000034))) = ulAddress;
    (*((volatile unsigned long *)(0x400FB700 + 0x000000008))) |=
        (ulFlag | ulStatusFlag);
    returnStatus = 0x0000;
  }
  return returnStatus;
}


x86 assembly (clang, -O0):
<IPCLiteMtoCDataRead>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x400fb710,%eax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
or     -0x20(%rbp),%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     113f <IPCLiteMtoCDataRead+0x3f>
movw   $0x1,-0x22(%rbp)
jmp    11a8 <IPCLiteMtoCDataRead+0xa8>
movzwl -0x12(%rbp),%eax
cmp    $0x1,%eax
jne    115d <IPCLiteMtoCDataRead+0x5d>
mov    $0x400fb730,%eax
movq   $0x7,(%rax)
jmp    117b <IPCLiteMtoCDataRead+0x7b>
movzwl -0x12(%rbp),%eax
cmp    $0x2,%eax
jne    1176 <IPCLiteMtoCDataRead+0x76>
mov    $0x400fb730,%eax
movq   $0x8,(%rax)
jmp    117b <IPCLiteMtoCDataRead+0x7b>
mov    -0x10(%rbp),%rcx
mov    $0x400fb734,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
or     -0x20(%rbp),%rax
mov    $0x400fb708,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x400fb708,%eax
mov    %rcx,(%rax)
movw   $0x0,-0x22(%rbp)
movzwl -0x22(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IPCLiteMtoCDataRead>:
or     %rcx,%rdi
mov    0x400fb710,%rcx
40
mov    $0x1,%ax
and    %rdi,%rcx
je     1115 <IPCLiteMtoCDataRead+0x15>
ret
cmp    $0x1,%dx
je     1128 <IPCLiteMtoCDataRead+0x28>
cmp    $0x2,%dx
jne    1135 <IPCLiteMtoCDataRead+0x35>
mov    $0x8,%eax
jmp    112d <IPCLiteMtoCDataRead+0x2d>
mov    $0x7,%eax
mov    %rax,0x400fb730
40
mov    %rsi,0x400fb734
40
or     %rdi,0x400fb708
40
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i16 @IPCLiteMtoCDataRead(i64 %0, i64 %1, i16 zeroext %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i16
%8 = alloca i64
%9 = alloca i16
store i64 %0, i64* %5
store i64 %1, i64* %6
store i16 %2, i16* %7
store i64 %3, i64* %8
%10 = load volatile i64, i64* inttoptr (i64 1074771728 to i64*)
%11 = load i64, i64* %5
%12 = load i64, i64* %8
%13 = or i64 %11, %12
%14 = and i64 %10, %13
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %4
store i16 1, i16* %9
br label %35
17: ; preds = %4
%18 = load i16, i16* %7
%19 = zext i16 %18 to i32
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %17
store volatile i64 7, i64* inttoptr (i64 1074771760 to i64*)
br label %28
22: ; preds = %17
%23 = load i16, i16* %7
%24 = zext i16 %23 to i32
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %27
26: ; preds = %22
store volatile i64 8, i64* inttoptr (i64 1074771760 to i64*)
br label %27
27: ; preds = %26, %22
br label %28
28: ; preds = %27, %21
%29 = load i64, i64* %6
store volatile i64 %29, i64* inttoptr (i64 1074771764 to i64*)
%30 = load i64, i64* %5
%31 = load i64, i64* %8
%32 = or i64 %30, %31
%33 = load volatile i64, i64* inttoptr (i64 1074771720 to i64*)
%34 = or i64 %33, %32
store volatile i64 %34, i64* inttoptr (i64 1074771720 to i64*)
store i16 0, i16* %9
br label %35
35: ; preds = %28, %16
%36 = load i16, i16* %9
ret i16 %36
}

LLVM IR (-O2):
define zeroext i16 @IPCLiteMtoCDataRead(i64 %0, i64 %1, i16 zeroext %2, i64 %3) {
%5 = load volatile i64, i64* inttoptr (i64 1074771728 to i64*)
%6 = or i64 %3, %0
%7 = and i64 %5, %6
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %4
switch i16 %2, label %13 [
i16 1, label %11
i16 2, label %10
]
10: ; preds = %9
br label %11
11: ; preds = %9, %10
%12 = phi i64 [ 8, %10 ], [ 7, %9 ]
store volatile i64 %12, i64* inttoptr (i64 1074771760 to i64*)
br label %13
13: ; preds = %11, %9
store volatile i64 %1, i64* inttoptr (i64 1074771764 to i64*)
%14 = load volatile i64, i64* inttoptr (i64 1074771720 to i64*)
%15 = or i64 %14, %6
store volatile i64 %15, i64* inttoptr (i64 1074771720 to i64*)
br label %16
16: ; preds = %4, %13
%17 = phi i16 [ 0, %13 ], [ 1, %4 ]
ret i16 %17
}