#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 uint64_t;

/* Variables and functions */
uint64_t rev64(uint64_t n) {
  n = ((n & 0xAAAAAAAAAAAAAAAAULL) >> 1) | ((n & 0x5555555555555555ULL) << 1);
  n = ((n & 0xCCCCCCCCCCCCCCCCULL) >> 2) | ((n & 0x3333333333333333ULL) << 2);
  n = ((n & 0xF0F0F0F0F0F0F0F0ULL) >> 4) | ((n & 0x0F0F0F0F0F0F0F0FULL) << 4);
  n = ((n & 0xFF00FF00FF00FF00ULL) >> 8) | ((n & 0x00FF00FF00FF00FFULL) << 8);
  n = ((n & 0xFFFF0000FFFF0000ULL) >> 16) | ((n & 0x0000FFFF0000FFFFULL) << 16);
  return (n >> 32) | (n << 32);
}


x86 assembly (clang, -O0):
<rev64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xaaaaaaaaaaaaaaaa,%rcx
aa aa aa
and    %rcx,%rax
shr    $0x1,%rax
movslq -0x4(%rbp),%rcx
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rcx
shl    $0x1,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xcccccccccccccccc,%rcx
cc cc cc
and    %rcx,%rax
shr    $0x2,%rax
movslq -0x4(%rbp),%rcx
movabs $0x3333333333333333,%rdx
33 33 33
and    %rdx,%rcx
shl    $0x2,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xf0f0f0f0f0f0f0f0,%rcx
f0 f0 f0
and    %rcx,%rax
shr    $0x4,%rax
movslq -0x4(%rbp),%rcx
movabs $0xf0f0f0f0f0f0f0f,%rdx
0f 0f 0f
and    %rdx,%rcx
shl    $0x4,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xff00ff00ff00ff00,%rcx
and    %rcx,%rax
shr    $0x8,%rax
movslq -0x4(%rbp),%rcx
movabs $0xff00ff00ff00ff,%rdx
and    %rdx,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xffff0000ffff0000,%rcx
and    %rcx,%rax
shr    $0x10,%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
mov    $0x20,%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rev64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = and i64 %4, -6148914691236517206
%6 = lshr i64 %5, 1
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = and i64 %8, 6148914691236517205
%10 = shl i64 %9, 1
%11 = or i64 %6, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = and i64 %14, -3689348814741910324
%16 = lshr i64 %15, 2
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = and i64 %18, 3689348814741910323
%20 = shl i64 %19, 2
%21 = or i64 %16, %20
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = and i64 %24, -1085102592571150096
%26 = lshr i64 %25, 4
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = and i64 %28, 1085102592571150095
%30 = shl i64 %29, 4
%31 = or i64 %26, %30
%32 = trunc i64 %31 to i32
store i32 %32, i32* %2
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = and i64 %34, -71777214294589696
%36 = lshr i64 %35, 8
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = and i64 %38, 71777214294589695
%40 = shl i64 %39, 8
%41 = or i64 %36, %40
%42 = trunc i64 %41 to i32
store i32 %42, i32* %2
%43 = load i32, i32* %2
%44 = sext i32 %43 to i64
%45 = and i64 %44, -281470681808896
%46 = lshr i64 %45, 16
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = and i64 %48, 281470681808895
%50 = shl i64 %49, 16
%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, 32
%55 = load i32, i32* %2
%56 = shl i32 %55, 32
%57 = or i32 %54, %56
ret i32 %57
}

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