#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*/ abort();
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
void handleData2(char *data, int len) {
  char *buff = malloc(8);
  if (!buff) {
    abort();
  }
  bzero(buff, 8);
  memcpy(buff, data, len);
  printf("# vulnserver_cov: Handledata2: %s\n", buff);
  free(buff);
}


x86 assembly (clang, -O0):
<handleData2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118f <handleData2+0x2f>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   1080 <bzero@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1060 <memcpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xe48(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleData2>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    $0x8,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     11b2 <handleData2+0x52>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x8,%esi
call   1080 <bzero@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
call   1060 <memcpy@plt>
lea    0xe62(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"# vulnserver_cov: Handledata2: %s\0A\00"
define void @handleData2(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call i8* @malloc(i32 8)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = call i32 @bzero(i8* %12, i32 8)
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = call i32 @memcpy(i8* %14, i8* %15, i32 %16)
%18 = load i8*, i8** %5
%19 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %5
%21 = call i32 @free(i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"# vulnserver_cov: Handledata2: %s\0A\00"
define void @handleData2(i8* %0, i32 %1) {
%3 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
%8 = tail call i32 @bzero(i8* %3, i32 8)
%9 = tail call i32 @memcpy(i8* %3, i8* %0, i32 %1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = tail call i32 @free(i8* %3)
ret void
}