#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 swap64_load(uint64_t *in) {
  return (
      (uint64_t)((((uint64_t)(*in) & (uint64_t)0x00000000000000ffULL) << 56) |
                 (((uint64_t)(*in) & (uint64_t)0x000000000000ff00ULL) << 40) |
                 (((uint64_t)(*in) & (uint64_t)0x0000000000ff0000ULL) << 24) |
                 (((uint64_t)(*in) & (uint64_t)0x00000000ff000000ULL) << 8) |
                 (((uint64_t)(*in) & (uint64_t)0x000000ff00000000ULL) >> 8) |
                 (((uint64_t)(*in) & (uint64_t)0x0000ff0000000000ULL) >> 24) |
                 (((uint64_t)(*in) & (uint64_t)0x00ff000000000000ULL) >> 40) |
                 (((uint64_t)(*in) & (uint64_t)0xff00000000000000ULL) >> 56)));
}


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

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

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

LLVM IR (-O2):
define i32 @swap64_load(i32* nocapture readnone %0) {
ret i32 poison
}