#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__ len;

/* Variables and functions */
int checksum(unsigned char *, unsigned long);
void make_li_header(unsigned char *hdr, unsigned char *data,
                    unsigned long len) {
  hdr[0 + 0] = (unsigned char)((0) & 0xff);
  hdr[0 + 1] = (unsigned char)(((0) >> 8) & 0xff);
  hdr[0 + 2] = (unsigned char)(((0) >> 16) & 0xff);
  hdr[0 + 3] = (unsigned char)(((0) >> 24) & 0xff);
  hdr[4 + 0] = (unsigned char)((0xffffffff) & 0xff);
  hdr[4 + 1] = (unsigned char)(((0xffffffff) >> 8) & 0xff);
  hdr[4 + 2] = (unsigned char)(((0xffffffff) >> 16) & 0xff);
  hdr[4 + 3] = (unsigned char)(((0xffffffff) >> 24) & 0xff);
  hdr[8 + 0] = (unsigned char)((len)&0xff);
  hdr[8 + 1] = (unsigned char)(((len) >> 8) & 0xff);
  hdr[8 + 2] = (unsigned char)(((len) >> 16) & 0xff);
  hdr[8 + 3] = (unsigned char)(((len) >> 24) & 0xff);
  hdr[12 + 0] = (unsigned char)((checksum(data, len)) & 0xff);
  hdr[12 + 1] = (unsigned char)(((checksum(data, len)) >> 8) & 0xff);
  hdr[14 + 0] = (unsigned char)((0x694c) & 0xff);
  hdr[14 + 1] = (unsigned char)(((0x694c) >> 8) & 0xff);
}


x86 assembly (clang, -O0):
<make_li_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x3(%rax)
mov    -0x8(%rbp),%rax
movb   $0xff,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0xff,0x5(%rax)
mov    -0x8(%rbp),%rax
movb   $0xff,0x6(%rax)
mov    -0x8(%rbp),%rax
movb   $0xff,0x7(%rax)
mov    -0x18(%rbp),%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x8(%rax)
mov    -0x18(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x9(%rax)
mov    -0x18(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0xa(%rax)
mov    -0x18(%rbp),%rax
shr    $0x18,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0xb(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <checksum@plt>
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0xc(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <checksum@plt>
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0xd(%rax)
mov    -0x8(%rbp),%rax
movb   $0x4c,0xe(%rax)
mov    -0x8(%rbp),%rax
movb   $0x69,0xf(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_li_header>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
movabs $0xffffffff00000000,%rax
ff ff ff
mov    %rax,(%rdi)
mov    %dl,0x8(%rdi)
mov    %dh,0x9(%rdi)
mov    %rdx,%rax
shr    $0x10,%rax
mov    %al,0xa(%rdi)
mov    %rdx,%rax
shr    $0x18,%rax
mov    %al,0xb(%rdi)
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rdx,%r15
call   1030 <checksum@plt>
mov    %al,0xc(%rbx)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <checksum@plt>
mov    %ah,0xd(%rbx)
movw   $0x694c,0xe(%rbx)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @make_li_header(i8* nocapture writeonly %0, i8* %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %0 to i32*
store i32 0, i32* %5
%6 = trunc i64 %2 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 8
%8 = bitcast i8* %4 to i32*
store i32 -1, i32* %8
store i8 %6, i8* %7
%9 = lshr i64 %2, 8
%10 = trunc i64 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %10, i8* %11
%12 = lshr i64 %2, 16
%13 = trunc i64 %12 to i8
%14 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %13, i8* %14
%15 = lshr i64 %2, 24
%16 = trunc i64 %15 to i8
%17 = getelementptr inbounds i8, i8* %0, i64 11
store i8 %16, i8* %17
%18 = tail call i32 @checksum(i8* %1, i64 %2)
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds i8, i8* %0, i64 12
store i8 %19, i8* %20
%21 = tail call i32 @checksum(i8* %1, i64 %2)
%22 = lshr i32 %21, 8
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds i8, i8* %0, i64 13
store i8 %23, i8* %24
%25 = getelementptr inbounds i8, i8* %0, i64 14
store i8 76, i8* %25
%26 = getelementptr inbounds i8, i8* %0, i64 15
store i8 105, i8* %26
ret void
}