#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 value;
typedef int uint64_t;

/* Variables and functions */
uint64_t BitReverse64(uint64_t value) {
  value = (((value) >> (32)) & (0x00000000FFFFFFFFull)) |
          (((value) & (0x00000000FFFFFFFFull)) << (32));
  value = (((value) >> (16)) & (0x0000FFFF0000FFFFull)) |
          (((value) & (0x0000FFFF0000FFFFull)) << (16));
  value = (((value) >> (8)) & (0x00FF00FF00FF00FFull)) |
          (((value) & (0x00FF00FF00FF00FFull)) << (8));
  value = (((value) >> (4)) & (0x0F0F0F0F0F0F0F0Full)) |
          (((value) & (0x0F0F0F0F0F0F0F0Full)) << (4));
  value = (((value) >> (2)) & (0x3333333333333333ull)) |
          (((value) & (0x3333333333333333ull)) << (2));
  value = (((value) >> (1)) & (0x5555555555555555ull)) |
          (((value) & (0x5555555555555555ull)) << (1));
  return value;
}


x86 assembly (clang, -O0):
<BitReverse64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
cltq
movabs $0xffffffff,%rcx
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0xffffffff,%rdx
and    %rdx,%rcx
shl    $0x20,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
cltq
movabs $0xffff0000ffff,%rcx
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0xffff0000ffff,%rdx
and    %rdx,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
cltq
movabs $0xff00ff00ff00ff,%rcx
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0xff00ff00ff00ff,%rdx
and    %rdx,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
cltq
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0xf0f0f0f0f0f0f0f,%rdx
0f 0f 0f
and    %rdx,%rcx
shl    $0x4,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
cltq
movabs $0x3333333333333333,%rcx
33 33 33
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0x3333333333333333,%rdx
33 33 33
and    %rdx,%rcx
shl    $0x2,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
cltq
movabs $0x5555555555555555,%rcx
55 55 55
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rcx
shl    $0x1,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BitReverse64>:
ret

LLVM IR (-O0):
define i32 @BitReverse64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 32
%5 = sext i32 %4 to i64
%6 = and i64 %5, 4294967295
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = and i64 %8, 4294967295
%10 = shl i64 %9, 32
%11 = or i64 %6, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = ashr i32 %13, 16
%15 = sext i32 %14 to i64
%16 = and i64 %15, 281470681808895
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = and i64 %18, 281470681808895
%20 = shl i64 %19, 16
%21 = or i64 %16, %20
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = ashr i32 %23, 8
%25 = sext i32 %24 to i64
%26 = and i64 %25, 71777214294589695
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = and i64 %28, 71777214294589695
%30 = shl i64 %29, 8
%31 = or i64 %26, %30
%32 = trunc i64 %31 to i32
store i32 %32, i32* %2
%33 = load i32, i32* %2
%34 = ashr i32 %33, 4
%35 = sext i32 %34 to i64
%36 = and i64 %35, 1085102592571150095
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = and i64 %38, 1085102592571150095
%40 = shl i64 %39, 4
%41 = or i64 %36, %40
%42 = trunc i64 %41 to i32
store i32 %42, i32* %2
%43 = load i32, i32* %2
%44 = ashr i32 %43, 2
%45 = sext i32 %44 to i64
%46 = and i64 %45, 3689348814741910323
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = and i64 %48, 3689348814741910323
%50 = shl i64 %49, 2
%51 = or i64 %46, %50
%52 = trunc i64 %51 to i32
store i32 %52, i32* %2
%53 = load i32, i32* %2
%54 = ashr i32 %53, 1
%55 = sext i32 %54 to i64
%56 = and i64 %55, 6148914691236517205
%57 = load i32, i32* %2
%58 = sext i32 %57 to i64
%59 = and i64 %58, 6148914691236517205
%60 = shl i64 %59, 1
%61 = or i64 %56, %60
%62 = trunc i64 %61 to i32
store i32 %62, i32* %2
%63 = load i32, i32* %2
ret i32 %63
}

LLVM IR (-O2):
define i32 @BitReverse64(i32 %0) {
ret i32 poison
}