#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 bswap64(uint64_t x) {
  return ({
    uint64_t __x = (x);
    ((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):
<bswap64>:
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
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

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