#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 int8_t;
typedef int int64_t;

/* Variables and functions */
void st_i64_be(void *x, int64_t i) {
  ((((((int8_t *)x)[0]) = ((i >> 32 >> 16) >> 8) % 256,
     (((uint8_t *)x)[1]) = ((i >> 32 >> 16) % 256)),
    ((((uint8_t *)x)[2]) = ((i >> 32) >> 8) % 256,
     (((uint8_t *)x)[3]) = ((i >> 32) % 256))),
   (((((uint8_t *)x)[4]) = ((i >> 16) >> 8) % 256,
     (((uint8_t *)x)[5]) = ((i >> 16) % 256)),
    ((((uint8_t *)x)[6]) = ((i) >> 8) % 256,
     (((uint8_t *)x)[7]) = ((i) % 256))));
}


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

x86 assembly (clang, -O2):
<st_i64_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,0x10(%rdi)
and    $0xffffff00,%edx
sub    %edx,%eax
cwtl
mov    %eax,0x14(%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,0x18(%rdi)
and    $0xffffff00,%ecx
sub    %ecx,%esi
mov    %esi,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @st_i64_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, 32
%7 = ashr i32 %6, 16
%8 = ashr i32 %7, 8
%9 = srem i32 %8, 256
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to i32*
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %9, i32* %12
%13 = load i32, i32* %4
%14 = ashr i32 %13, 32
%15 = ashr i32 %14, 16
%16 = srem i32 %15, 256
%17 = load i8*, i8** %3
%18 = bitcast i8* %17 to i32*
%19 = getelementptr inbounds i32, i32* %18, i64 1
store i32 %16, i32* %19
%20 = load i32, i32* %4
%21 = ashr i32 %20, 32
%22 = ashr i32 %21, 8
%23 = srem i32 %22, 256
%24 = load i8*, i8** %3
%25 = bitcast i8* %24 to i32*
%26 = getelementptr inbounds i32, i32* %25, i64 2
store i32 %23, i32* %26
%27 = load i32, i32* %4
%28 = ashr i32 %27, 32
%29 = srem i32 %28, 256
%30 = load i8*, i8** %3
%31 = bitcast i8* %30 to i32*
%32 = getelementptr inbounds i32, i32* %31, i64 3
store i32 %29, i32* %32
%33 = load i32, i32* %4
%34 = ashr i32 %33, 16
%35 = ashr i32 %34, 8
%36 = srem i32 %35, 256
%37 = load i8*, i8** %3
%38 = bitcast i8* %37 to i32*
%39 = getelementptr inbounds i32, i32* %38, i64 4
store i32 %36, i32* %39
%40 = load i32, i32* %4
%41 = ashr i32 %40, 16
%42 = srem i32 %41, 256
%43 = load i8*, i8** %3
%44 = bitcast i8* %43 to i32*
%45 = getelementptr inbounds i32, i32* %44, i64 5
store i32 %42, i32* %45
%46 = load i32, i32* %4
%47 = ashr i32 %46, 8
%48 = srem i32 %47, 256
%49 = load i8*, i8** %3
%50 = bitcast i8* %49 to i32*
%51 = getelementptr inbounds i32, i32* %50, i64 6
store i32 %48, i32* %51
%52 = load i32, i32* %4
%53 = srem i32 %52, 256
%54 = load i8*, i8** %3
%55 = bitcast i8* %54 to i32*
%56 = getelementptr inbounds i32, i32* %55, i64 7
store i32 %53, i32* %56
ret void
}

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