#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 uint32_t;

/* Variables and functions */
void TtlMarshal_uint32_t(uint8_t **cursor, const uint32_t *x) {
  uint8_t *buffer = *cursor;
  uint32_t y = *x;
  buffer[0] = (uint8_t)(y >> 24);
  buffer[1] = (uint8_t)((y >> 16) & 0xff);
  buffer[2] = (uint8_t)((y >> 8) & 0xff);
  buffer[3] = (uint8_t)((y >> 0) & 0xff);
  *cursor += 4;
}


x86 assembly (clang, -O0):
<TtlMarshal_uint32_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
sar    $0x18,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1c(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x1c(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x1c(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
movslq %eax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x20,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @TtlMarshal_uint32_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, 24
%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, 16
%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, 8
%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, 0
%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 i64**, i64*** %3
%35 = load i64*, i64** %34
%36 = getelementptr inbounds i64, i64* %35, i64 4
store i64* %36, i64** %34
ret void
}

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