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

/* Variables and functions */
uint64_t be64getv(void *p) {
  uint8_t *a;
  uint64_t v;
  a = p;
  v = (uint64_t)a[0] << 56;
  v |= (uint64_t)a[1] << 48;
  v |= (uint64_t)a[2] << 40;
  v |= (uint64_t)a[3] << 32;
  v |= (uint64_t)a[4] << 24;
  v |= a[5] << 16;
  v |= a[6] << 8;
  v |= a[7];
  return v;
}


x86 assembly (clang, -O0):
<be64getv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x38,%ecx
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    $0x30,%ecx
shl    %cl,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    $0x28,%ecx
shl    %cl,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
shl    $0x18,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%eax
shl    $0x10,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%eax
shl    $0x8,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

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

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