#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ checkXrefTable(int /*<<< orphan*/ *);
scalar_t__ hasAcceptableSize(int /*<<< orphan*/ *);
scalar_t__ hasCorrectPDFVersion(int /*<<< orphan*/ *);
scalar_t__ hasCorrectSignature(int /*<<< orphan*/ *);
scalar_t__ hasImageHexcode(int /*<<< orphan*/ *);
short producerStringPresent(int /*<<< orphan*/ *);
scalar_t__ producerStringWithXrefEntries(int /*<<< orphan*/ *, int);
short trailerContainsHTML(int /*<<< orphan*/ *);
float checkPDFFileByFile(FILE *fptr) {
  if (fptr == NULL)
    return -1;
  float scorepoints = 0.0f;
  if (hasAcceptableSize(fptr))
    scorepoints += 0.5f;
  else
    return -2;
  short producerPresent = producerStringPresent(fptr);
  short hasHTMLTail = 0;
  if (producerPresent) {
    scorepoints += 1.0f;
  } else {
    hasHTMLTail = trailerContainsHTML(fptr);
    if (hasHTMLTail)
      scorepoints += 0.25f;
  }
  if (hasCorrectPDFVersion(fptr))
    scorepoints += 1.0f;
  if (hasCorrectSignature(fptr))
    scorepoints += 2.0f;
  if (hasImageHexcode(fptr))
    scorepoints += 2.0f;
  int xRefLen = 0;
  if (!hasHTMLTail) {
    checkXrefTable(fptr);
    if (xRefLen >= 75 && xRefLen <= 80)
      scorepoints += 1.0f;
  }
  if (!producerPresent && !hasHTMLTail && xRefLen != 0) {
    if (producerStringWithXrefEntries(fptr, xRefLen))
      scorepoints += 1.0f;
  }
  return scorepoints;
}


