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

/* Variables and functions */
void put64bit(uint8_t **ptr, uint64_t val) {
  (*ptr)[0] = ((val) >> 56) & 0xFF;
  (*ptr)[1] = ((val) >> 48) & 0xFF;
  (*ptr)[2] = ((val) >> 40) & 0xFF;
  (*ptr)[3] = ((val) >> 32) & 0xFF;
  (*ptr)[4] = ((val) >> 24) & 0xFF;
  (*ptr)[5] = ((val) >> 16) & 0xFF;
  (*ptr)[6] = ((val) >> 8) & 0xFF;
  (*ptr)[7] = (val)&0xFF;
  (*ptr) += 8;
}


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

x86 assembly (clang, -O2):
<put64bit>:
push   %rbx
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%ebx
movzbl %al,%esi
shr    $0x18,%eax
mov    (%rdi),%rdx
mov    %eax,0x10(%rdx)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x14(%rdx)
mov    %ebx,0x18(%rdx)
mov    %esi,0x1c(%rdx)
add    $0x20,%rdx
mov    %rdx,(%rdi)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @put64bit(i32** nocapture %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = load i32*, i32** %0
%5 = getelementptr inbounds i32, i32* %4, i64 4
store i32 %3, i32* %5
%6 = lshr i32 %1, 16
%7 = and i32 %6, 255
%8 = getelementptr inbounds i32, i32* %4, i64 5
store i32 %7, i32* %8
%9 = lshr i32 %1, 8
%10 = and i32 %9, 255
%11 = getelementptr inbounds i32, i32* %4, i64 6
store i32 %10, i32* %11
%12 = and i32 %1, 255
%13 = getelementptr inbounds i32, i32* %4, i64 7
store i32 %12, i32* %13
%14 = getelementptr inbounds i32, i32* %4, i64 8
store i32* %14, i32** %0
ret void
}