#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 mvhd_to_be64(uint64_t val) {
  uint64_t ret = 0;
  uint8_t *tmp = (uint8_t *)&ret;
  tmp[0] = (uint8_t)((val & 0xff00000000000000) >> 56);
  tmp[1] = (uint8_t)((val & 0x00ff000000000000) >> 48);
  tmp[2] = (uint8_t)((val & 0x0000ff0000000000) >> 40);
  tmp[3] = (uint8_t)((val & 0x000000ff00000000) >> 32);
  tmp[4] = (uint8_t)((val & 0x00000000ff000000) >> 24);
  tmp[5] = (uint8_t)((val & 0x0000000000ff0000) >> 16);
  tmp[6] = (uint8_t)((val & 0x000000000000ff00) >> 8);
  tmp[7] = (uint8_t)((val & 0x00000000000000ff) >> 0);
  return ret;
}


x86 assembly (clang, -O0):
<mvhd_to_be64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movslq -0x4(%rbp),%rcx
movabs $0xff00000000000000,%rax
and    %rax,%rcx
shr    $0x38,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movslq -0x4(%rbp),%rcx
movabs $0xff000000000000,%rax
and    %rax,%rcx
sar    $0x30,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
movslq -0x4(%rbp),%rcx
movabs $0xff0000000000,%rax
and    %rax,%rcx
sar    $0x28,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
movslq -0x4(%rbp),%rcx
movabs $0xff00000000,%rax
and    %rax,%rcx
sar    $0x20,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
sar    $0x0,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x38(%rax)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvhd_to_be64>:
xor    %eax,%eax
ret

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

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