#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 /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
int Crc32(int, int /*<<< orphan*/ *, int);
uint32_t EMACHashFilterBitCalculate(uint8_t *pui8MACAddr) {
  uint32_t ui32CRC, ui32Mask, ui32Loop;
  ;
  ui32CRC = Crc32(0xFFFFFFFF, pui8MACAddr, 6);
  ui32CRC ^= 0xFFFFFFFF;
  ui32Mask = 0;
  for (ui32Loop = 0; ui32Loop < 6; ui32Loop++) {
    ui32Mask <<= 1;
    ui32Mask |= (ui32CRC & 1);
    ui32CRC >>= 1;
  }
  return (ui32Mask);
}


x86 assembly (clang, -O0):
<EMACHashFilterBitCalculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xffffffff,%edi
mov    $0x6,%edx
call   1030 <Crc32@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    117f <EMACHashFilterBitCalculate+0x6f>
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <EMACHashFilterBitCalculate+0x39>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACHashFilterBitCalculate>:
push   %rax
mov    %rdi,%rsi
mov    $0xffffffff,%edi
mov    $0x6,%edx
call   1030 <Crc32@plt>
not    %al
rol    $0x4,%al
mov    %eax,%ecx
and    $0x33,%cl
shl    $0x2,%cl
shr    $0x2,%al
and    $0x33,%al
or     %cl,%al
mov    %eax,%ecx
and    $0x54,%cl
add    %cl,%cl
shr    %al
and    $0x54,%al
or     %cl,%al
shr    $0x2,%al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @EMACHashFilterBitCalculate(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = call i32 @Crc32(i32 -1, i32* %6, i32 6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = xor i32 %8, -1
store i32 %9, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %10
10: ; preds = %22, %1
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %25
13: ; preds = %10
%14 = load i32, i32* %4
%15 = shl i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = and i32 %16, 1
%18 = load i32, i32* %4
%19 = or i32 %18, %17
store i32 %19, i32* %4
%20 = load i32, i32* %3
%21 = ashr i32 %20, 1
store i32 %21, i32* %3
br label %22
22: ; preds = %13
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %10
25: ; preds = %10
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @EMACHashFilterBitCalculate(i32* %0) {
%2 = tail call i32 @Crc32(i32 -1, i32* %0, i32 6)
%3 = xor i32 %2, -1
%4 = trunc i32 %3 to i6
%5 = call i6 @llvm.bitreverse.i6(i6 %4)
%6 = zext i6 %5 to i32
ret i32 %6
}