#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 bytestream_put_be32(uint8_t **b, const unsigned int value) {
  do {
    uint32_t d = (value);
    ((uint8_t *)(*b))[3] = (d);
    ((uint8_t *)(*b))[2] = (d) >> 8;
    ((uint8_t *)(*b))[1] = (d) >> 16;
    ((uint8_t *)(*b))[0] = (d) >> 24;
  } while (0);
  (*b) += 4;
}


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

x86 assembly (clang, -O2):
<bytestream_put_be32>:
mov    (%rdi),%rax
mov    %esi,0xc(%rax)
mov    %esi,%ecx
sar    $0x8,%ecx
mov    %ecx,0x8(%rax)
mov    %esi,%ecx
sar    $0x10,%ecx
mov    %ecx,0x4(%rax)
sar    $0x18,%esi
mov    %esi,(%rax)
add    $0x10,%rax
mov    %rax,(%rdi)
ret

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

LLVM IR (-O2):
define void @bytestream_put_be32(i32** nocapture %0, i32 %1) {
%3 = load i32*, i32** %0
%4 = getelementptr inbounds i32, i32* %3, i64 3
store i32 %1, i32* %4
%5 = ashr i32 %1, 8
%6 = getelementptr inbounds i32, i32* %3, i64 2
store i32 %5, i32* %6
%7 = ashr i32 %1, 16
%8 = getelementptr inbounds i32, i32* %3, i64 1
store i32 %7, i32* %8
%9 = ashr i32 %1, 24
store i32 %9, i32* %3
%10 = getelementptr inbounds i32, i32* %3, i64 4
store i32* %10, i32** %0
ret void
}