void CANMessageSetRx(void) {
  unsigned short usCmdMaskReg;
  unsigned short usMaskReg[2];
  unsigned short usArbReg[2];
  unsigned short usMsgCtrl;
  while ((*((volatile unsigned long *)(0x40040000 + 0x00000020))) &
         0x00008000) {
  }
  usCmdMaskReg = (0x00000080 | 0x00000002 | 0x00000001 | 0x00000010 |
                  0x00000040 | 0x00000020);
  usMsgCtrl = 0x00001000 | 0x00000080;
  usMaskReg[0] = (unsigned short)(0x00020000 | 0x1f000000);
  usMaskReg[1] =
      (unsigned short)(0x00008000 | ((0x00020000 | 0x1f000000) >> 16));
  usArbReg[0] = (0x00020000 | 0x1f000000) & 0x0000FFFF;
  usArbReg[1] = (((0x00020000 | 0x1f000000) >> 16) & 0x00001FFF) |
                (0x00008000 | 0x00004000);
  (*((volatile unsigned long *)(0x40040000 + 0x00000024))) = usCmdMaskReg;
  (*((volatile unsigned long *)(0x40040000 + 0x00000028))) = usMaskReg[0];
  (*((volatile unsigned long *)(0x40040000 + 0x0000002C))) = usMaskReg[1];
  (*((volatile unsigned long *)(0x40040000 + 0x00000030))) = usArbReg[0];
  (*((volatile unsigned long *)(0x40040000 + 0x00000034))) = usArbReg[1];
  (*((volatile unsigned long *)(0x40040000 + 0x00000038))) = usMsgCtrl;
  (*((volatile unsigned long *)(0x40040000 + 0x00000020))) = 1 & 0x0000003F;
}


x86 assembly (clang, -O0):
<CANMessageSetRx>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40040020,%eax
mov    (%rax),%rax
and    $0x8000,%rax
cmp    $0x0,%rax
je     1121 <CANMessageSetRx+0x21>
jmp    1104 <CANMessageSetRx+0x4>
movw   $0xf3,-0x2(%rbp)
movw   $0x1080,-0xc(%rbp)
movw   $0x0,-0x6(%rbp)
movw   $0x9f02,-0x4(%rbp)
movw   $0x0,-0xa(%rbp)
movw   $0xdf02,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
mov    %eax,%ecx
mov    $0x40040024,%eax
mov    %rcx,(%rax)
movzwl -0x6(%rbp),%eax
mov    %eax,%ecx
mov    $0x40040028,%eax
mov    %rcx,(%rax)
movzwl -0x4(%rbp),%eax
mov    %eax,%ecx
mov    $0x4004002c,%eax
mov    %rcx,(%rax)
movzwl -0xa(%rbp),%eax
mov    %eax,%ecx
mov    $0x40040030,%eax
mov    %rcx,(%rax)
movzwl -0x8(%rbp),%eax
mov    %eax,%ecx
mov    $0x40040034,%eax
mov    %rcx,(%rax)
movzwl -0xc(%rbp),%eax
mov    %eax,%ecx
mov    $0x40040038,%eax
mov    %rcx,(%rax)
mov    $0x40040020,%eax
movq   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CANMessageSetRx>:
testq  $0x8000,0x40040020
jne    1100 <CANMessageSetRx>
movq   $0xf3,0x40040024
movq   $0x0,0x40040028
movq   $0x9f02,0x4004002c
movq   $0x0,0x40040030
movq   $0xdf02,0x40040034
movq   $0x1080,0x40040038
movq   $0x1,0x40040020
ret

LLVM IR (-O0):
define void @CANMessageSetRx() {
%1 = alloca i16
%2 = alloca [2 x i16]
%3 = alloca [2 x i16]
%4 = alloca i16
br label %5
5: ; preds = %9, %0
%6 = load volatile i64, i64* inttoptr (i64 1074004000 to i64*)
%7 = and i64 %6, 32768
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
store i16 243, i16* %1
store i16 4224, i16* %4
%11 = getelementptr inbounds [2 x i16], [2 x i16]* %2, i64 0, i64 0
store i16 0, i16* %11
%12 = getelementptr inbounds [2 x i16], [2 x i16]* %2, i64 0, i64 1
store i16 -24830, i16* %12
%13 = getelementptr inbounds [2 x i16], [2 x i16]* %3, i64 0, i64 0
store i16 0, i16* %13
%14 = getelementptr inbounds [2 x i16], [2 x i16]* %3, i64 0, i64 1
store i16 -8446, i16* %14
%15 = load i16, i16* %1
%16 = zext i16 %15 to i64
store volatile i64 %16, i64* inttoptr (i64 1074004004 to i64*)
%17 = getelementptr inbounds [2 x i16], [2 x i16]* %2, i64 0, i64 0
%18 = load i16, i16* %17
%19 = zext i16 %18 to i64
store volatile i64 %19, i64* inttoptr (i64 1074004008 to i64*)
%20 = getelementptr inbounds [2 x i16], [2 x i16]* %2, i64 0, i64 1
%21 = load i16, i16* %20
%22 = zext i16 %21 to i64
store volatile i64 %22, i64* inttoptr (i64 1074004012 to i64*)
%23 = getelementptr inbounds [2 x i16], [2 x i16]* %3, i64 0, i64 0
%24 = load i16, i16* %23
%25 = zext i16 %24 to i64
store volatile i64 %25, i64* inttoptr (i64 1074004016 to i64*)
%26 = getelementptr inbounds [2 x i16], [2 x i16]* %3, i64 0, i64 1
%27 = load i16, i16* %26
%28 = zext i16 %27 to i64
store volatile i64 %28, i64* inttoptr (i64 1074004020 to i64*)
%29 = load i16, i16* %4
%30 = zext i16 %29 to i64
store volatile i64 %30, i64* inttoptr (i64 1074004024 to i64*)
store volatile i64 1, i64* inttoptr (i64 1074004000 to i64*)
ret void
}

LLVM IR (-O2):
define void @CANMessageSetRx() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i64, i64* inttoptr (i64 1074004000 to i64*)
%3 = and i64 %2, 32768
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
store volatile i64 243, i64* inttoptr (i64 1074004004 to i64*)
store volatile i64 0, i64* inttoptr (i64 1074004008 to i64*)
store volatile i64 40706, i64* inttoptr (i64 1074004012 to i64*)
store volatile i64 0, i64* inttoptr (i64 1074004016 to i64*)
store volatile i64 57090, i64* inttoptr (i64 1074004020 to i64*)
store volatile i64 4224, i64* inttoptr (i64 1074004024 to i64*)
store volatile i64 1, i64* inttoptr (i64 1074004000 to i64*)
ret void
}