#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 reverse(uint64_t x) {
  x = ((x >> 1) & 0x5555555555555555ULL) | ((x & 0x5555555555555555ULL) << 1);
  x = ((x >> 2) & 0x3333333333333333ULL) | ((x & 0x3333333333333333ULL) << 2);
  x = ((x >> 4) & 0x0F0F0F0F0F0F0F0FULL) | ((x & 0x0F0F0F0F0F0F0F0FULL) << 4);
  x = ((x >> 8) & 0x00FF00FF00FF00FFULL) | ((x & 0x00FF00FF00FF00FFULL) << 8);
  x = ((x >> 16) & 0x0000FFFF0000FFFFULL) | ((x & 0x0000FFFF0000FFFFULL) << 16);
  return (x >> 32) | (x << 32);
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-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
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    $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    $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    $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
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):
<reverse>:
ret

LLVM IR (-O0):
define i32 @reverse(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = sext i32 %4 to i64
%6 = and i64 %5, 6148914691236517205
%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 = ashr i32 %13, 2
%15 = sext i32 %14 to i64
%16 = and i64 %15, 3689348814741910323
%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 = ashr i32 %23, 4
%25 = sext i32 %24 to i64
%26 = and i64 %25, 1085102592571150095
%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 = ashr i32 %33, 8
%35 = sext i32 %34 to i64
%36 = and i64 %35, 71777214294589695
%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 = ashr i32 %43, 16
%45 = sext i32 %44 to i64
%46 = and i64 %45, 281470681808895
%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 @reverse(i32 %0) {
ret i32 poison
}