#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 */
double swap_btol_double(double data) {
  uint64_t swapped_data;
  uint64_t original_data;
  double *dp;
  original_data = (uint64_t)data;
  swapped_data = (original_data >> 56) & 0x00000000000000FF;
  swapped_data |= (original_data >> 40) & 0x000000000000FF00;
  swapped_data |= (original_data >> 24) & 0x0000000000FF0000;
  swapped_data |= (original_data >> 8) & 0x00000000FF000000;
  swapped_data |= (original_data << 8) & 0x000000FF00000000;
  swapped_data |= (original_data << 24) & 0x0000FF0000000000;
  swapped_data |= (original_data << 40) & 0x00FF000000000000;
  swapped_data |= (original_data << 56) & 0xFF00000000000000;
  dp = (double *)(&swapped_data);
  return *dp;
}


x86 assembly (clang, -O0):
<swap_btol_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
and    $0xff00,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x18,%eax
and    $0xff0000,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
and    $0xff000000,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x8,%eax
movslq %eax,%rcx
movabs $0xff00000000,%rax
and    %rax,%rcx
movslq -0xc(%rbp),%rax
or     %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x18,%eax
movslq %eax,%rcx
movabs $0xff0000000000,%rax
and    %rax,%rcx
movslq -0xc(%rbp),%rax
or     %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x28,%ecx
shl    %cl,%eax
movslq %eax,%rcx
movabs $0xff000000000000,%rax
and    %rax,%rcx
movslq -0xc(%rbp),%rax
or     %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x38,%ecx
shl    %cl,%eax
movslq %eax,%rcx
movabs $0xff00000000000000,%rax
and    %rax,%rcx
movslq -0xc(%rbp),%rax
or     %rcx,%rax
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @swap_btol_double(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca double*
store double %0, double* %2
%6 = load double, double* %2
%7 = fptosi double %6 to i32
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = ashr i32 %8, 56
%10 = and i32 %9, 255
store i32 %10, i32* %3
%11 = load i32, i32* %4
%12 = ashr i32 %11, 40
%13 = and i32 %12, 65280
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i32, i32* %4
%17 = ashr i32 %16, 24
%18 = and i32 %17, 16711680
%19 = load i32, i32* %3
%20 = or i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %4
%22 = ashr i32 %21, 8
%23 = and i32 %22, -16777216
%24 = load i32, i32* %3
%25 = or i32 %24, %23
store i32 %25, i32* %3
%26 = load i32, i32* %4
%27 = shl i32 %26, 8
%28 = sext i32 %27 to i64
%29 = and i64 %28, 1095216660480
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = or i64 %31, %29
%33 = trunc i64 %32 to i32
store i32 %33, i32* %3
%34 = load i32, i32* %4
%35 = shl i32 %34, 24
%36 = sext i32 %35 to i64
%37 = and i64 %36, 280375465082880
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = or i64 %39, %37
%41 = trunc i64 %40 to i32
store i32 %41, i32* %3
%42 = load i32, i32* %4
%43 = shl i32 %42, 40
%44 = sext i32 %43 to i64
%45 = and i64 %44, 71776119061217280
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = or i64 %47, %45
%49 = trunc i64 %48 to i32
store i32 %49, i32* %3
%50 = load i32, i32* %4
%51 = shl i32 %50, 56
%52 = sext i32 %51 to i64
%53 = and i64 %52, -72057594037927936
%54 = load i32, i32* %3
%55 = sext i32 %54 to i64
%56 = or i64 %55, %53
%57 = trunc i64 %56 to i32
store i32 %57, i32* %3
%58 = bitcast i32* %3 to double*
store double* %58, double** %5
%59 = load double*, double** %5
%60 = load double, double* %59
ret double %60
}

LLVM IR (-O2):
define double @swap_btol_double(double %0) {
ret double undef
}