x86 assembly (clang, -O0):
<checkPDFFileByFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a9 <checkPDFFileByFile+0x29>
movss  0xe75(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    135d <checkPDFFileByFile+0x1dd>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <hasAcceptableSize@plt>
cmp    $0x0,%rax
je     11db <checkPDFFileByFile+0x5b>
movss  0xe38(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    11ed <checkPDFFileByFile+0x6d>
movss  0xe1d(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    135d <checkPDFFileByFile+0x1dd>
mov    -0x10(%rbp),%rdi
call   1030 <producerStringPresent@plt>
mov    %ax,-0x16(%rbp)
movw   $0x0,-0x18(%rbp)
cmpw   $0x0,-0x16(%rbp)
je     1222 <checkPDFFileByFile+0xa2>
movss  0xdf9(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1251 <checkPDFFileByFile+0xd1>
mov    -0x10(%rbp),%rdi
call   10a0 <trailerContainsHTML@plt>
mov    %ax,-0x18(%rbp)
cmpw   $0x0,-0x18(%rbp)
je     124c <checkPDFFileByFile+0xcc>
movss  0xdc6(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1251 <checkPDFFileByFile+0xd1>
mov    -0x10(%rbp),%rdi
call   1040 <hasCorrectPDFVersion@plt>
cmp    $0x0,%rax
je     1276 <checkPDFFileByFile+0xf6>
movss  0xda0(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <hasCorrectSignature@plt>
cmp    $0x0,%rax
je     129b <checkPDFFileByFile+0x11b>
movss  0xd7f(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <hasImageHexcode@plt>
cmp    $0x0,%rax
je     12c0 <checkPDFFileByFile+0x140>
movss  0xd5a(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpw   $0x0,-0x18(%rbp)
jne    1306 <checkPDFFileByFile+0x186>
mov    -0x10(%rbp),%rdi
call   1050 <checkXrefTable@plt>
cmpl   $0x4b,-0x1c(%rbp)
jl     1301 <checkPDFFileByFile+0x181>
cmpl   $0x50,-0x1c(%rbp)
jg     1301 <checkPDFFileByFile+0x181>
movss  0xd15(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1306 <checkPDFFileByFile+0x186>
cmpw   $0x0,-0x16(%rbp)
jne    1353 <checkPDFFileByFile+0x1d3>
cmpw   $0x0,-0x18(%rbp)
jne    1353 <checkPDFFileByFile+0x1d3>
cmpl   $0x0,-0x1c(%rbp)
je     1353 <checkPDFFileByFile+0x1d3>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1070 <producerStringWithXrefEntries@plt>
cmp    $0x0,%rax
je     134e <checkPDFFileByFile+0x1ce>
movss  0xcc8(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1353 <checkPDFFileByFile+0x1d3>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPDFFileByFile>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     11a0 <checkPDFFileByFile+0x30>
mov    %rdi,%rbx
call   1080 <hasAcceptableSize@plt>
test   %rax,%rax
je     11ad <checkPDFFileByFile+0x3d>
mov    %rbx,%rdi
call   1030 <producerStringPresent@plt>
test   %ax,%ax
je     11ba <checkPDFFileByFile+0x4a>
mov    $0x1,%r14b
movss  0xe6a(%rip),%xmm0
jmp    11d9 <checkPDFFileByFile+0x69>
movss  0xe58(%rip),%xmm0
jmp    1262 <checkPDFFileByFile+0xf2>
movss  0xe4f(%rip),%xmm0
jmp    1262 <checkPDFFileByFile+0xf2>
mov    %rbx,%rdi
call   1090 <trailerContainsHTML@plt>
xor    %r14d,%r14d
test   %ax,%ax
sete   %r14b
lea    0xe41(%rip),%rax
movss  (%rax,%r14,4),%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1040 <hasCorrectPDFVersion@plt>
test   %rax,%rax
je     1200 <checkPDFFileByFile+0x90>
movss  0x4(%rsp),%xmm0
addss  0xe12(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1070 <hasCorrectSignature@plt>
test   %rax,%rax
je     1221 <checkPDFFileByFile+0xb1>
movss  0x4(%rsp),%xmm0
addss  0xdf5(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
call   1060 <hasImageHexcode@plt>
test   %rax,%rax
je     1243 <checkPDFFileByFile+0xd3>
movss  0x4(%rsp),%xmm0
addss  0xdd4(%rip),%xmm0
test   %r14b,%r14b
jne    124e <checkPDFFileByFile+0xde>
jmp    1262 <checkPDFFileByFile+0xf2>
movss  0x4(%rsp),%xmm0
test   %r14b,%r14b
je     1262 <checkPDFFileByFile+0xf2>
mov    %rbx,%rdi
movss  %xmm0,0x4(%rsp)
call   1050 <checkXrefTable@plt>
movss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define float @checkPDFFileByFile(i32* %0) {
%2 = alloca float
%3 = alloca i32*
%4 = alloca float
%5 = alloca i16
%6 = alloca i16
%7 = alloca i32
store i32* %0, i32** %3
%8 = load i32*, i32** %3
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store float -1.000000e+00, float* %2
br label %92
11: ; preds = %1
store float 0.000000e+00, float* %4
%12 = load i32*, i32** %3
%13 = call i64 @hasAcceptableSize(i32* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load float, float* %4
%17 = fadd float %16, 5.000000e-01
store float %17, float* %4
br label %19
18: ; preds = %11
store float -2.000000e+00, float* %2
br label %92
19: ; preds = %15
%20 = load i32*, i32** %3
%21 = call signext i16 @producerStringPresent(i32* %20)
store i16 %21, i16* %5
store i16 0, i16* %6
%22 = load i16, i16* %5
%23 = icmp ne i16 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load float, float* %4
%26 = fadd float %25, 1.000000e+00
store float %26, float* %4
br label %36
27: ; preds = %19
%28 = load i32*, i32** %3
%29 = call signext i16 @trailerContainsHTML(i32* %28)
store i16 %29, i16* %6
%30 = load i16, i16* %6
%31 = icmp ne i16 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load float, float* %4
%34 = fadd float %33, 2.500000e-01
store float %34, float* %4
br label %35
35: ; preds = %32, %27
br label %36
36: ; preds = %35, %24
%37 = load i32*, i32** %3
%38 = call i64 @hasCorrectPDFVersion(i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load float, float* %4
%42 = fadd float %41, 1.000000e+00
store float %42, float* %4
br label %43
43: ; preds = %40, %36
%44 = load i32*, i32** %3
%45 = call i64 @hasCorrectSignature(i32* %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = load float, float* %4
%49 = fadd float %48, 2.000000e+00
store float %49, float* %4
br label %50
50: ; preds = %47, %43
%51 = load i32*, i32** %3
%52 = call i64 @hasImageHexcode(i32* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %50
%55 = load float, float* %4
%56 = fadd float %55, 2.000000e+00
store float %56, float* %4
br label %57
57: ; preds = %54, %50
store i32 0, i32* %7
%58 = load i16, i16* %6
%59 = icmp ne i16 %58, 0
br i1 %59, label %72, label %60
60: ; preds = %57
%61 = load i32*, i32** %3
%62 = call i32 @checkXrefTable(i32* %61)
%63 = load i32, i32* %7
%64 = icmp sge i32 %63, 75
br i1 %64, label %65, label %71
65: ; preds = %60
%66 = load i32, i32* %7
%67 = icmp sle i32 %66, 80
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load float, float* %4
%70 = fadd float %69, 1.000000e+00
store float %70, float* %4
br label %71
71: ; preds = %68, %65, %60
br label %72
72: ; preds = %71, %57
%73 = load i16, i16* %5
%74 = icmp ne i16 %73, 0
br i1 %74, label %90, label %75
75: ; preds = %72
%76 = load i16, i16* %6
%77 = icmp ne i16 %76, 0
br i1 %77, label %90, label %78
78: ; preds = %75
%79 = load i32, i32* %7
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %90
81: ; preds = %78
%82 = load i32*, i32** %3
%83 = load i32, i32* %7
%84 = call i64 @producerStringWithXrefEntries(i32* %82, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %81
%87 = load float, float* %4
%88 = fadd float %87, 1.000000e+00
store float %88, float* %4
br label %89
89: ; preds = %86, %81
br label %90
90: ; preds = %89, %78, %75, %72
%91 = load float, float* %4
store float %91, float* %2
br label %92
92: ; preds = %90, %18, %10
%93 = load float, float* %2
ret float %93
}

LLVM IR (-O2):
define float @checkPDFFileByFile(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %30, label %3
3: ; preds = %1
%4 = tail call i64 @hasAcceptableSize(i32* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %30, label %6
6: ; preds = %3
%7 = tail call signext i16 @producerStringPresent(i32* %0)
%8 = icmp eq i16 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call signext i16 @trailerContainsHTML(i32* %0)
%11 = icmp eq i16 %10, 0
%12 = select i1 %11, float 5.000000e-01, float 7.500000e-01
br label %13
13: ; preds = %9, %6
%14 = phi float [ 1.500000e+00, %6 ], [ %12, %9 ]
%15 = phi i1 [ true, %6 ], [ %11, %9 ]
%16 = tail call i64 @hasCorrectPDFVersion(i32* %0)
%17 = icmp eq i64 %16, 0
%18 = fadd float %14, 1.000000e+00
%19 = select i1 %17, float %14, float %18
%20 = tail call i64 @hasCorrectSignature(i32* %0)
%21 = icmp eq i64 %20, 0
%22 = fadd float %19, 2.000000e+00
%23 = select i1 %21, float %19, float %22
%24 = tail call i64 @hasImageHexcode(i32* %0)
%25 = icmp eq i64 %24, 0
%26 = fadd float %23, 2.000000e+00
%27 = select i1 %25, float %23, float %26
br i1 %15, label %28, label %30
28: ; preds = %13
%29 = tail call i32 @checkXrefTable(i32* %0)
br label %30
30: ; preds = %3, %13, %28, %1
%31 = phi float [ -1.000000e+00, %1 ], [ -2.000000e+00, %3 ], [ %27, %13 ], [ %27, %28 ]
ret float %31
}