#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*/ lstrcat(char *, char *);
int /*<<< orphan*/ lstrcpy(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ wsprintf(char *, char *, ...);
void CopyPacketContent(char *str) {
  char buffer[8000];
  char TempStr[15];
  int Count = 0;
  int PrintBufferLength = 1514;
  int nCounter = 0;
  lstrcpy(buffer, "\0");
  while (nCounter < PrintBufferLength) {
    if ((nCounter % 16) == 0) {
      wsprintf(TempStr, "\r\n %08d :  ", Count);
      lstrcat(buffer, TempStr);
      Count++;
    }
    if ((nCounter % 8) == 0)
      lstrcat(buffer, " ");
    wsprintf(TempStr, "0E ");
    lstrcat(buffer, TempStr);
    nCounter++;
  }
  lstrcat(buffer, "\0");
  strcpy(str, buffer);
  return;
}


x86 assembly (clang, -O0):
<CopyPacketContent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f70,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x1f64(%rbp)
movl   $0x5ea,-0x1f68(%rbp)
movl   $0x0,-0x1f6c(%rbp)
lea    -0x1f50(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <lstrcpy@plt>
mov    -0x1f6c(%rbp),%eax
cmp    -0x1f68(%rbp),%eax
jge    124c <CopyPacketContent+0x10c>
mov    -0x1f6c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e6 <CopyPacketContent+0xa6>
lea    -0x1f5f(%rbp),%rdi
mov    -0x1f64(%rbp),%edx
lea    0xe45(%rip),%rsi
mov    $0x0,%al
call   1060 <wsprintf@plt>
lea    -0x1f50(%rbp),%rdi
lea    -0x1f5f(%rbp),%rsi
call   1050 <lstrcat@plt>
mov    -0x1f64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f64(%rbp)
mov    -0x1f6c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1210 <CopyPacketContent+0xd0>
lea    -0x1f50(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   1050 <lstrcat@plt>
lea    -0x1f5f(%rbp),%rdi
lea    0xdf0(%rip),%rsi
mov    $0x0,%al
call   1060 <wsprintf@plt>
lea    -0x1f50(%rbp),%rdi
lea    -0x1f5f(%rbp),%rsi
call   1050 <lstrcat@plt>
mov    -0x1f6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f6c(%rbp)
jmp    1180 <CopyPacketContent+0x40>
lea    -0x1f50(%rbp),%rdi
lea    0xda6(%rip),%rsi
call   1050 <lstrcat@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1f50(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x1f70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CopyPacketContent>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f68,%rsp
mov    %rdi,0x8(%rsp)
lea    0xea3(%rip),%rsi
lea    0x20(%rsp),%r12
mov    %r12,%rdi
call   1040 <lstrcpy@plt>
lea    0x11(%rsp),%rbx
lea    0xe96(%rip),%r13
lea    0xe91(%rip),%rbp
xor    %r15d,%r15d
xor    %r14d,%r14d
jmp    11b5 <CopyPacketContent+0x75>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <wsprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <lstrcat@plt>
add    $0x1,%r15d
cmp    $0x5ea,%r15d
je     1206 <CopyPacketContent+0xc6>
test   $0xf,%r15b
je     11d0 <CopyPacketContent+0x90>
test   $0x7,%r15b
jne    1190 <CopyPacketContent+0x50>
jmp    11f9 <CopyPacketContent+0xb9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
lea    0xe28(%rip),%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1060 <wsprintf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <lstrcat@plt>
add    $0x1,%r14d
test   $0x7,%r15b
jne    1190 <CopyPacketContent+0x50>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <lstrcat@plt>
jmp    1190 <CopyPacketContent+0x50>
lea    0xdf3(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <lstrcat@plt>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
add    $0x1f68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] zeroinitializer
@.str.1 = [12 x i8] c"\0D\0A %08d : \00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [4 x i8] c"0E \00"
define void @CopyPacketContent(i8* %0) {
%2 = alloca i8*
%3 = alloca [8000 x i8]
%4 = alloca [15 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %5
store i32 1514, i32* %6
store i32 0, i32* %7
%8 = getelementptr inbounds [8000 x i8], [8000 x i8]* %3, i64 0, i64 0
%9 = call i32 @lstrcpy(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %34, %1
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %42
14: ; preds = %10
%15 = load i32, i32* %7
%16 = srem i32 %15, 16
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%20 = load i32, i32* %5
%21 = call i32 (i8*, i8*, ...) @wsprintf(i8* %19, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [8000 x i8], [8000 x i8]* %3, i64 0, i64 0
%23 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%24 = call i32 @lstrcat(i8* %22, i8* %23)
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %27
27: ; preds = %18, %14
%28 = load i32, i32* %7
%29 = srem i32 %28, 8
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = getelementptr inbounds [8000 x i8], [8000 x i8]* %3, i64 0, i64 0
%33 = call i32 @lstrcat(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %31, %27
%35 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%36 = call i32 (i8*, i8*, ...) @wsprintf(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%37 = getelementptr inbounds [8000 x i8], [8000 x i8]* %3, i64 0, i64 0
%38 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%39 = call i32 @lstrcat(i8* %37, i8* %38)
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %10
42: ; preds = %10
%43 = getelementptr inbounds [8000 x i8], [8000 x i8]* %3, i64 0, i64 0
%44 = call i32 @lstrcat(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%45 = load i8*, i8** %2
%46 = getelementptr inbounds [8000 x i8], [8000 x i8]* %3, i64 0, i64 0
%47 = call i32 @strcpy(i8* %45, i8* %46)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] zeroinitializer
@.str.1 = [12 x i8] c"\0D\0A %08d : \00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [4 x i8] c"0E \00"
define void @CopyPacketContent(i8* %0) {
%2 = alloca [8000 x i8]
%3 = alloca [15 x i8]
%4 = getelementptr inbounds [8000 x i8], [8000 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%6 = call i32 @lstrcpy(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %22
%8 = phi i32 [ 0, %1 ], [ %25, %22 ]
%9 = phi i32 [ 0, %1 ], [ %17, %22 ]
%10 = and i32 %8, 15
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
%13 = call i32 (i8*, i8*, ...) @wsprintf(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%14 = call i32 @lstrcat(i8* %4, i8* %5)
%15 = add nsw i32 %9, 1
br label %16
16: ; preds = %12, %7
%17 = phi i32 [ %15, %12 ], [ %9, %7 ]
%18 = and i32 %8, 7
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @lstrcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = call i32 (i8*, i8*, ...) @wsprintf(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @lstrcat(i8* %4, i8* %5)
%25 = add nuw nsw i32 %8, 1
%26 = icmp eq i32 %25, 1514
br i1 %26, label %27, label %7
27: ; preds = %22
%28 = call i32 @lstrcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @strcpy(i8* %0, i8* %4)
ret void
}