#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 scalar_t__ uint8_t;
typedef int uint64_t;

/* Variables and functions */
double read_double_be(const uint8_t *data) {
  union {
    uint64_t i;
    double d;
  } u;
  u.i = ((((uint64_t)(((const uint8_t *)(data))[0])) << (56)) |
         (((uint64_t)(((const uint8_t *)(data))[1])) << (48)) |
         (((uint64_t)(((const uint8_t *)(data))[2])) << (40)) |
         (((uint64_t)(((const uint8_t *)(data))[3])) << (32)) |
         (((uint64_t)(((const uint8_t *)(data))[4])) << (24)) |
         (((uint64_t)(((const uint8_t *)(data))[5])) << (16)) |
         (((uint64_t)(((const uint8_t *)(data))[6])) << (8)) |
         (((uint64_t)(((const uint8_t *)(data))[7])) << (0)));
  return u.d;
}


x86 assembly (clang, -O0):
<read_double_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
mov    %ecx,%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
mov    %ecx,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%rcx
mov    %ecx,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x20(%rcx),%rcx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x28(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x30(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x38(%rcx),%rcx
shl    $0x0,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @read_double_be(i64* nocapture readnone %0) {
ret double poison
}