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

/* Variables and functions */
unsigned int be64put(void *p, uint64_t v) {
  uint8_t *a;
  a = p;
  a[0] = v >> 56;
  a[1] = v >> 48;
  a[2] = v >> 40;
  a[3] = v >> 32;
  a[4] = v >> 24;
  a[5] = v >> 16;
  a[6] = v >> 8;
  a[7] = v;
  return 8;
}


x86 assembly (clang, -O0):
<be64put>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x1c(%rax)
mov    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<be64put>:
mov    %esi,%eax
sar    $0x18,%eax
mov    %eax,0x10(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x14(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x18(%rdi)
mov    %esi,0x1c(%rdi)
mov    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @be64put(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %4
%9 = ashr i32 %8, 56
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
%12 = load i32, i32* %4
%13 = ashr i32 %12, 48
%14 = load i32*, i32** %5
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %13, i32* %15
%16 = load i32, i32* %4
%17 = ashr i32 %16, 40
%18 = load i32*, i32** %5
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %4
%21 = ashr i32 %20, 32
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i64 3
store i32 %21, i32* %23
%24 = load i32, i32* %4
%25 = ashr i32 %24, 24
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 4
store i32 %25, i32* %27
%28 = load i32, i32* %4
%29 = ashr i32 %28, 16
%30 = load i32*, i32** %5
%31 = getelementptr inbounds i32, i32* %30, i64 5
store i32 %29, i32* %31
%32 = load i32, i32* %4
%33 = ashr i32 %32, 8
%34 = load i32*, i32** %5
%35 = getelementptr inbounds i32, i32* %34, i64 6
store i32 %33, i32* %35
%36 = load i32, i32* %4
%37 = load i32*, i32** %5
%38 = getelementptr inbounds i32, i32* %37, i64 7
store i32 %36, i32* %38
ret i32 8
}

LLVM IR (-O2):
define i32 @be64put(i8* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 24
%4 = getelementptr inbounds i8, i8* %0, i64 16
%5 = bitcast i8* %4 to i32*
store i32 %3, i32* %5
%6 = ashr i32 %1, 16
%7 = getelementptr inbounds i8, i8* %0, i64 20
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
%9 = ashr i32 %1, 8
%10 = getelementptr inbounds i8, i8* %0, i64 24
%11 = bitcast i8* %10 to i32*
store i32 %9, i32* %11
%12 = getelementptr inbounds i8, i8* %0, i64 28
%13 = bitcast i8* %12 to i32*
store i32 %1, i32* %13
ret i32 8
}