#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 scalar_t__ uint8_t;
typedef int uint64_t;

/* Variables and functions */
void hack_putll(uint8_t *buf, uint64_t val) {
  buf[0] = (uint8_t)((val >> 56) & 0xff);
  buf[1] = (uint8_t)((val >> 48) & 0xff);
  buf[2] = (uint8_t)((val >> 40) & 0xff);
  buf[3] = (uint8_t)((val >> 32) & 0xff);
  buf[4] = (uint8_t)((val >> 24) & 0xff);
  buf[5] = (uint8_t)((val >> 16) & 0xff);
  buf[6] = (uint8_t)((val >> 8) & 0xff);
  buf[7] = (uint8_t)(val & 0xff);
}


x86 assembly (clang, -O0):
<hack_putll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
mov    $0x30,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0xc(%rbp),%eax
mov    $0x28,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x38(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<hack_putll>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %rax,0x20(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %rax,0x28(%rdi)
mov    %rdx,0x30(%rdi)
mov    %rsi,0x38(%rdi)
ret

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

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