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

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int /*<<< orphan*/ const *, int);
uint64_t get64bit(const uint8_t **ptr) {
  uint64_t t64;
  memcpy(&t64, *ptr, 8);
  (*ptr) += 8;
  return ((((t64) << 56) & 0xFF00000000000000) |
          (((t64) << 40) & 0xFF000000000000) |
          (((t64) << 24) & 0xFF0000000000) | (((t64) << 8) & 0xFF00000000) |
          (((t64) >> 8) & 0xFF000000) | (((t64) >> 24) & 0xFF0000) |
          (((t64) >> 40) & 0xFF00) | (((t64) >> 56) & 0xFF));
}


x86 assembly (clang, -O0):
<get64bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x20,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x38,%ecx
shl    %cl,%eax
cltq
movabs $0xff00000000000000,%rcx
and    %rcx,%rax
mov    -0xc(%rbp),%edx
mov    $0x28,%ecx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
movabs $0xff000000000000,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    -0xc(%rbp),%ecx
shl    $0x18,%ecx
movslq %ecx,%rcx
movabs $0xff0000000000,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
movslq %ecx,%rcx
movabs $0xff00000000,%rdx
and    %rdx,%rcx
or     %rcx,%rax
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff000000,%ecx
mov    %ecx,%ecx
or     %rcx,%rax
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff0000,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    -0xc(%rbp),%edx
mov    $0x28,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff00,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
mov    -0xc(%rbp),%edx
mov    $0x38,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff,%ecx
movslq %ecx,%rcx
or     %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get64bit>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xc(%rsp),%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
addq   $0x20,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get64bit(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = load i32*, i32** %4
%6 = call i32 @memcpy(i32* %3, i32* %5, i32 8)
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 8
store i32* %9, i32** %7
%10 = load i32, i32* %3
%11 = shl i32 %10, 56
%12 = sext i32 %11 to i64
%13 = and i64 %12, -72057594037927936
%14 = load i32, i32* %3
%15 = shl i32 %14, 40
%16 = sext i32 %15 to i64
%17 = and i64 %16, 71776119061217280
%18 = or i64 %13, %17
%19 = load i32, i32* %3
%20 = shl i32 %19, 24
%21 = sext i32 %20 to i64
%22 = and i64 %21, 280375465082880
%23 = or i64 %18, %22
%24 = load i32, i32* %3
%25 = shl i32 %24, 8
%26 = sext i32 %25 to i64
%27 = and i64 %26, 1095216660480
%28 = or i64 %23, %27
%29 = load i32, i32* %3
%30 = ashr i32 %29, 8
%31 = and i32 %30, -16777216
%32 = zext i32 %31 to i64
%33 = or i64 %28, %32
%34 = load i32, i32* %3
%35 = ashr i32 %34, 24
%36 = and i32 %35, 16711680
%37 = sext i32 %36 to i64
%38 = or i64 %33, %37
%39 = load i32, i32* %3
%40 = ashr i32 %39, 40
%41 = and i32 %40, 65280
%42 = sext i32 %41 to i64
%43 = or i64 %38, %42
%44 = load i32, i32* %3
%45 = ashr i32 %44, 56
%46 = and i32 %45, 255
%47 = sext i32 %46 to i64
%48 = or i64 %43, %47
%49 = trunc i64 %48 to i32
ret i32 %49
}

LLVM IR (-O2):
define i32 @get64bit(i32** nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32*, i32** %0
%5 = call i32 @memcpy(i32* %2, i32* %4, i32 8)
%6 = load i32*, i32** %0
%7 = getelementptr inbounds i32, i32* %6, i64 8
store i32* %7, i32** %0
ret i32 poison
}