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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int check_remainder(int /*<<< orphan*/ *);
int fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ memcmp(char *, char *, int);
int isp00(FILE *infile) {
  char signature1[] = {'C', '6', '4', 'F', 'i', 'l', 'e', '\0'};
  char read_from_file[26];
  if (fseek(infile, 0, SEEK_SET) != 0)
    return 0;
  if (fread(read_from_file, sizeof(read_from_file), 1, infile) < 1)
    return 0;
  if (memcmp(read_from_file, signature1, sizeof(signature1)))
    return 0;
  return check_remainder(infile);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
cmp    $0x0,%rax
je     1181 <isp00+0x41>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <isp00+0xa1>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x1a,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x1,%eax
jge    11ad <isp00+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <isp00+0xa1>
lea    -0x40(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     11d5 <isp00+0x95>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <isp00+0xa1>
mov    -0x10(%rbp),%rdi
call   1040 <check_remainder@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,%rbx
movabs $0x656c6946343643,%rax
mov    %rax,0x8(%rsp)
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
xor    %ebp,%ebp
xor    %esi,%esi
call   1060 <fseek@plt>
test   %rax,%rax
je     1178 <isp00+0x38>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret
lea    0x10(%rsp),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
test   %eax,%eax
jle    116f <isp00+0x2f>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    116f <isp00+0x2f>
mov    %rbx,%rdi
call   1040 <check_remainder@plt>
mov    %eax,%ebp
jmp    116f <isp00+0x2f>

LLVM IR (-O0):
@__const.isp00.signature1 = [8 x i8] c"C64File\00"
@SEEK_SET = global i32 0
define i32 @isp00(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [8 x i8]
%5 = alloca [26 x i8]
store i32* %0, i32** %3
%6 = bitcast [8 x i8]* %4 to i8*
%7 = load i32*, i32** %3
%8 = load i32, i32* @SEEK_SET
%9 = call i64 @fseek(i32* %7, i32 0, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %27
12: ; preds = %1
%13 = getelementptr inbounds [26 x i8], [26 x i8]* %5, i64 0, i64 0
%14 = load i32*, i32** %3
%15 = call i32 @fread(i8* %13, i32 26, i32 1, i32* %14)
%16 = icmp slt i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %12
store i32 0, i32* %2
br label %27
18: ; preds = %12
%19 = getelementptr inbounds [26 x i8], [26 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%21 = call i64 @memcmp(i8* %19, i8* %20, i32 8)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 0, i32* %2
br label %27
24: ; preds = %18
%25 = load i32*, i32** %3
%26 = call i32 @check_remainder(i32* %25)
store i32 %26, i32* %2
br label %27
27: ; preds = %24, %23, %17, %11
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @isp00(i32* %0) {
%2 = alloca i64
%3 = alloca [26 x i8]
%4 = bitcast i64* %2 to i8*
store i64 28548172052969027, i64* %2
%5 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%6 = load i32, i32* @SEEK_SET
%7 = tail call i64 @fseek(i32* %0, i32 0, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %1
%10 = call i32 @fread(i8* %5, i32 26, i32 1, i32* %0)
%11 = icmp slt i32 %10, 1
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = call i64 @memcmp(i8* %5, i8* %4, i32 8)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @check_remainder(i32* %0)
br label %17
17: ; preds = %12, %9, %1, %15
%18 = phi i32 [ %16, %15 ], [ 0, %1 ], [ 0, %9 ], [ 0, %12 ]
ret i32 %18
}