#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 bytes_w64net(uint8_t *data, uint64_t v) {
  data[7] = v;
  data[6] = v >> 8;
  data[5] = v >> 16;
  data[4] = v >> 24;
  data[3] = v >> 32;
  data[2] = v >> 40;
  data[1] = v >> 48;
  data[0] = v >> 56;
}


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

x86 assembly (clang, -O2):
<bytes_w64net>:
mov    %esi,0x1c(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x18(%rdi)
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,0x14(%rdi)
sar    $0x18,%esi
mov    %esi,0x10(%rdi)
ret

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

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