#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 uint64_t;

/* Variables and functions */
void bytestream_put_be64(uint8_t **b, const uint64_t value) {
  do {
    uint64_t d = (value);
    ((uint8_t *)(*b))[7] = (d);
    ((uint8_t *)(*b))[6] = (d) >> 8;
    ((uint8_t *)(*b))[5] = (d) >> 16;
    ((uint8_t *)(*b))[4] = (d) >> 24;
    ((uint8_t *)(*b))[3] = (d) >> 32;
    ((uint8_t *)(*b))[2] = (d) >> 40;
    ((uint8_t *)(*b))[1] = (d) >> 48;
    ((uint8_t *)(*b))[0] = (d) >> 56;
  } while (0);
  (*b) += 8;
}


x86 assembly (clang, -O0):
<bytestream_put_be64>:
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,0x1c(%rax)
mov    -0x10(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0x18(%rax)
mov    -0x10(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0x14(%rax)
mov    -0x10(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0xc(%rax)
mov    -0x10(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x20,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytestream_put_be64>:
mov    (%rdi),%rax
mov    %esi,0x1c(%rax)
mov    %esi,%ecx
sar    $0x8,%ecx
mov    %ecx,0x18(%rax)
mov    %esi,%ecx
sar    $0x10,%ecx
mov    %ecx,0x14(%rax)
sar    $0x18,%esi
mov    %esi,0x10(%rax)
add    $0x20,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @bytestream_put_be64(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 7
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 6
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 5
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 4
store i32 %23, i32* %26
%27 = load i32, i32* %5
%28 = ashr i32 %27, 32
%29 = load i32**, i32*** %3
%30 = load i32*, i32** %29
%31 = getelementptr inbounds i32, i32* %30, i64 3
store i32 %28, i32* %31
%32 = load i32, i32* %5
%33 = ashr i32 %32, 40
%34 = load i32**, i32*** %3
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 2
store i32 %33, i32* %36
%37 = load i32, i32* %5
%38 = ashr i32 %37, 48
%39 = load i32**, i32*** %3
%40 = load i32*, i32** %39
%41 = getelementptr inbounds i32, i32* %40, i64 1
store i32 %38, i32* %41
%42 = load i32, i32* %5
%43 = ashr i32 %42, 56
%44 = load i32**, i32*** %3
%45 = load i32*, i32** %44
%46 = getelementptr inbounds i32, i32* %45, i64 0
store i32 %43, i32* %46
br label %47
47: ; preds = %6
%48 = load i32**, i32*** %3
%49 = load i32*, i32** %48
%50 = getelementptr inbounds i32, i32* %49, i64 8
store i32* %50, i32** %48
ret void
}

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