#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 badvpn_read_be64(const char *c_ptr) {
  const uint8_t *ptr = (const uint8_t *)c_ptr;
  return ((uint64_t)ptr[0] << 56) | ((uint64_t)ptr[1] << 48) |
         ((uint64_t)ptr[2] << 40) | ((uint64_t)ptr[3] << 32) |
         ((uint64_t)ptr[4] << 24) | ((uint64_t)ptr[5] << 16) |
         ((uint64_t)ptr[6] << 8) | ((uint64_t)ptr[7] << 0);
}


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

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

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

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