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

/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, int *, int);
double GST_READ_DOUBLE_BE(const uint8_t *data) {
  uint64_t i = 0;
  double d = 0;
  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));
  memcpy(&d, &i, sizeof(uint64_t));
  return d;
}


x86 assembly (clang, -O0):
<GST_READ_DOUBLE_BE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x14(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x1c(%rcx),%ecx
shl    $0x0,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GST_READ_DOUBLE_BE>:
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
movsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @GST_READ_DOUBLE_BE(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double
store i32* %0, i32** %2
store i32 0, i32* %3
store double 0.000000e+00, double* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = shl i32 %7, 56
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = shl i32 %11, 48
%13 = or i32 %8, %12
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = shl i32 %16, 40
%18 = or i32 %13, %17
%19 = load i32*, i32** %2
%20 = getelementptr inbounds i32, i32* %19, i64 3
%21 = load i32, i32* %20
%22 = shl i32 %21, 32
%23 = or i32 %18, %22
%24 = load i32*, i32** %2
%25 = getelementptr inbounds i32, i32* %24, i64 4
%26 = load i32, i32* %25
%27 = shl i32 %26, 24
%28 = or i32 %23, %27
%29 = load i32*, i32** %2
%30 = getelementptr inbounds i32, i32* %29, i64 5
%31 = load i32, i32* %30
%32 = shl i32 %31, 16
%33 = or i32 %28, %32
%34 = load i32*, i32** %2
%35 = getelementptr inbounds i32, i32* %34, i64 6
%36 = load i32, i32* %35
%37 = shl i32 %36, 8
%38 = or i32 %33, %37
%39 = load i32*, i32** %2
%40 = getelementptr inbounds i32, i32* %39, i64 7
%41 = load i32, i32* %40
%42 = shl i32 %41, 0
%43 = or i32 %38, %42
store i32 %43, i32* %3
%44 = call i32 @memcpy(double* %4, i32* %3, i32 4)
%45 = load double, double* %4
ret double %45
}

LLVM IR (-O2):
define double @GST_READ_DOUBLE_BE(i32* nocapture readnone %0) {
%2 = alloca i32
%3 = alloca double
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%6 = call i32 @memcpy(double* %3, i32* %2, i32 4)
%7 = load double, double* %3
ret double %7
}