#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 */
uint64_t UInt64GetBE(const void *b8) {
  return (((uint64_t)((const uint8_t *)b8)[0] << 56) |
          ((uint64_t)((const uint8_t *)b8)[1] << 48) |
          ((uint64_t)((const uint8_t *)b8)[2] << 40) |
          ((uint64_t)((const uint8_t *)b8)[3] << 32) |
          ((uint64_t)((const uint8_t *)b8)[4] << 24) |
          ((uint64_t)((const uint8_t *)b8)[5] << 16) |
          ((uint64_t)((const uint8_t *)b8)[6] << 8) |
          ((uint64_t)((const uint8_t *)b8)[7]));
}


x86 assembly (clang, -O0):
<UInt64GetBE>:
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
or     %ecx,%eax
pop    %rbp
ret

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

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

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