#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_SET;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
scalar_t__ psnd_grep(char *, char *, int *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ sscanf(char *, char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char *);
char *scanfile(FILE *file, char *pattern1, int skip, char *pattern2,
               int isregexp) {
  static char resultbuf[250 + 1];
  char *p, pattern[250 + 1], buf[250 + 1];
  int len, skip_store, ok = 0, mode = 1;
  long pos = ftell(file);
  rewind(file);
  if (skip == 0) {
    ok = 1;
    mode = 0;
  }
  skip_store = skip;
  strncpy(pattern, pattern2, 250);
  pattern[250] = '\0';
  len = strlen(pattern);
  if (len >= 2) {
    p = pattern + len - 2;
    if (p[0] == '%' && p[1] == 's')
      *p = '\0';
  }
  while (fgets(buf, 250, file) != NULL) {
    buf[250] = '\0';
    if (mode) {
      if (!ok) {
        if (isregexp) {
          if (psnd_grep(buf, pattern1, &len))
            ok = 1;
        } else {
          if (strstr(buf, pattern1) != NULL)
            ok = 1;
        }
      } else
        skip--;
      if (!ok || skip != 0)
        continue;
    }
    if (isregexp) {
      if (psnd_grep(buf, pattern, &len)) {
        resultbuf[0] = '\0';
        if (sscanf(buf + len, "%s", resultbuf)) {
          fseek(file, pos, SEEK_SET);
          return resultbuf;
        }
      }
    } else {
      char *p;
      if ((p = strstr(buf, pattern)) != NULL) {
        len = strlen(pattern);
        resultbuf[0] = '\0';
        if (sscanf(p + len, "%s", resultbuf)) {
          fseek(file, pos, SEEK_SET);
          return resultbuf;
        }
      }
    }
    ok = 0;
    skip = skip_store;
  }
  fseek(file, pos, SEEK_SET);
  return NULL;
}


x86 assembly (clang, -O0):
<scanfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
movl   $0x0,-0x24c(%rbp)
movl   $0x1,-0x250(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x258(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <rewind@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    11f9 <scanfile+0x69>
movl   $0x1,-0x24c(%rbp)
movl   $0x0,-0x250(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x248(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0xfa,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x46(%rbp)
lea    -0x140(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x244(%rbp)
cmpl   $0x2,-0x244(%rbp)
jl     1280 <scanfile+0xf0>
lea    -0x140(%rbp),%rax
movslq -0x244(%rbp),%rcx
add    %rcx,%rax
add    $0xfffffffffffffffe,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    127b <scanfile+0xeb>
mov    -0x38(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x73,%eax
jne    127b <scanfile+0xeb>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
jmp    1280 <scanfile+0xf0>
jmp    1285 <scanfile+0xf5>
lea    -0x240(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0xfa,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     14a3 <scanfile+0x313>
movb   $0x0,-0x146(%rbp)
cmpl   $0x0,-0x250(%rbp)
je     1357 <scanfile+0x1c7>
cmpl   $0x0,-0x24c(%rbp)
jne    132d <scanfile+0x19d>
cmpl   $0x0,-0x2c(%rbp)
je     12ff <scanfile+0x16f>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x244(%rbp),%rdx
call   1040 <psnd_grep@plt>
cmp    $0x0,%rax
je     12fa <scanfile+0x16a>
movl   $0x1,-0x24c(%rbp)
jmp    1328 <scanfile+0x198>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <strstr@plt>
cmp    $0x0,%rax
je     1323 <scanfile+0x193>
movl   $0x1,-0x24c(%rbp)
jmp    1328 <scanfile+0x198>
jmp    1336 <scanfile+0x1a6>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x24c(%rbp)
je     134d <scanfile+0x1bd>
cmpl   $0x0,-0x1c(%rbp)
je     1352 <scanfile+0x1c2>
jmp    1285 <scanfile+0xf5>
jmp    1357 <scanfile+0x1c7>
cmpl   $0x0,-0x2c(%rbp)
je     13ed <scanfile+0x25d>
lea    -0x240(%rbp),%rdi
lea    -0x140(%rbp),%rsi
lea    -0x244(%rbp),%rdx
call   1040 <psnd_grep@plt>
cmp    $0x0,%rax
je     13e8 <scanfile+0x258>
movb   $0x0,0x2cf4(%rip)
lea    -0x240(%rbp),%rdi
movslq -0x244(%rbp),%rax
add    %rax,%rdi
lea    0xc5c(%rip),%rsi
lea    0x2cd5(%rip),%rdx
call   1090 <sscanf@plt>
cmp    $0x0,%rax
je     13e3 <scanfile+0x253>
mov    -0x10(%rbp),%rdi
mov    -0x258(%rbp),%rsi
mov    0x2c14(%rip),%rax
mov    (%rax),%edx
call   10a0 <fseek@plt>
lea    0x2ca6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14c4 <scanfile+0x334>
jmp    13e8 <scanfile+0x258>
jmp    148b <scanfile+0x2fb>
lea    -0x240(%rbp),%rdi
lea    -0x140(%rbp),%rsi
call   10b0 <strstr@plt>
mov    %rax,-0x260(%rbp)
cmp    $0x0,%rax
je     1486 <scanfile+0x2f6>
lea    -0x140(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x244(%rbp)
movb   $0x0,0x2c56(%rip)
mov    -0x260(%rbp),%rdi
movslq -0x244(%rbp),%rax
add    %rax,%rdi
lea    0xbbe(%rip),%rsi
lea    0x2c37(%rip),%rdx
call   1090 <sscanf@plt>
cmp    $0x0,%rax
je     1481 <scanfile+0x2f1>
mov    -0x10(%rbp),%rdi
mov    -0x258(%rbp),%rsi
mov    0x2b76(%rip),%rax
mov    (%rax),%edx
call   10a0 <fseek@plt>
lea    0x2c08(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    14c4 <scanfile+0x334>
jmp    1486 <scanfile+0x2f6>
jmp    148b <scanfile+0x2fb>
movl   $0x0,-0x24c(%rbp)
mov    -0x248(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1285 <scanfile+0xf5>
mov    -0x10(%rbp),%rdi
mov    -0x258(%rbp),%rsi
mov    0x2b2b(%rip),%rax
mov    (%rax),%edx
call   10a0 <fseek@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanfile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %r8d,0x4(%rsp)
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
call   1080 <ftell@plt>
mov    %rax,%rbp
mov    %rbx,0x8(%rsp)
mov    %rbx,%rdi
call   1060 <rewind@plt>
test   %r15d,%r15d
sete   %r13b
lea    0x20(%rsp),%r12
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0xfa,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x11a(%rsp)
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
cmp    $0x2,%eax
jl     1212 <scanfile+0x82>
mov    %eax,%eax
cmpb   $0x25,0x1e(%rsp,%rax,1)
jne    1212 <scanfile+0x82>
cmpb   $0x73,0x1f(%rsp,%rax,1)
jne    1212 <scanfile+0x82>
movb   $0x0,0x1e(%rsp,%rax,1)
lea    0x120(%rsp),%rdi
mov    $0xfa,%esi
mov    0x8(%rsp),%r12
mov    %r12,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1387 <scanfile+0x1f7>
mov    %rbp,0x10(%rsp)
lea    0x120(%rsp),%r14
mov    %r15d,%ebp
mov    0x4(%rsp),%ebx
jmp    126f <scanfile+0xdf>
nopl   0x0(%rax,%rax,1)
xor    %r13d,%r13d
mov    %r15d,%ebp
mov    %r14,%rdi
mov    $0xfa,%esi
mov    %r12,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     137e <scanfile+0x1ee>
movb   $0x0,0x21a(%rsp)
test   %r15d,%r15d
je     12c2 <scanfile+0x132>
test   $0x1,%r13b
je     1290 <scanfile+0x100>
add    $0xffffffff,%ebp
mov    $0x1,%r13b
xor    %eax,%eax
test   %al,%al
je     12be <scanfile+0x12e>
jmp    1256 <scanfile+0xc6>
mov    %r14,%rdi
test   %ebx,%ebx
je     12a6 <scanfile+0x116>
mov    0x18(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <psnd_grep@plt>
jmp    12b0 <scanfile+0x120>
mov    0x18(%rsp),%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
sete   %al
setne  %r13b
test   %al,%al
jne    1256 <scanfile+0xc6>
test   %ebp,%ebp
jne    1256 <scanfile+0xc6>
mov    %r14,%rdi
test   %ebx,%ebx
je     1320 <scanfile+0x190>
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <psnd_grep@plt>
test   %rax,%rax
je     1250 <scanfile+0xc0>
movb   $0x0,0x2d9a(%rip)
movslq (%rsp),%rax
lea    (%rsp,%rax,1),%rdi
add    $0x120,%rdi
lea    0xd04(%rip),%rsi
lea    0x2d7d(%rip),%rbp
mov    %rbp,%rdx
call   1090 <sscanf@plt>
test   %rax,%rax
je     1250 <scanfile+0xc0>
jmp    1380 <scanfile+0x1f0>
cs nopw 0x0(%rax,%rax,1)
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
call   10b0 <strstr@plt>
test   %rax,%rax
je     136a <scanfile+0x1da>
mov    %rax,%r12
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %eax,(%rsp)
movb   $0x0,0x2d39(%rip)
cltq
add    %rax,%r12
mov    %r12,%rdi
lea    0xcaa(%rip),%rsi
lea    0x2d23(%rip),%rbp
mov    %rbp,%rdx
call   1090 <sscanf@plt>
test   %rax,%rax
jne    13b2 <scanfile+0x222>
xor    %r13d,%r13d
mov    %r15d,%ebp
mov    0x4(%rsp),%ebx
mov    0x8(%rsp),%r12
jmp    1256 <scanfile+0xc6>
xor    %ebp,%ebp
mov    0x10(%rsp),%rsi
jmp    138c <scanfile+0x1fc>
mov    %rbp,%rsi
xor    %ebp,%ebp
mov    0x2c4d(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
call   10a0 <fseek@plt>
mov    %rbp,%rax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%r12
jmp    138c <scanfile+0x1fc>

LLVM IR (-O0):
@scanfile.resultbuf = internal global [251 x i8] zeroinitializer
@.str = [3 x i8] c"%s\00"
@SEEK_SET = global i32 0
define i8* @scanfile(i32* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [251 x i8]
%14 = alloca [251 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i64
%20 = alloca i8*
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store i32 0, i32* %17
store i32 1, i32* %18
%21 = load i32*, i32** %7
%22 = call i64 @ftell(i32* %21)
store i64 %22, i64* %19
%23 = load i32*, i32** %7
%24 = call i32 @rewind(i32* %23)
%25 = load i32, i32* %9
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %5
store i32 1, i32* %17
store i32 0, i32* %18
br label %28
28: ; preds = %27, %5
%29 = load i32, i32* %9
store i32 %29, i32* %16
%30 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 0
%31 = load i8*, i8** %10
%32 = call i32 @strncpy(i8* %30, i8* %31, i32 250)
%33 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 250
store i8 0, i8* %33
%34 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
store i32 %35, i32* %15
%36 = load i32, i32* %15
%37 = icmp sge i32 %36, 2
br i1 %37, label %38, label %58
38: ; preds = %28
%39 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 0
%40 = load i32, i32* %15
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = getelementptr inbounds i8, i8* %42, i64 -2
store i8* %43, i8** %12
%44 = load i8*, i8** %12
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 37
br i1 %48, label %49, label %57
49: ; preds = %38
%50 = load i8*, i8** %12
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 115
br i1 %54, label %55, label %57
55: ; preds = %49
%56 = load i8*, i8** %12
store i8 0, i8* %56
br label %57
57: ; preds = %55, %49, %38
br label %58
58: ; preds = %57, %28
br label %59
59: ; preds = %143, %98, %58
%60 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 0
%61 = load i32*, i32** %7
%62 = call i32* @fgets(i8* %60, i32 250, i32* %61)
%63 = icmp ne i32* %62, null
br i1 %63, label %64, label %145
64: ; preds = %59
%65 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 250
store i8 0, i8* %65
%66 = load i32, i32* %18
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %100
68: ; preds = %64
%69 = load i32, i32* %17
%70 = icmp ne i32 %69, 0
br i1 %70, label %89, label %71
71: ; preds = %68
%72 = load i32, i32* %11
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %81
74: ; preds = %71
%75 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 0
%76 = load i8*, i8** %8
%77 = call i64 @psnd_grep(i8* %75, i8* %76, i32* %15)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %74
store i32 1, i32* %17
br label %80
80: ; preds = %79, %74
br label %88
81: ; preds = %71
%82 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 0
%83 = load i8*, i8** %8
%84 = call i8* @strstr(i8* %82, i8* %83)
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %87
86: ; preds = %81
store i32 1, i32* %17
br label %87
87: ; preds = %86, %81
br label %88
88: ; preds = %87, %80
br label %92
89: ; preds = %68
%90 = load i32, i32* %9
%91 = add nsw i32 %90, -1
store i32 %91, i32* %9
br label %92
92: ; preds = %89, %88
%93 = load i32, i32* %17
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %92
%96 = load i32, i32* %9
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %95, %92
br label %59
99: ; preds = %95
br label %100
100: ; preds = %99, %64
%101 = load i32, i32* %11
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %122
103: ; preds = %100
%104 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 0
%105 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 0
%106 = call i64 @psnd_grep(i8* %104, i8* %105, i32* %15)
%107 = icmp ne i64 %106, 0
br i1 %107, label %108, label %121
108: ; preds = %103
store i8 0, i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0)
%109 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 0
%110 = load i32, i32* %15
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = call i64 @sscanf(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0))
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %120
115: ; preds = %108
%116 = load i32*, i32** %7
%117 = load i64, i64* %19
%118 = load i32, i32* @SEEK_SET
%119 = call i32 @fseek(i32* %116, i64 %117, i32 %118)
store i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0), i8** %6
br label %150
120: ; preds = %108
br label %121
121: ; preds = %120, %103
br label %143
122: ; preds = %100
%123 = getelementptr inbounds [251 x i8], [251 x i8]* %14, i64 0, i64 0
%124 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 0
%125 = call i8* @strstr(i8* %123, i8* %124)
store i8* %125, i8** %20
%126 = icmp ne i8* %125, null
br i1 %126, label %127, label %142
127: ; preds = %122
%128 = getelementptr inbounds [251 x i8], [251 x i8]* %13, i64 0, i64 0
%129 = call i32 @strlen(i8* %128)
store i32 %129, i32* %15
store i8 0, i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0)
%130 = load i8*, i8** %20
%131 = load i32, i32* %15
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8, i8* %130, i64 %132
%134 = call i64 @sscanf(i8* %133, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0))
%135 = icmp ne i64 %134, 0
br i1 %135, label %136, label %141
136: ; preds = %127
%137 = load i32*, i32** %7
%138 = load i64, i64* %19
%139 = load i32, i32* @SEEK_SET
%140 = call i32 @fseek(i32* %137, i64 %138, i32 %139)
store i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0), i8** %6
br label %150
141: ; preds = %127
br label %142
142: ; preds = %141, %122
br label %143
143: ; preds = %142, %121
store i32 0, i32* %17
%144 = load i32, i32* %16
store i32 %144, i32* %9
br label %59
145: ; preds = %59
%146 = load i32*, i32** %7
%147 = load i64, i64* %19
%148 = load i32, i32* @SEEK_SET
%149 = call i32 @fseek(i32* %146, i64 %147, i32 %148)
store i8* null, i8** %6
br label %150
150: ; preds = %145, %136, %115
%151 = load i8*, i8** %6
ret i8* %151
}

LLVM IR (-O2):
@scanfile.resultbuf = internal global [251 x i8] zeroinitializer
@.str = [3 x i8] c"%s\00"
@SEEK_SET = global i32 0
define i8* @scanfile(i32* nocapture %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca [251 x i8]
%7 = alloca [251 x i8]
%8 = alloca i32
%9 = getelementptr inbounds [251 x i8], [251 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [251 x i8], [251 x i8]* %7, i64 0, i64 0
%11 = bitcast i32* %8 to i8*
%12 = tail call i64 @ftell(i32* %0)
%13 = tail call i32 @rewind(i32* %0)
%14 = icmp eq i32 %2, 0
%15 = call i32 @strncpy(i8* %9, i8* %3, i32 250)
%16 = getelementptr inbounds [251 x i8], [251 x i8]* %6, i64 0, i64 250
store i8 0, i8* %16
%17 = call i32 @strlen(i8* %9)
store i32 %17, i32* %8
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %30
19: ; preds = %5
%20 = zext i32 %17 to i64
%21 = getelementptr inbounds [251 x i8], [251 x i8]* %6, i64 0, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 -2
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 37
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = getelementptr inbounds i8, i8* %21, i64 -1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 115
br i1 %28, label %29, label %30
29: ; preds = %25
store i8 0, i8* %22
br label %30
30: ; preds = %19, %25, %29, %5
%31 = call i32* @fgets(i8* %10, i32 250, i32* %0)
%32 = icmp eq i32* %31, null
br i1 %32, label %81, label %33
33: ; preds = %30
%34 = getelementptr inbounds [251 x i8], [251 x i8]* %7, i64 0, i64 250
%35 = icmp eq i32 %4, 0
br label %36
36: ; preds = %33, %76
%37 = phi i32 [ %2, %33 ], [ %78, %76 ]
%38 = phi i1 [ %14, %33 ], [ %77, %76 ]
store i8 0, i8* %34
br i1 %14, label %57, label %39
39: ; preds = %36
br i1 %38, label %49, label %40
40: ; preds = %39
br i1 %35, label %45, label %41
41: ; preds = %40
%42 = call i64 @psnd_grep(i8* %10, i8* %1, i32* %8)
%43 = icmp eq i64 %42, 0
%44 = xor i1 %43, true
br label %51
45: ; preds = %40
%46 = call i8* @strstr(i8* %10, i8* dereferenceable(1) %1)
%47 = icmp eq i8* %46, null
%48 = xor i1 %47, true
br label %51
49: ; preds = %39
%50 = add nsw i32 %37, -1
br label %51
51: ; preds = %45, %41, %49
%52 = phi i1 [ false, %49 ], [ %43, %41 ], [ %47, %45 ]
%53 = phi i1 [ true, %49 ], [ %44, %41 ], [ %48, %45 ]
%54 = phi i32 [ %50, %49 ], [ %37, %41 ], [ %37, %45 ]
%55 = icmp ne i32 %54, 0
%56 = select i1 %52, i1 true, i1 %55
br i1 %56, label %76, label %57
57: ; preds = %51, %36
br i1 %35, label %67, label %58
58: ; preds = %57
%59 = call i64 @psnd_grep(i8* %10, i8* %9, i32* %8)
%60 = icmp eq i64 %59, 0
br i1 %60, label %76, label %61
61: ; preds = %58
store i8 0, i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0)
%62 = load i32, i32* %8
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [251 x i8], [251 x i8]* %7, i64 0, i64 %63
%65 = call i64 @sscanf(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %76, label %81
67: ; preds = %57
%68 = call i8* @strstr(i8* %10, i8* %9)
%69 = icmp eq i8* %68, null
br i1 %69, label %76, label %70
70: ; preds = %67
%71 = call i32 @strlen(i8* %9)
store i32 %71, i32* %8
store i8 0, i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0)
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %68, i64 %72
%74 = call i64 @sscanf(i8* %73, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %81
76: ; preds = %61, %58, %67, %70, %51
%77 = phi i1 [ %53, %51 ], [ false, %70 ], [ false, %67 ], [ false, %58 ], [ false, %61 ]
%78 = phi i32 [ %54, %51 ], [ %2, %70 ], [ %2, %67 ], [ %2, %58 ], [ %2, %61 ]
%79 = call i32* @fgets(i8* %10, i32 250, i32* %0)
%80 = icmp eq i32* %79, null
br i1 %80, label %81, label %36
81: ; preds = %76, %70, %61, %30
%82 = phi i8* [ null, %30 ], [ getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0), %61 ], [ getelementptr inbounds ([251 x i8], [251 x i8]* @scanfile.resultbuf, i64 0, i64 0), %70 ], [ null, %76 ]
%83 = load i32, i32* @SEEK_SET
%84 = call i32 @fseek(i32* %0, i64 %12, i32 %83)
ret i8* %82
}