#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*/ memcpy(char *, char *, int);
void tls12_ticket_auth_pack_data(char *encryptdata, int start, int len,
                                 char *out_buffer, int outlength) {
  out_buffer[outlength] = 0x17;
  out_buffer[outlength + 1] = 0x3;
  out_buffer[outlength + 2] = 0x3;
  out_buffer[outlength + 3] = (char)(len >> 8);
  out_buffer[outlength + 4] = (char)len;
  memcpy(out_buffer + outlength + 5, encryptdata + start, len);
}


x86 assembly (clang, -O0):
<tls12_ticket_auth_pack_data>:
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    %r8d,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x17,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x3,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x3,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
add    $0x5,%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x10(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tls12_ticket_auth_pack_data>:
movslq %r8d,%rax
movw   $0x317,(%rcx,%rax,1)
movb   $0x3,0x2(%rcx,%rax,1)
mov    %dh,0x3(%rcx,%rax,1)
mov    %dl,0x4(%rcx,%rax,1)
add    %rcx,%rax
add    $0x5,%rax
movslq %esi,%rsi
add    %rdi,%rsi
mov    %rax,%rdi
jmp    1030 <memcpy@plt>

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

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