#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;
typedef int /*<<< orphan*/ p;

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


x86 assembly (clang, -O0):
<compat_le64dec>:
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    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x20(%rcx),%rcx
mov    %ecx,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x28(%rcx),%rcx
mov    %ecx,%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x30(%rcx),%rcx
mov    %ecx,%edx
mov    $0x30,%ecx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x38(%rcx),%rcx
mov    %ecx,%edx
mov    $0x38,%ecx
shl    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

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

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

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