#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 TtlMarshal_uint64_t(uint8_t **cursor, const uint64_t *x) {
  uint8_t *buffer = *cursor;
  uint64_t y = *x;
  buffer[0] = (uint8_t)(y >> 56);
  buffer[1] = (uint8_t)((y >> 48) & 0xff);
  buffer[2] = (uint8_t)((y >> 40) & 0xff);
  buffer[3] = (uint8_t)((y >> 32) & 0xff);
  buffer[4] = (uint8_t)((y >> 24) & 0xff);
  buffer[5] = (uint8_t)((y >> 16) & 0xff);
  buffer[6] = (uint8_t)((y >> 8) & 0xff);
  buffer[7] = (uint8_t)(y & 0xff);
  *cursor += 8;
}


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

x86 assembly (clang, -O2):
<TtlMarshal_uint64_t>:
push   %rbx
mov    (%rdi),%rcx
mov    (%rsi),%eax
mov    %eax,%edx
movzbl %ah,%ebx
movzbl %al,%esi
shr    $0x18,%rax
mov    %rax,0x20(%rcx)
shr    $0x10,%edx
movzbl %dl,%eax
mov    %rax,0x28(%rcx)
mov    %rbx,0x30(%rcx)
mov    %rsi,0x38(%rcx)
add    $0x40,%rcx
mov    %rcx,(%rdi)
pop    %rbx
ret

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

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