#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 wm64(uint8_t a[8], uint64_t x) {
  a[0] = x >> 56;
  a[1] = x >> 48;
  a[2] = x >> 40;
  a[3] = x >> 32;
  a[4] = x >> 24;
  a[5] = x >> 16;
  a[6] = x >> 8;
  a[7] = x >> 0;
}


x86 assembly (clang, -O0):
<wm64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x0,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<wm64>:
mov    %esi,%eax
sar    $0x18,%eax
mov    %eax,0x10(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x14(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x18(%rdi)
mov    %esi,0x1c(%rdi)
ret

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

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