#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 cctools_ntohll(uint64_t netlonglong) {
  uint64_t out = 0;
  uint8_t *d = (uint8_t *)&netlonglong;
  out |= (uint64_t)d[7] << 0;
  out |= (uint64_t)d[6] << 8;
  out |= (uint64_t)d[5] << 16;
  out |= (uint64_t)d[4] << 24;
  out |= (uint64_t)d[3] << 32;
  out |= (uint64_t)d[2] << 40;
  out |= (uint64_t)d[1] << 48;
  out |= (uint64_t)d[0] << 56;
  return out;
}


x86 assembly (clang, -O0):
<cctools_ntohll>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rax
shl    $0x0,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rax
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
shl    $0x10,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
shl    $0x18,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    $0x28,%ecx
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    $0x30,%ecx
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    $0x38,%ecx
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cctools_ntohll(i32 %0) {
ret i32 poison
}