#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 */

/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
void create_header(unsigned long long amt, unsigned msg_sz, unsigned code_sz,
                   unsigned char *buf) {
  memset(buf, 0, 16);
  buf[0] = (amt >> 56) & 0xff;
  buf[1] = (amt >> 48) & 0xff;
  buf[2] = (amt >> 40) & 0xff;
  buf[3] = (amt >> 32) & 0xff;
  buf[4] = (amt >> 24) & 0xff;
  buf[5] = (amt >> 16) & 0xff;
  buf[6] = (amt >> 8) & 0xff;
  buf[7] = amt & 0xff;
  buf[8] = msg_sz;
  buf[9] = code_sz;
}


x86 assembly (clang, -O0):
<create_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
shr    $0x38,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
shr    $0x30,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
shr    $0x28,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
shr    $0x20,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x8(%rax)
mov    -0x10(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x9(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_header>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %esi,%r15d
mov    %rdi,%rbp
mov    %rcx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
mov    %rbp,%rcx
mov    %rbp,%rax
shr    $0x38,%rax
mov    %al,(%rbx)
mov    %rbp,%rax
shr    $0x30,%rax
mov    %al,0x1(%rbx)
mov    %rbp,%rax
shr    $0x28,%rax
mov    %al,0x2(%rbx)
mov    %rbp,%rax
shr    $0x20,%rax
mov    %al,0x3(%rbx)
mov    %rbp,%rax
shr    $0x18,%rax
mov    %al,0x4(%rbx)
mov    %rbp,%rax
shr    $0x10,%rax
mov    %al,0x5(%rbx)
mov    %ch,0x6(%rbx)
mov    %cl,0x7(%rbx)
mov    %r15b,0x8(%rbx)
mov    %r14b,0x9(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @create_header(i64 %0, i32 %1, i32 %2, i8* %3) {
%5 = tail call i32 @memset(i8* %3, i32 0, i32 16)
%6 = lshr i64 %0, 56
%7 = trunc i64 %6 to i8
store i8 %7, i8* %3
%8 = lshr i64 %0, 48
%9 = trunc i64 %8 to i8
%10 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %9, i8* %10
%11 = lshr i64 %0, 40
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %12, i8* %13
%14 = lshr i64 %0, 32
%15 = trunc i64 %14 to i8
%16 = getelementptr inbounds i8, i8* %3, i64 3
store i8 %15, i8* %16
%17 = lshr i64 %0, 24
%18 = trunc i64 %17 to i8
%19 = getelementptr inbounds i8, i8* %3, i64 4
store i8 %18, i8* %19
%20 = lshr i64 %0, 16
%21 = trunc i64 %20 to i8
%22 = getelementptr inbounds i8, i8* %3, i64 5
store i8 %21, i8* %22
%23 = lshr i64 %0, 8
%24 = trunc i64 %23 to i8
%25 = getelementptr inbounds i8, i8* %3, i64 6
store i8 %24, i8* %25
%26 = trunc i64 %0 to i8
%27 = getelementptr inbounds i8, i8* %3, i64 7
store i8 %26, i8* %27
%28 = trunc i32 %1 to i8
%29 = getelementptr inbounds i8, i8* %3, i64 8
store i8 %28, i8* %29
%30 = trunc i32 %2 to i8
%31 = getelementptr inbounds i8, i8* %3, i64 9
store i8 %30, i8* %31
ret void
}