#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 encle64(const uint64_t n, void *_b) {
  uint8_t *b = (uint8_t *)_b;
  b[0] = (n >> 0) & 0xff;
  b[1] = (n >> 8) & 0xff;
  b[2] = (n >> 16) & 0xff;
  b[3] = (n >> 24) & 0xff;
  b[4] = (n >> 32) & 0xff;
  b[5] = (n >> 40) & 0xff;
  b[6] = (n >> 48) & 0xff;
  b[7] = (n >> 56) & 0xff;
}


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

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

LLVM IR (-O0):
define void @encle64(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %3
%9 = ashr i32 %8, 0
%10 = and i32 %9, 255
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 0
store i32 %10, i32* %12
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 1
store i32 %15, i32* %17
%18 = load i32, i32* %3
%19 = ashr i32 %18, 16
%20 = and i32 %19, 255
%21 = load i32*, i32** %5
%22 = getelementptr inbounds i32, i32* %21, i64 2
store i32 %20, i32* %22
%23 = load i32, i32* %3
%24 = ashr i32 %23, 24
%25 = and i32 %24, 255
%26 = load i32*, i32** %5
%27 = getelementptr inbounds i32, i32* %26, i64 3
store i32 %25, i32* %27
%28 = load i32, i32* %3
%29 = ashr i32 %28, 32
%30 = and i32 %29, 255
%31 = load i32*, i32** %5
%32 = getelementptr inbounds i32, i32* %31, i64 4
store i32 %30, i32* %32
%33 = load i32, i32* %3
%34 = ashr i32 %33, 40
%35 = and i32 %34, 255
%36 = load i32*, i32** %5
%37 = getelementptr inbounds i32, i32* %36, i64 5
store i32 %35, i32* %37
%38 = load i32, i32* %3
%39 = ashr i32 %38, 48
%40 = and i32 %39, 255
%41 = load i32*, i32** %5
%42 = getelementptr inbounds i32, i32* %41, i64 6
store i32 %40, i32* %42
%43 = load i32, i32* %3
%44 = ashr i32 %43, 56
%45 = and i32 %44, 255
%46 = load i32*, i32** %5
%47 = getelementptr inbounds i32, i32* %46, i64 7
store i32 %45, i32* %47
ret void
}

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