#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 __wleu64(uint8_t *buffer, uint64_t value) {
  buffer[7] = (uint8_t)(value >> 56) & 0xFF;
  buffer[6] = (uint8_t)(value >> 48) & 0xFF;
  buffer[5] = (uint8_t)(value >> 40) & 0xFF;
  buffer[4] = (uint8_t)(value >> 32) & 0xFF;
  buffer[3] = (uint8_t)(value >> 24) & 0xFF;
  buffer[2] = (uint8_t)(value >> 16) & 0xFF;
  buffer[1] = (uint8_t)(value >> 8) & 0xFF;
  buffer[0] = (uint8_t)(value >> 0) & 0xFF;
}


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

x86 assembly (clang, -O2):
<__wleu64>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,0xc(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x8(%rdi)
mov    %edx,0x4(%rdi)
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @__wleu64(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 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 7
store i32 %7, i32* %9
%10 = load i32, i32* %4
%11 = ashr i32 %10, 48
%12 = and i32 %11, 255
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 6
store i32 %12, i32* %14
%15 = load i32, i32* %4
%16 = ashr i32 %15, 40
%17 = and i32 %16, 255
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 5
store i32 %17, i32* %19
%20 = load i32, i32* %4
%21 = ashr i32 %20, 32
%22 = and i32 %21, 255
%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, 24
%27 = and i32 %26, 255
%28 = load i32*, i32** %3
%29 = getelementptr inbounds i32, i32* %28, i64 3
store i32 %27, i32* %29
%30 = load i32, i32* %4
%31 = ashr i32 %30, 16
%32 = and i32 %31, 255
%33 = load i32*, i32** %3
%34 = getelementptr inbounds i32, i32* %33, i64 2
store i32 %32, i32* %34
%35 = load i32, i32* %4
%36 = ashr i32 %35, 8
%37 = and i32 %36, 255
%38 = load i32*, i32** %3
%39 = getelementptr inbounds i32, i32* %38, i64 1
store i32 %37, i32* %39
%40 = load i32, i32* %4
%41 = ashr i32 %40, 0
%42 = and i32 %41, 255
%43 = load i32*, i32** %3
%44 = getelementptr inbounds i32, i32* %43, i64 0
store i32 %42, i32* %44
ret void
}

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