#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 void *uint8_t;
typedef int uint32_t;

/* Variables and functions */
void store32(void *dst, uint32_t w) {
  uint8_t *p = (uint8_t *)dst;
  *p++ = (uint8_t)w;
  w >>= 8;
  *p++ = (uint8_t)w;
  w >>= 8;
  *p++ = (uint8_t)w;
  w >>= 8;
  *p++ = (uint8_t)w;
}


x86 assembly (clang, -O0):
<store32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x8,%rdx
mov    %rdx,-0x18(%rbp)
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<store32>:
movslq %esi,%rax
mov    %rax,(%rdi)
mov    %eax,%ecx
sar    $0x8,%ecx
movslq %ecx,%rcx
mov    %rcx,0x8(%rdi)
mov    %eax,%ecx
sar    $0x10,%ecx
movslq %ecx,%rcx
mov    %rcx,0x10(%rdi)
sar    $0x18,%eax
cltq
mov    %rax,0x18(%rdi)
ret

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

LLVM IR (-O2):
define void @store32(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i8**
%4 = sext i32 %1 to i64
%5 = inttoptr i64 %4 to i8*
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = bitcast i8* %6 to i8**
store i8* %5, i8** %3
%8 = ashr i32 %1, 8
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = getelementptr inbounds i8, i8* %0, i64 16
%12 = bitcast i8* %11 to i8**
store i8* %10, i8** %7
%13 = ashr i32 %1, 16
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
%16 = getelementptr inbounds i8, i8* %0, i64 24
%17 = bitcast i8* %16 to i8**
store i8* %15, i8** %12
%18 = ashr i32 %1, 24
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %17
ret void
}