#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(unsigned char *, unsigned char const *,
                          unsigned long);
int /*<<< orphan*/ printf(char *, unsigned char);
int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size) {
  unsigned char buf[4];
  if (size < 8)
    return 0;
  if (data[0] == 'h' && data[1] == 'i' && data[2] == '!') {
    memcpy(buf, data, size);
    printf("test: %.2X\n", buf[0]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<LLVMFuzzerTestOneInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x8,-0x18(%rbp)
jae    1147 <LLVMFuzzerTestOneInput+0x27>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <LLVMFuzzerTestOneInput+0x81>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x68,%eax
jne    119a <LLVMFuzzerTestOneInput+0x7a>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x69,%eax
jne    119a <LLVMFuzzerTestOneInput+0x7a>
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
cmp    $0x21,%eax
jne    119a <LLVMFuzzerTestOneInput+0x7a>
lea    -0x1c(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
lea    0xe6f(%rip),%rdi
movzbl -0x1c(%rbp),%esi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LLVMFuzzerTestOneInput>:
push   %rax
mov    %rsi,%rdx
cmp    $0x8,%rsi
jb     1159 <LLVMFuzzerTestOneInput+0x39>
mov    %rdi,%rsi
cmpb   $0x68,(%rdi)
jne    1159 <LLVMFuzzerTestOneInput+0x39>
cmpb   $0x69,0x1(%rsi)
jne    1159 <LLVMFuzzerTestOneInput+0x39>
cmpb   $0x21,0x2(%rsi)
jne    1159 <LLVMFuzzerTestOneInput+0x39>
lea    0x4(%rsp),%rdi
call   1040 <memcpy@plt>
movzbl 0x4(%rsp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"test: %.2X\0A\00"
define i32 @LLVMFuzzerTestOneInput(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca [4 x i8]
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i64, i64* %5
%8 = icmp ult i64 %7, 8
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %37
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 104
br i1 %15, label %16, label %36
16: ; preds = %10
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %20, 105
br i1 %21, label %22, label %36
22: ; preds = %16
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 2
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = icmp eq i32 %26, 33
br i1 %27, label %28, label %36
28: ; preds = %22
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%30 = load i8*, i8** %4
%31 = load i64, i64* %5
%32 = call i32 @memcpy(i8* %29, i8* %30, i64 %31)
%33 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%34 = load i8, i8* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %34)
br label %36
36: ; preds = %28, %22, %16, %10
store i32 0, i32* %3
br label %37
37: ; preds = %36, %9
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [12 x i8] c"test: %.2X\0A\00"
define i32 @LLVMFuzzerTestOneInput(i8* %0, i64 %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = icmp ult i64 %1, 8
br i1 %5, label %21, label %6
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 104
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 105
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 33
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%19 = load i8, i8* %4
%20 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %19)
br label %21
21: ; preds = %6, %9, %13, %17, %2
ret i32 0
}