#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 */
#define EOF 128
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
void *fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int libpdex_search_for(FILE *file, int symbol) {
  rewind(file);
  while (!feof(file)) {
    int c;
    c = fgetc(file);
    switch (c) {
    case EOF:
      return 0;
    case ' ':
    case '\n':
    case '\t':
      break;
    case 'c': {
      char l;
      do {
        l = fgetc(file);
        if (l == '\n') {
          break;
        }
      } while (l != EOF);
      break;
    }
    default:
      if (c == symbol) {
        return 1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<libpdex_search_for>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1166 <libpdex_search_for+0x36>
jmp    122d <libpdex_search_for+0xfd>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     11ca <libpdex_search_for+0x9a>
jmp    1189 <libpdex_search_for+0x59>
mov    -0x20(%rbp),%eax
sub    $0x20,%eax
je     11ca <libpdex_search_for+0x9a>
jmp    119a <libpdex_search_for+0x6a>
mov    -0x20(%rbp),%eax
sub    $0x63,%eax
je     11cf <libpdex_search_for+0x9f>
jmp    11ab <libpdex_search_for+0x7b>
mov    -0x20(%rbp),%eax
sub    $0x80,%eax
jne    120b <libpdex_search_for+0xdb>
jmp    11be <libpdex_search_for+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    1234 <libpdex_search_for+0x104>
jmp    1228 <libpdex_search_for+0xf8>
jmp    11d4 <libpdex_search_for+0xa4>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    11f2 <libpdex_search_for+0xc2>
jmp    1206 <libpdex_search_for+0xd6>
jmp    11f7 <libpdex_search_for+0xc7>
movsbl -0x19(%rbp),%eax
cmp    $0x80,%eax
jne    11d4 <libpdex_search_for+0xa4>
jmp    1228 <libpdex_search_for+0xf8>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1223 <libpdex_search_for+0xf3>
movl   $0x1,-0x4(%rbp)
jmp    1234 <libpdex_search_for+0x104>
jmp    1228 <libpdex_search_for+0xf8>
jmp    1148 <libpdex_search_for+0x18>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libpdex_search_for>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%rbx
call   1030 <rewind@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     115f <libpdex_search_for+0x2f>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movabs $0x100000600,%rbp
jmp    1184 <libpdex_search_for+0x54>
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
bt     %rcx,%rbp
jae    1191 <libpdex_search_for+0x61>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    1151 <libpdex_search_for+0x21>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0x20,%eax
jbe    1170 <libpdex_search_for+0x40>
cmp    $0x63,%eax
je     11b0 <libpdex_search_for+0x80>
cmp    $0x80,%eax
je     1151 <libpdex_search_for+0x21>
cmp    %r15d,%eax
jne    1178 <libpdex_search_for+0x48>
jmp    11be <libpdex_search_for+0x8e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0xa,%al
jne    11b0 <libpdex_search_for+0x80>
jmp    1178 <libpdex_search_for+0x48>
mov    $0x1,%r14d
jmp    1151 <libpdex_search_for+0x21>

LLVM IR (-O0):
define i32 @libpdex_search_for(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32*, i32** %4
%9 = call i32 @rewind(i32* %8)
br label %10
10: ; preds = %43, %2
%11 = load i32*, i32** %4
%12 = call i32 @feof(i32* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %44
15: ; preds = %10
%16 = load i32*, i32** %4
%17 = call i8* @fgetc(i32* %16)
%18 = ptrtoint i8* %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %6
switch i32 %19, label %37 [
i32 128, label %20
i32 32, label %21
i32 10, label %21
i32 9, label %21
i32 99, label %22
]
20: ; preds = %15
store i32 0, i32* %3
br label %45
21: ; preds = %15, %15, %15
br label %43
22: ; preds = %15
br label %23
23: ; preds = %32, %22
%24 = load i32*, i32** %4
%25 = call i8* @fgetc(i32* %24)
%26 = ptrtoint i8* %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %31
30: ; preds = %23
br label %36
31: ; preds = %23
br label %32
32: ; preds = %31
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = icmp ne i32 %34, 128
br i1 %35, label %23, label %36
36: ; preds = %32, %30
br label %43
37: ; preds = %15
%38 = load i32, i32* %6
%39 = load i32, i32* %5
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %42
41: ; preds = %37
store i32 1, i32* %3
br label %45
42: ; preds = %37
br label %43
43: ; preds = %42, %36, %21
br label %10
44: ; preds = %10
store i32 0, i32* %3
br label %45
45: ; preds = %44, %41, %20
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
define i32 @libpdex_search_for(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @rewind(i32* %0)
%4 = tail call i32 @feof(i32* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %2, %17
%7 = tail call i8* @fgetc(i32* %0)
%8 = ptrtoint i8* %7 to i64
%9 = trunc i64 %8 to i32
switch i32 %9, label %15 [
i32 128, label %20
i32 32, label %17
i32 10, label %17
i32 9, label %17
i32 99, label %10
]
10: ; preds = %6, %10
%11 = tail call i8* @fgetc(i32* %0)
%12 = ptrtoint i8* %11 to i64
%13 = and i64 %12, 255
%14 = icmp eq i64 %13, 10
br i1 %14, label %17, label %10
15: ; preds = %6
%16 = icmp eq i32 %9, %1
br i1 %16, label %20, label %17
17: ; preds = %10, %6, %6, %6, %15
%18 = tail call i32 @feof(i32* %0)
%19 = icmp eq i32 %18, 0
br i1 %19, label %6, label %20
20: ; preds = %17, %6, %15, %2
%21 = phi i32 [ 0, %2 ], [ 1, %15 ], [ 0, %6 ], [ 0, %17 ]
ret i32 %21
}