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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int check_for_cheaters(FILE *high_scores) {
  char check = 0;
  long int end_point;
  long int i;
  fseek(high_scores, 0L, SEEK_END);
  end_point = ftell(high_scores);
  rewind(high_scores);
  for (i = 0; i < end_point; i++) {
    char help;
    fread(&help, sizeof(help), 1, high_scores);
    check ^= help;
  }
  return check;
}


x86 assembly (clang, -O0):
<check_for_cheaters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e8d(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1050 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    11c4 <check_for_cheaters+0x84>
mov    -0x8(%rbp),%rcx
lea    -0x21(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
movsbl -0x21(%rbp),%ecx
movsbl -0x9(%rbp),%eax
xor    %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1184 <check_for_cheaters+0x44>
movsbl -0x9(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_cheaters>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
xor    %r15d,%r15d
xor    %esi,%esi
call   1060 <fseek@plt>
mov    %r14,%rdi
call   1050 <ftell@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <rewind@plt>
test   %rbx,%rbx
jle    11a3 <check_for_cheaters+0x63>
xor    %r15d,%r15d
lea    0x7(%rsp),%r12
xchg   %ax,%ax
mov    %r12,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1030 <fread@plt>
movsbl 0x7(%rsp),%eax
xor    %eax,%r15d
add    $0xffffffffffffffff,%rbx
jne    1180 <check_for_cheaters+0x40>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @check_for_cheaters(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8
store i32* %0, i32** %2
store i8 0, i8* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i64 0, i32 %8)
%10 = load i32*, i32** %2
%11 = call i64 @ftell(i32* %10)
store i64 %11, i64* %4
%12 = load i32*, i32** %2
%13 = call i32 @rewind(i32* %12)
store i64 0, i64* %5
br label %14
14: ; preds = %27, %1
%15 = load i64, i64* %5
%16 = load i64, i64* %4
%17 = icmp slt i64 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = load i32*, i32** %2
%20 = call i32 @fread(i8* %6, i32 1, i32 1, i32* %19)
%21 = load i8, i8* %6
%22 = sext i8 %21 to i32
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = xor i32 %24, %22
%26 = trunc i32 %25 to i8
store i8 %26, i8* %3
br label %27
27: ; preds = %18
%28 = load i64, i64* %5
%29 = add nsw i64 %28, 1
store i64 %29, i64* %5
br label %14
30: ; preds = %14
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
ret i32 %32
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @check_for_cheaters(i32* nocapture %0) {
%2 = alloca i8
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %0, i64 0, i32 %3)
%5 = tail call i64 @ftell(i32* %0)
%6 = tail call i32 @rewind(i32* %0)
%7 = icmp sgt i64 %5, 0
br i1 %7, label %8, label %17
8: ; preds = %1, %8
%9 = phi i64 [ %15, %8 ], [ 0, %1 ]
%10 = phi i32 [ %14, %8 ], [ 0, %1 ]
%11 = call i32 @fread(i8* %2, i32 1, i32 1, i32* %0)
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = xor i32 %10, %13
%15 = add nuw nsw i64 %9, 1
%16 = icmp eq i64 %15, %5
br i1 %16, label %17, label %8
17: ; preds = %8, %1
%18 = phi i32 [ 0, %1 ], [ %14, %8 ]
ret i32 %18
}