#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*/ SEEK_CUR;
scalar_t__ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char *, char *);
int strlen(char *);
int IsIOFunction(char *FuncName, FILE *f) {
  fseek(f, -1, SEEK_CUR);
  int l = strlen(FuncName), i;
  char s[7] = "";
  for (i = 0; i < l; ++i) {
    s[i] = (char)fgetc(f);
  }
  s[i] = '\0';
  fseek(f, -l + 1, SEEK_CUR);
  if (!strcmp(FuncName, s)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<IsIOFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2e7d(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x27(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c7 <IsIOFunction+0x77>
mov    -0x18(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x27(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119a <IsIOFunction+0x4a>
movslq -0x20(%rbp),%rax
movb   $0x0,-0x27(%rbp,%rax,1)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
sub    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    0x2e05(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rdi
lea    -0x27(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    120c <IsIOFunction+0xbc>
movl   $0x1,-0x4(%rbp)
jmp    1213 <IsIOFunction+0xc3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsIOFunction>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %rdi,%r14
mov    0x2e90(%rip),%r15
mov    (%r15),%edx
mov    %rsi,%rdi
mov    $0xffffffff,%esi
call   1060 <fseek@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
movl   $0x0,0x3(%rsp)
movl   $0x0,(%rsp)
test   %eax,%eax
jle    11a6 <IsIOFunction+0x66>
mov    %r12d,%ebp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <fgetc@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <IsIOFunction+0x50>
jmp    11a8 <IsIOFunction+0x68>
xor    %ebp,%ebp
movb   $0x0,(%rsp,%rbp,1)
mov    $0x1,%esi
sub    %r12d,%esi
mov    (%r15),%edx
mov    %r13,%rdi
call   1060 <fseek@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
define i32 @IsIOFunction(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [7 x i8]
store i8* %0, i8** %4
store i32* %1, i32** %5
%9 = load i32*, i32** %5
%10 = load i32, i32* @SEEK_CUR
%11 = call i32 @fseek(i32* %9, i32 -1, i32 %10)
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %6
%14 = bitcast [7 x i8]* %8 to i8*
store i32 0, i32* %7
br label %15
15: ; preds = %26, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = load i32*, i32** %5
%21 = call i64 @fgetc(i32* %20)
%22 = trunc i64 %21 to i8
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %8, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %19
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %15
29: ; preds = %15
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [7 x i8], [7 x i8]* %8, i64 0, i64 %31
store i8 0, i8* %32
%33 = load i32*, i32** %5
%34 = load i32, i32* %6
%35 = sub nsw i32 0, %34
%36 = add nsw i32 %35, 1
%37 = load i32, i32* @SEEK_CUR
%38 = call i32 @fseek(i32* %33, i32 %36, i32 %37)
%39 = load i8*, i8** %4
%40 = getelementptr inbounds [7 x i8], [7 x i8]* %8, i64 0, i64 0
%41 = call i32 @strcmp(i8* %39, i8* %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %44, label %43
43: ; preds = %29
store i32 1, i32* %3
br label %45
44: ; preds = %29
store i32 0, i32* %3
br label %45
45: ; preds = %44, %43
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define i32 @IsIOFunction(i8* %0, i32* nocapture %1) {
%3 = alloca [7 x i8]
%4 = load i32, i32* @SEEK_CUR
%5 = tail call i32 @fseek(i32* %1, i32 -1, i32 %4)
%6 = tail call i32 @strlen(i8* %0)
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%8 = icmp sgt i32 %6, 0
br i1 %8, label %9, label %20
9: ; preds = %2
%10 = zext i32 %6 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %16, %11 ]
%13 = tail call i64 @fgetc(i32* %1)
%14 = trunc i64 %13 to i8
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %12
store i8 %14, i8* %15
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11
%19 = zext i32 %6 to i64
br label %20
20: ; preds = %2, %18
%21 = phi i64 [ %19, %18 ], [ 0, %2 ]
%22 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %21
store i8 0, i8* %22
%23 = sub i32 1, %6
%24 = load i32, i32* @SEEK_CUR
%25 = tail call i32 @fseek(i32* %1, i32 %23, i32 %24)
%26 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* %7)
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i32
ret i32 %28
}