#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 /*<<< orphan*/ uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t ByteSwap64(uint64_t x) {
  union {
    uint64_t ll;
    uint32_t l[2];
  } w, r;
  w.ll = x;
  r.l[0] = ((((w.l[1]) & 0xff000000) >> 24) | (((w.l[1]) & 0x00ff0000) >> 8) |
            (((w.l[1]) & 0x0000ff00) << 8) | (((w.l[1]) & 0x000000ff) << 24));
  r.l[1] = ((((w.l[0]) & 0xff000000) >> 24) | (((w.l[0]) & 0x00ff0000) >> 8) |
            (((w.l[0]) & 0x0000ff00) << 8) | (((w.l[0]) & 0x000000ff) << 24));
  return r.ll;
}


x86 assembly (clang, -O0):
<ByteSwap64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0xc(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x10(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ByteSwap64>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%union.anon = type { [2 x i32] }
define i32 @ByteSwap64(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
%4 = alloca %union.anon
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = bitcast %union.anon* %3 to i32*
store i32 %5, i32* %6
%7 = bitcast %union.anon* %3 to [2 x i32]*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%9 = load i32, i32* %8
%10 = and i32 %9, -16777216
%11 = lshr i32 %10, 24
%12 = bitcast %union.anon* %3 to [2 x i32]*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%14 = load i32, i32* %13
%15 = and i32 %14, 16711680
%16 = ashr i32 %15, 8
%17 = or i32 %11, %16
%18 = bitcast %union.anon* %3 to [2 x i32]*
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 1
%20 = load i32, i32* %19
%21 = and i32 %20, 65280
%22 = shl i32 %21, 8
%23 = or i32 %17, %22
%24 = bitcast %union.anon* %3 to [2 x i32]*
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %24, i64 0, i64 1
%26 = load i32, i32* %25
%27 = and i32 %26, 255
%28 = shl i32 %27, 24
%29 = or i32 %23, %28
%30 = bitcast %union.anon* %4 to [2 x i32]*
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %30, i64 0, i64 0
store i32 %29, i32* %31
%32 = bitcast %union.anon* %3 to [2 x i32]*
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %32, i64 0, i64 0
%34 = load i32, i32* %33
%35 = and i32 %34, -16777216
%36 = lshr i32 %35, 24
%37 = bitcast %union.anon* %3 to [2 x i32]*
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %37, i64 0, i64 0
%39 = load i32, i32* %38
%40 = and i32 %39, 16711680
%41 = ashr i32 %40, 8
%42 = or i32 %36, %41
%43 = bitcast %union.anon* %3 to [2 x i32]*
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %43, i64 0, i64 0
%45 = load i32, i32* %44
%46 = and i32 %45, 65280
%47 = shl i32 %46, 8
%48 = or i32 %42, %47
%49 = bitcast %union.anon* %3 to [2 x i32]*
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %49, i64 0, i64 0
%51 = load i32, i32* %50
%52 = and i32 %51, 255
%53 = shl i32 %52, 24
%54 = or i32 %48, %53
%55 = bitcast %union.anon* %4 to [2 x i32]*
%56 = getelementptr inbounds [2 x i32], [2 x i32]* %55, i64 0, i64 1
store i32 %54, i32* %56
%57 = bitcast %union.anon* %4 to i32*
%58 = load i32, i32* %57
ret i32 %58
}

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