void AmiSetQword48ToBe(void *pAddr_p, long long int qwQwordVal_p) {
  ((unsigned char *)pAddr_p)[0] = ((unsigned char *)&qwQwordVal_p)[5];
  ((unsigned char *)pAddr_p)[1] = ((unsigned char *)&qwQwordVal_p)[4];
  ((unsigned char *)pAddr_p)[2] = ((unsigned char *)&qwQwordVal_p)[3];
  ((unsigned char *)pAddr_p)[3] = ((unsigned char *)&qwQwordVal_p)[2];
  ((unsigned char *)pAddr_p)[4] = ((unsigned char *)&qwQwordVal_p)[1];
  ((unsigned char *)pAddr_p)[5] = ((unsigned char *)&qwQwordVal_p)[0];
}


x86 assembly (clang, -O0):
<AmiSetQword48ToBe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xe(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0xf(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x10(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x5(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<AmiSetQword48ToBe>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rcx
shr    $0x10,%rcx
mov    %rsi,%rdx
shr    $0x18,%rdx
shr    $0x20,%rsi
mov    %rbx,%rax
shr    $0x28,%rax
mov    %al,(%rdi)
mov    %sil,0x1(%rdi)
mov    %dl,0x2(%rdi)
mov    %cl,0x3(%rdi)
mov    %bh,0x4(%rdi)
mov    %bl,0x5(%rdi)
pop    %rbx
ret

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

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