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

/* Variables and functions */
void st_u32_be(void *x, uint32_t u) {
  (((((uint8_t *)x)[0]) = ((u >> 16) >> 8) % 256,
    (((uint8_t *)x)[1]) = ((u >> 16) % 256)),
   ((((uint8_t *)x)[2]) = ((u) >> 8) % 256, (((uint8_t *)x)[3]) = ((u) % 256)));
}


x86 assembly (clang, -O0):
<st_u32_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
sar    $0x8,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,0x4(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,0x8(%rax)
mov    -0xc(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_u32_be>:
mov    %esi,%eax
shr    $0x10,%eax
mov    %esi,%ecx
sar    $0x18,%ecx
lea    0xff(%rax),%edx
test   %ax,%ax
cmovns %eax,%edx
mov    %ecx,(%rdi)
and    $0xffffff00,%edx
sub    %edx,%eax
cwtl
mov    %eax,0x4(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
lea    0xff(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
mov    %eax,0x8(%rdi)
and    $0xffffff00,%ecx
sub    %ecx,%esi
mov    %esi,0xc(%rdi)
ret

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

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