#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 store48(void *dst, uint64_t w) {
  uint8_t *p = (uint8_t *)dst;
  p[0] = (uint8_t)(w >> 0);
  p[1] = (uint8_t)(w >> 8);
  p[2] = (uint8_t)(w >> 16);
  p[3] = (uint8_t)(w >> 24);
  p[4] = (uint8_t)(w >> 32);
  p[5] = (uint8_t)(w >> 40);
}


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

x86 assembly (clang, -O2):
<store48>:
movslq %esi,%rax
mov    %rax,(%rdi)
mov    %eax,%ecx
sar    $0x8,%ecx
movslq %ecx,%rcx
mov    %rcx,0x8(%rdi)
mov    %eax,%ecx
sar    $0x10,%ecx
movslq %ecx,%rcx
mov    %rcx,0x10(%rdi)
sar    $0x18,%eax
cltq
mov    %rax,0x18(%rdi)
ret

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

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