#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 scalar_t__ int8_t;
typedef int int64_t;

/* Variables and functions */
int64_t ld_i64_be(const void *x) {
  return (
      (((((((int64_t)(((int8_t *)x)[0])) << 8) | ((int64_t)(((uint8_t *)x)[1])))
         << 16) |
        ((((int64_t)(((uint8_t *)x)[2])) << 8) |
         ((int64_t)(((uint8_t *)x)[3]))))
       << 32) |
      ((((((int64_t)(((uint8_t *)x)[4])) << 8) | ((int64_t)(((uint8_t *)x)[5])))
        << 16) |
       ((((int64_t)(((uint8_t *)x)[6])) << 8) |
        ((int64_t)(((uint8_t *)x)[7])))));
}


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

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

LLVM IR (-O0):
define i32 @ld_i64_be(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, 8
%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 = or i32 %8, %13
%15 = shl i32 %14, 16
%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, 8
%22 = load i8*, i8** %2
%23 = bitcast i8* %22 to i64*
%24 = getelementptr inbounds i64, i64* %23, i64 3
%25 = load i64, i64* %24
%26 = trunc i64 %25 to i32
%27 = or i32 %21, %26
%28 = or i32 %15, %27
%29 = shl i32 %28, 32
%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, 8
%36 = load i8*, i8** %2
%37 = bitcast i8* %36 to i64*
%38 = getelementptr inbounds i64, i64* %37, i64 5
%39 = load i64, i64* %38
%40 = trunc i64 %39 to i32
%41 = or i32 %35, %40
%42 = shl i32 %41, 16
%43 = load i8*, i8** %2
%44 = bitcast i8* %43 to i64*
%45 = getelementptr inbounds i64, i64* %44, i64 6
%46 = load i64, i64* %45
%47 = trunc i64 %46 to i32
%48 = shl i32 %47, 8
%49 = load i8*, i8** %2
%50 = bitcast i8* %49 to i64*
%51 = getelementptr inbounds i64, i64* %50, i64 7
%52 = load i64, i64* %51
%53 = trunc i64 %52 to i32
%54 = or i32 %48, %53
%55 = or i32 %42, %54
%56 = or i32 %29, %55
ret i32 %56
}

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