#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 /*<<< orphan*/ uint8_t;
typedef int uint64_t;
typedef int int64_t;

/* Variables and functions */
void packi64(uint8_t *buf, int64_t i) {
  uint64_t i2 = i;
  *buf++ = i2 >> 56;
  *buf++ = i2 >> 48;
  *buf++ = i2 >> 40;
  *buf++ = i2 >> 32;
  *buf++ = i2 >> 24;
  *buf++ = i2 >> 16;
  *buf++ = i2 >> 8;
  *buf++ = i2;
}


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

x86 assembly (clang, -O2):
<packi64>:
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 @packi64(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = ashr i32 %7, 56
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i32 1
store i32* %10, i32** %3
store i32 %8, i32* %9
%11 = load i32, i32* %5
%12 = ashr i32 %11, 48
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %3
store i32 %12, i32* %13
%15 = load i32, i32* %5
%16 = ashr i32 %15, 40
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i32 1
store i32* %18, i32** %3
store i32 %16, i32* %17
%19 = load i32, i32* %5
%20 = ashr i32 %19, 32
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i32 1
store i32* %22, i32** %3
store i32 %20, i32* %21
%23 = load i32, i32* %5
%24 = ashr i32 %23, 24
%25 = load i32*, i32** %3
%26 = getelementptr inbounds i32, i32* %25, i32 1
store i32* %26, i32** %3
store i32 %24, i32* %25
%27 = load i32, i32* %5
%28 = ashr i32 %27, 16
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i32 1
store i32* %30, i32** %3
store i32 %28, i32* %29
%31 = load i32, i32* %5
%32 = ashr i32 %31, 8
%33 = load i32*, i32** %3
%34 = getelementptr inbounds i32, i32* %33, i32 1
store i32* %34, i32** %3
store i32 %32, i32* %33
%35 = load i32, i32* %5
%36 = load i32*, i32** %3
%37 = getelementptr inbounds i32, i32* %36, i32 1
store i32* %37, i32** %3
store i32 %35, i32* %36
ret void
}

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