#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 /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ timestamp;
typedef int /*<<< orphan*/ flags;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ htole32(int /*<<< orphan*/);
int /*<<< orphan*/ htole64(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void metadata_set(uint8_t *header, uint64_t timestamp, uint32_t flags) {
  timestamp = htole64(timestamp);
  flags = htole32(flags);
  assert(sizeof(timestamp) == (sizeof(uint64_t)));
  assert(sizeof(flags) == (sizeof(uint32_t)));
  memset(&header[0], 0, (sizeof(uint32_t)));
  memcpy(&header[((sizeof(uint32_t)))], &timestamp, (sizeof(uint64_t)));
  memcpy(&header[(((sizeof(uint32_t))) + (sizeof(uint64_t)))], &flags,
         (sizeof(uint32_t)));
}


x86 assembly (clang, -O0):
<metadata_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <htole64@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <htole32@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1060 <memcpy@plt>
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1060 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<metadata_set>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
call   1070 <htole64@plt>
mov    %eax,0x4(%rsp)
mov    %ebp,%edi
call   1030 <htole32@plt>
mov    %eax,(%rsp)
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
lea    0x10(%rbx),%rdi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1060 <memcpy@plt>
add    $0x20,%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1060 <memcpy@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @metadata_set(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = call i32 @htole64(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @htole32(i32 %9)
store i32 %10, i32* %6
%11 = call i32 @assert(i32 1)
%12 = call i32 @assert(i32 1)
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 0
%15 = call i32 @memset(i32* %14, i32 0, i32 4)
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 4
%18 = call i32 @memcpy(i32* %17, i32* %5, i32 4)
%19 = load i32*, i32** %4
%20 = getelementptr inbounds i32, i32* %19, i64 8
%21 = call i32 @memcpy(i32* %20, i32* %6, i32 4)
ret void
}

LLVM IR (-O2):
define void @metadata_set(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = tail call i32 @htole64(i32 %1)
store i32 %6, i32* %4
%7 = tail call i32 @htole32(i32 %2)
store i32 %7, i32* %5
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @memset(i32* %0, i32 0, i32 4)
%11 = getelementptr inbounds i32, i32* %0, i64 4
%12 = call i32 @memcpy(i32* %11, i32* %4, i32 4)
%13 = getelementptr inbounds i32, i32* %0, i64 8
%14 = call i32 @memcpy(i32* %13, i32* %5, i32 4)
ret void
}