#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;
typedef scalar_t__ __x;

/* Variables and functions */
uint64_t bswap_64(uint64_t x) {
  uint64_t __x = (x);
  return (
      (uint64_t)((uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL)
                            << 56) |
                 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL)
                            << 40) |
                 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL)
                            << 24) |
                 (uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL)
                            << 8) |
                 (uint64_t)(((uint64_t)(__x) &
                             (uint64_t)0x000000ff00000000ULL) >>
                            8) |
                 (uint64_t)(((uint64_t)(__x) &
                             (uint64_t)0x0000ff0000000000ULL) >>
                            24) |
                 (uint64_t)(((uint64_t)(__x) &
                             (uint64_t)0x00ff000000000000ULL) >>
                            40) |
                 (uint64_t)(((uint64_t)(__x) &
                             (uint64_t)0xff00000000000000ULL) >>
                            56)));
}


x86 assembly (clang, -O0):
<bswap_64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%edx
and    $0xff00,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff0000,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0xff000000,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x0,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x0,%ecx
sar    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%edx
and    $0x0,%edx
mov    $0x28,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%edx
and    $0x0,%edx
mov    $0x38,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bswap_64(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, 255
%7 = shl i32 %6, 56
%8 = load i32, i32* %3
%9 = and i32 %8, 65280
%10 = shl i32 %9, 40
%11 = or i32 %7, %10
%12 = load i32, i32* %3
%13 = and i32 %12, 16711680
%14 = shl i32 %13, 24
%15 = or i32 %11, %14
%16 = load i32, i32* %3
%17 = and i32 %16, -16777216
%18 = shl i32 %17, 8
%19 = or i32 %15, %18
%20 = load i32, i32* %3
%21 = and i32 %20, 0
%22 = ashr i32 %21, 8
%23 = or i32 %19, %22
%24 = load i32, i32* %3
%25 = and i32 %24, 0
%26 = ashr i32 %25, 24
%27 = or i32 %23, %26
%28 = load i32, i32* %3
%29 = and i32 %28, 0
%30 = ashr i32 %29, 40
%31 = or i32 %27, %30
%32 = load i32, i32* %3
%33 = and i32 %32, 0
%34 = ashr i32 %33, 56
%35 = or i32 %31, %34
ret i32 %35
}

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