#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 */
void do_write_uint64(void *dst, uint64_t data) {
  uint8_t *d = (uint8_t *)dst;
  d[0] = (uint8_t)((data >> 56) & 0xff);
  d[1] = (uint8_t)((data >> 48) & 0xff);
  d[2] = (uint8_t)((data >> 40) & 0xff);
  d[3] = (uint8_t)((data >> 32) & 0xff);
  d[4] = (uint8_t)((data >> 24) & 0xff);
  d[5] = (uint8_t)((data >> 16) & 0xff);
  d[6] = (uint8_t)((data >> 8) & 0xff);
  d[7] = (uint8_t)(data & 0xff);
}


x86 assembly (clang, -O0):
<do_write_uint64>:
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
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0xc(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x38(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_write_uint64>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %rax,0x20(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %rax,0x28(%rdi)
mov    %rdx,0x30(%rdi)
mov    %rsi,0x38(%rdi)
ret

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

LLVM IR (-O2):
define void @do_write_uint64(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 32
%6 = bitcast i8* %5 to i64*
store i64 %4, i64* %6
%7 = lshr i32 %1, 16
%8 = and i32 %7, 255
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 40
%11 = bitcast i8* %10 to i64*
store i64 %9, i64* %11
%12 = lshr i32 %1, 8
%13 = and i32 %12, 255
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 48
%16 = bitcast i8* %15 to i64*
store i64 %14, i64* %16
%17 = and i32 %1, 255
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 56
%20 = bitcast i8* %19 to i64*
store i64 %18, i64* %20
ret void
}