#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 rev_masks(uint64_t x) {
  x = ((x & 0xffffffff00000000) >> 32) | ((x & 0x00000000ffffffff) << 32);
  x = ((x & 0xffff0000ffff0000) >> 16) | ((x & 0x0000ffff0000ffff) << 16);
  x = ((x & 0xff00ff00ff00ff00) >> 8) | ((x & 0x00ff00ff00ff00ff) << 8);
  x = ((x & 0xf0f0f0f0f0f0f0f0) >> 4) | ((x & 0x0f0f0f0f0f0f0f0f) << 4);
  x = ((x & 0xcccccccccccccccc) >> 2) | ((x & 0x3333333333333333) << 2);
  x = ((x & 0xaaaaaaaaaaaaaaaa) >> 1) | ((x & 0x5555555555555555) << 1);
  return x;
}


x86 assembly (clang, -O0):
<rev_masks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xffffffff00000000,%rcx
ff ff ff
and    %rcx,%rax
shr    $0x20,%rax
mov    -0x4(%rbp),%edx
and    $0xffffffff,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
mov    %ecx,%ecx
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)
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 $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 $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 $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)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rev_masks(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, -4294967296
%6 = lshr i64 %5, 32
%7 = load i32, i32* %2
%8 = and i32 %7, -1
%9 = shl i32 %8, 32
%10 = zext i32 %9 to i64
%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, -281470681808896
%16 = lshr i64 %15, 16
%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 = sext i32 %23 to i64
%25 = and i64 %24, -71777214294589696
%26 = lshr i64 %25, 8
%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 = sext i32 %33 to i64
%35 = and i64 %34, -1085102592571150096
%36 = lshr i64 %35, 4
%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 = sext i32 %43 to i64
%45 = and i64 %44, -3689348814741910324
%46 = lshr i64 %45, 2
%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 = sext i32 %53 to i64
%55 = and i64 %54, -6148914691236517206
%56 = lshr i64 %55, 1
%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 @rev_masks(i32 %0) {
ret i32 poison
}