#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*/ hexdump(unsigned char *, unsigned char *, long,
                           unsigned char *);
int /*<<< orphan*/ imagefiletype(unsigned char *, long);
scalar_t__ strncmp(char *, unsigned char *, int);
void analyse(unsigned char *buf, long buflen) {
  if (buflen > 16 && strncmp("ImageFileType**", buf, 15) == 0)
    imagefiletype(buf, buflen);
  else
    hexdump(buf, buf, buflen, buf + buflen);
}


x86 assembly (clang, -O0):
<analyse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x10,-0x10(%rbp)
jle    117c <analyse+0x4c>
mov    -0x8(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0xf,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    117c <analyse+0x4c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <imagefiletype@plt>
jmp    1195 <analyse+0x65>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
add    -0x10(%rbp),%rcx
call   1040 <hexdump@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analyse>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    $0x11,%rsi
jl     1159 <analyse+0x29>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
mov    $0xf,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1172 <analyse+0x42>
lea    (%rbx,%r14,1),%rcx
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <hexdump@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <imagefiletype@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"ImageFileType**\00"
define void @analyse(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp sgt i64 %5, 16
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i64 @strncmp(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %8, i32 15)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i64, i64* %4
%14 = call i32 @imagefiletype(i8* %12, i64 %13)
br label %23
15: ; preds = %7, %2
%16 = load i8*, i8** %3
%17 = load i8*, i8** %3
%18 = load i64, i64* %4
%19 = load i8*, i8** %3
%20 = load i64, i64* %4
%21 = getelementptr inbounds i8, i8* %19, i64 %20
%22 = call i32 @hexdump(i8* %16, i8* %17, i64 %18, i8* %21)
br label %23
23: ; preds = %15, %11
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"ImageFileType**\00"
define void @analyse(i8* %0, i64 %1) {
%3 = icmp sgt i64 %1, 16
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = tail call i64 @strncmp(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i32 15)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @imagefiletype(i8* %0, i64 %1)
br label %12
9: ; preds = %4, %2
%10 = getelementptr inbounds i8, i8* %0, i64 %1
%11 = tail call i32 @hexdump(i8* %0, i8* %0, i64 %1, i8* %10)
br label %12
12: ; preds = %9, %7
ret void
}