void mls_type_data_ull_to_bytearray(unsigned char *outb,
                                    unsigned long long inb) {
  outb[0] = (unsigned char)((inb >> 56) & (unsigned char)0xff);
  outb[1] = (unsigned char)((inb >> 48) & (unsigned char)0xff);
  outb[2] = (unsigned char)((inb >> 40) & (unsigned char)0xff);
  outb[3] = (unsigned char)((inb >> 32) & (unsigned char)0xff);
  outb[4] = (unsigned char)((inb >> 24) & (unsigned char)0xff);
  outb[5] = (unsigned char)((inb >> 16) & (unsigned char)0xff);
  outb[6] = (unsigned char)((inb >> 8) & (unsigned char)0xff);
  outb[7] = (unsigned char)((inb) & (unsigned char)0xff);
}


x86 assembly (clang, -O0):
<mls_type_data_ull_to_bytearray>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x38,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
shr    $0x30,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
shr    $0x28,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x10(%rbp),%rax
shr    $0x20,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x10(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x10(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x7(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mls_type_data_ull_to_bytearray>:
bswap  %rsi
mov    %rsi,(%rdi)
ret

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

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