void d_storesl(unsigned char **ptr, signed long data) {
  *(*ptr)++ = ((unsigned long)data & 0xff000000UL) >> 24;
  *(*ptr)++ = ((unsigned long)data & 0x00ff0000UL) >> 16;
  *(*ptr)++ = ((unsigned long)data & 0x0000ff00UL) >> 8;
  *(*ptr)++ = ((unsigned long)data & 0x000000ffUL) >> 0;
}


x86 assembly (clang, -O0):
<d_storesl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movabs $0xff000000,%rax
and    -0x10(%rbp),%rax
shr    $0x18,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
and    $0xff0000,%rax
shr    $0x10,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
and    $0xff00,%rax
shr    $0x8,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
shr    $0x0,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_storesl>:
mov    %rsi,%rax
mov    %rsi,%rcx
shr    $0x18,%rcx
mov    (%rdi),%rdx
lea    0x1(%rdx),%rsi
mov    %rsi,(%rdi)
mov    %cl,(%rdx)
mov    %rax,%rcx
shr    $0x10,%rcx
mov    (%rdi),%rdx
lea    0x1(%rdx),%rsi
mov    %rsi,(%rdi)
mov    %cl,(%rdx)
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %ah,(%rcx)
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
ret

LLVM IR (-O0):
define void @d_storesl(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 = and i64 %5, 4278190080
%7 = lshr i64 %6, 24
%8 = trunc i64 %7 to i8
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %9
store i8 %8, i8* %10
%12 = load i64, i64* %4
%13 = and i64 %12, 16711680
%14 = lshr i64 %13, 16
%15 = trunc i64 %14 to i8
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %16
store i8 %15, i8* %17
%19 = load i64, i64* %4
%20 = and i64 %19, 65280
%21 = lshr i64 %20, 8
%22 = trunc i64 %21 to i8
%23 = load i8**, i8*** %3
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %23
store i8 %22, i8* %24
%26 = load i64, i64* %4
%27 = and i64 %26, 255
%28 = lshr i64 %27, 0
%29 = trunc i64 %28 to i8
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %30
store i8 %29, i8* %31
ret void
}

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