#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 */
__attribute__((always_)) uint64_t iwbits_reverse_64(uint64_t x) {
  uint64_t t;
  x = (x << 32) | (x >> 32);
  x = (x & 0x0001ffff0001ffffLL) << 15 | (x & 0xfffe0000fffe0000LL) >> 17;
  t = (x ^ (x >> 10)) & 0x003f801f003f801fLL;
  x = (t | (t << 10)) ^ x;
  t = (x ^ (x >> 4)) & 0x0e0384210e038421LL;
  x = (t | (t << 4)) ^ x;
  t = (x ^ (x >> 2)) & 0x2248884222488842LL;
  x = (t | (t << 2)) ^ x;
  return x;
}


x86 assembly (clang, -O0):
<iwbits_reverse_64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x1ffff0001ffff,%rcx
and    %rcx,%rax
shl    $0xf,%rax
movslq -0x4(%rbp),%rcx
movabs $0xfffe0000fffe0000,%rdx
and    %rdx,%rcx
shr    $0x11,%rcx
or     %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0xa,%ecx
xor    %ecx,%eax
cltq
movabs $0x3f801f003f801f,%rcx
and    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0xa,%ecx
or     %ecx,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
xor    %ecx,%eax
cltq
movabs $0xe0384210e038421,%rcx
84 03 0e
and    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x4,%ecx
or     %ecx,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
xor    %ecx,%eax
cltq
movabs $0x2248884222488842,%rcx
88 48 22
and    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
or     %ecx,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

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