#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 */
unsigned int le64put(void *p, uint64_t v) {
  uint8_t *a;
  a = p;
  a[0] = v;
  a[1] = v >> 8;
  a[2] = v >> 16;
  a[3] = v >> 24;
  a[4] = v >> 32;
  a[5] = v >> 40;
  a[6] = v >> 48;
  a[7] = v >> 56;
  return 8;
}


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

x86 assembly (clang, -O2):
<le64put>:
mov    %esi,(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x4(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x8(%rdi)
sar    $0x18,%esi
mov    %esi,0xc(%rdi)
mov    $0x8,%eax
ret

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

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