#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 */
struct stat {
  int dummy;
};
struct dirent {
  int d_type;
  int /*<<< orphan*/ d_name;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ clearbuf(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ isprint(char);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ stat(int /*<<< orphan*/, struct stat *);
int /*<<< orphan*/ strcat(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strstr(char *, char *);
int main() {
  int i, j, found, macvir;
  char buf[1000], fname[100], c, filesig[] = {'P', 'K', 3, 4, 0};
  FILE *fp;
  DIR *dir;
  struct dirent *ent;
  struct stat st;
  dir = opendir("./virfiles");
  while ((ent = readdir(dir)) != NULL) {
    stat(ent->d_name, &st);
    strcpy(fname, "./virfiles/");
    strcat(fname, ent->d_name);
    if (ent->d_type == 8) {
      fp = fopen(fname, "rb");
      j = 0;
      found = 0;
      macvir = 1;
      while (!feof(fp) && !found) {
        fread(&c, 1, 1, fp);
        if (j < 4) {
          if (filesig[j++] != c) {
            macvir = 0;
          }
        }
        if (j == 4 && macvir) {
          printf("Found a macro virus: %s\n", fname);
          break;
        }
        i = 0;
        while (isprint(c) && j > 3) {
          buf[i++] = c;
          fread(&c, 1, 1, fp);
          if (i > 999)
            break;
          if (strstr(buf, "mbr virus")) {
            printf("Found an mbr virus: %s\n", fname);
            found = 1;
            clearbuf(buf);
            break;
          } else if (strstr(buf, "file infecter")) {
            printf("Found a File infecter: %s\n", fname);
            found = 1;
            clearbuf(buf);
            break;
          }
        }
      }
      fclose(fp);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe18(%rip),%eax
mov    %eax,-0x476(%rbp)
mov    0xe10(%rip),%al
mov    %al,-0x472(%rbp)
lea    0xe04(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x488(%rbp)
mov    -0x488(%rbp),%rdi
call   10a0 <readdir@plt>
mov    %rax,-0x490(%rbp)
cmp    $0x0,%rax
je     14a7 <main+0x2d7>
mov    -0x490(%rbp),%rax
mov    0x4(%rax),%edi
lea    -0x498(%rbp),%rsi
call   1090 <stat@plt>
lea    -0x470(%rbp),%rdi
lea    0xdc2(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x470(%rbp),%rdi
mov    -0x490(%rbp),%rax
mov    0x4(%rax),%esi
call   10e0 <strcat@plt>
mov    -0x490(%rbp),%rax
cmpl   $0x8,(%rax)
jne    14a2 <main+0x2d2>
lea    -0x470(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x480(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x480(%rbp),%rdi
call   1080 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x499(%rbp)
jne    12d6 <main+0x106>
cmpl   $0x0,-0x10(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x499(%rbp)
mov    -0x499(%rbp),%al
test   $0x1,%al
jne    12e9 <main+0x119>
jmp    1496 <main+0x2c6>
mov    -0x480(%rbp),%rcx
lea    -0x471(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
cmpl   $0x4,-0xc(%rbp)
jge    133d <main+0x16d>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movsbl -0x476(%rbp,%rax,1),%eax
ff
movsbl -0x471(%rbp),%ecx
cmp    %ecx,%eax
je     1338 <main+0x168>
movl   $0x0,-0x14(%rbp)
jmp    133d <main+0x16d>
cmpl   $0x4,-0xc(%rbp)
jne    1369 <main+0x199>
cmpl   $0x0,-0x14(%rbp)
je     1369 <main+0x199>
lea    -0x470(%rbp),%rsi
lea    0xcc0(%rip),%rdi
call   1070 <printf@plt>
jmp    1496 <main+0x2c6>
movl   $0x0,-0x8(%rbp)
movsbl -0x471(%rbp),%edi
call   10b0 <isprint@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x49a(%rbp)
je     139e <main+0x1ce>
cmpl   $0x3,-0xc(%rbp)
setg   %al
mov    %al,-0x49a(%rbp)
mov    -0x49a(%rbp),%al
test   $0x1,%al
jne    13b1 <main+0x1e1>
jmp    1491 <main+0x2c1>
mov    -0x471(%rbp),%cl
mov    -0x8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cltq
mov    %cl,-0x400(%rbp,%rax,1)
mov    -0x480(%rbp),%rcx
lea    -0x471(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fread@plt>
cmpl   $0x3e7,-0x8(%rbp)
jle    13f7 <main+0x227>
jmp    1491 <main+0x2c1>
lea    -0x400(%rbp),%rdi
lea    0xc33(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     143f <main+0x26f>
lea    -0x470(%rbp),%rsi
lea    0xc20(%rip),%rdi
call   1070 <printf@plt>
movl   $0x1,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
call   10c0 <clearbuf@plt>
jmp    1491 <main+0x2c1>
lea    -0x400(%rbp),%rdi
lea    0xc0d(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     1487 <main+0x2b7>
lea    -0x470(%rbp),%rsi
lea    0xbfe(%rip),%rdi
call   1070 <printf@plt>
movl   $0x1,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
call   10c0 <clearbuf@plt>
jmp    1491 <main+0x2c1>
jmp    148c <main+0x2bc>
jmp    1370 <main+0x1a0>
jmp    12a8 <main+0xd8>
mov    -0x480(%rbp),%rdi
call   1050 <fclose@plt>
jmp    120d <main+0x3d>
xor    %eax,%eax
add    $0x4a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x468,%rsp
lea    0xe1d(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   10a0 <readdir@plt>
test   %rax,%rax
je     13da <main+0x20a>
mov    %rax,%rbx
lea    0x8(%rsp),%r14
lea    0xe00(%rip),%r15
lea    0x10(%rsp),%rbp
jmp    126d <main+0x9d>
lea    0xe24(%rip),%rdi
mov    %r14,%r13
lea    0x8(%rsp),%r14
lea    0xde3(%rip),%r15
lea    0x10(%rsp),%rsi
call   1070 <printf@plt>
lea    0x80(%rsp),%rdi
call   10c0 <clearbuf@plt>
mov    %r12,%rdi
call   1080 <feof@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
lea    0x10(%rsp),%rbp
mov    %r13,%rdi
call   10a0 <readdir@plt>
mov    %rax,%rbx
test   %rax,%rax
je     13da <main+0x20a>
mov    0x4(%rbx),%edi
mov    %r14,%rsi
call   1090 <stat@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    0x4(%rbx),%esi
mov    %rbp,%rdi
call   10e0 <strcat@plt>
cmpl   $0x8,(%rbx)
jne    1259 <main+0x89>
mov    %rbp,%rdi
lea    0xd7f(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    124c <main+0x7c>
mov    $0x1,%ebp
xor    %ebx,%ebx
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x3,%ebx
jg     12f0 <main+0x120>
movslq %ebx,%rax
add    $0x1,%ebx
lea    0xd1f(%rip),%rcx
mov    (%rax,%rcx,1),%al
cmp    0x7(%rsp),%al
mov    $0x0,%eax
cmovne %eax,%ebp
cmp    $0x4,%ebx
jne    12fd <main+0x12d>
test   %ebp,%ebp
jne    13c4 <main+0x1f4>
mov    %ebp,0xc(%rsp)
mov    %r13,%r14
xor    %r15d,%r15d
lea    0x80(%rsp),%rbp
nop
movzbl 0x7(%rsp),%r13d
movsbl %r13b,%edi
call   10b0 <isprint@plt>
test   %rax,%rax
je     1390 <main+0x1c0>
cmp    $0x4,%ebx
jl     1390 <main+0x1c0>
mov    %r13b,0x80(%rsp,%r15,1)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1040 <fread@plt>
cmp    $0x3e7,%r15
je     1390 <main+0x1c0>
mov    %rbp,%rdi
lea    0xcdd(%rip),%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
jne    1217 <main+0x47>
mov    %rbp,%rdi
lea    0xce7(%rip),%rsi
call   10f0 <strstr@plt>
add    $0x1,%r15
test   %rax,%rax
je     1310 <main+0x140>
jmp    13b8 <main+0x1e8>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1080 <feof@plt>
test   %eax,%eax
mov    %r14,%r13
lea    0x8(%rsp),%r14
lea    0xc67(%rip),%r15
mov    0xc(%rsp),%ebp
je     12b8 <main+0xe8>
jmp    124c <main+0x7c>
lea    0xca9(%rip),%rdi
jmp    121e <main+0x4e>
lea    0xc54(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1070 <printf@plt>
jmp    124c <main+0x7c>
xor    %eax,%eax
add    $0x468,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32, i32 }
%struct.stat = type { i32 }
@__const.main.filesig = [5 x i8] c"PK\03\04\00"
@.str = [11 x i8] c"./virfiles\00"
@.str.1 = [12 x i8] c"./virfiles/\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [25 x i8] c"Found a macro virus: %s\0A\00"
@.str.4 = [10 x i8] c"mbr virus\00"
@.str.5 = [24 x i8] c"Found an mbr virus: %s\0A\00"
@.str.6 = [14 x i8] c"file infecter\00"
@.str.7 = [27 x i8] c"Found a File infecter: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1000 x i8]
%7 = alloca [100 x i8]
%8 = alloca i8
%9 = alloca [5 x i8]
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca %struct.dirent*
%13 = alloca %struct.stat
store i32 0, i32* %1
%14 = bitcast [5 x i8]* %9 to i8*
%15 = call i32* @opendir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32* %15, i32** %11
br label %16
16: ; preds = %120, %0
%17 = load i32*, i32** %11
%18 = call %struct.dirent* @readdir(i32* %17)
store %struct.dirent* %18, %struct.dirent** %12
%19 = icmp ne %struct.dirent* %18, null
br i1 %19, label %20, label %121
20: ; preds = %16
%21 = load %struct.dirent*, %struct.dirent** %12
%22 = getelementptr inbounds %struct.dirent, %struct.dirent* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = call i32 @stat(i32 %23, %struct.stat* %13)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%28 = load %struct.dirent*, %struct.dirent** %12
%29 = getelementptr inbounds %struct.dirent, %struct.dirent* %28, i32 0, i32 1
%30 = load i32, i32* %29
%31 = call i32 @strcat(i8* %27, i32 %30)
%32 = load %struct.dirent*, %struct.dirent** %12
%33 = getelementptr inbounds %struct.dirent, %struct.dirent* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, 8
br i1 %35, label %36, label %120
36: ; preds = %20
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%38 = call i32* @fopen(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %38, i32** %10
store i32 0, i32* %3
store i32 0, i32* %4
store i32 1, i32* %5
br label %39
39: ; preds = %116, %36
%40 = load i32*, i32** %10
%41 = call i32 @feof(i32* %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %47, label %43
43: ; preds = %39
%44 = load i32, i32* %4
%45 = icmp ne i32 %44, 0
%46 = xor i1 %45, true
br label %47
47: ; preds = %43, %39
%48 = phi i1 [ false, %39 ], [ %46, %43 ]
br i1 %48, label %49, label %117
49: ; preds = %47
%50 = load i32*, i32** %10
%51 = call i32 @fread(i8* %8, i32 1, i32 1, i32* %50)
%52 = load i32, i32* %3
%53 = icmp slt i32 %52, 4
br i1 %53, label %54, label %66
54: ; preds = %49
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
%57 = sext i32 %55 to i64
%58 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = load i8, i8* %8
%62 = sext i8 %61 to i32
%63 = icmp ne i32 %60, %62
br i1 %63, label %64, label %65
64: ; preds = %54
store i32 0, i32* %5
br label %65
65: ; preds = %64, %54
br label %66
66: ; preds = %65, %49
%67 = load i32, i32* %3
%68 = icmp eq i32 %67, 4
br i1 %68, label %69, label %75
69: ; preds = %66
%70 = load i32, i32* %5
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%74 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %73)
br label %117
75: ; preds = %69, %66
store i32 0, i32* %2
br label %76
76: ; preds = %115, %75
%77 = load i8, i8* %8
%78 = call i64 @isprint(i8 signext %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %76
%81 = load i32, i32* %3
%82 = icmp sgt i32 %81, 3
br label %83
83: ; preds = %80, %76
%84 = phi i1 [ false, %76 ], [ %82, %80 ]
br i1 %84, label %85, label %116
85: ; preds = %83
%86 = load i8, i8* %8
%87 = load i32, i32* %2
%88 = add nsw i32 %87, 1
store i32 %88, i32* %2
%89 = sext i32 %87 to i64
%90 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 %89
store i8 %86, i8* %90
%91 = load i32*, i32** %10
%92 = call i32 @fread(i8* %8, i32 1, i32 1, i32* %91)
%93 = load i32, i32* %2
%94 = icmp sgt i32 %93, 999
br i1 %94, label %95, label %96
95: ; preds = %85
br label %116
96: ; preds = %85
%97 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%98 = call i64 @strstr(i8* %97, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %96
%101 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%102 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %101)
store i32 1, i32* %4
%103 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%104 = call i32 @clearbuf(i8* %103)
br label %116
105: ; preds = %96
%106 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%107 = call i64 @strstr(i8* %106, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%108 = icmp ne i64 %107, 0
br i1 %108, label %109, label %114
109: ; preds = %105
%110 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%111 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i8* %110)
store i32 1, i32* %4
%112 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%113 = call i32 @clearbuf(i8* %112)
br label %116
114: ; preds = %105
br label %115
115: ; preds = %114
br label %76
116: ; preds = %109, %100, %95, %83
br label %39
117: ; preds = %72, %47
%118 = load i32*, i32** %10
%119 = call i32 @fclose(i32* %118)
br label %120
120: ; preds = %117, %20
br label %16
121: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i32, i32 }
@__const.main.filesig = [5 x i8] c"PK\03\04\00"
@.str = [11 x i8] c"./virfiles\00"
@.str.1 = [12 x i8] c"./virfiles/\00"
@.str.2 = [3 x i8] c"rb\00"
@.str.3 = [25 x i8] c"Found a macro virus: %s\0A\00"
@.str.4 = [10 x i8] c"mbr virus\00"
@.str.5 = [24 x i8] c"Found an mbr virus: %s\0A\00"
@.str.6 = [14 x i8] c"file infecter\00"
@.str.7 = [27 x i8] c"Found a File infecter: %s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca %struct.stat
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = bitcast %struct.stat* %4 to i8*
%8 = tail call i32* @opendir(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = call %struct.dirent* @readdir(i32* %8)
%10 = icmp eq %struct.dirent* %9, null
br i1 %10, label %79, label %11
11: ; preds = %0, %76
%12 = phi %struct.dirent* [ %77, %76 ], [ %9, %0 ]
%13 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i64 0, i32 1
%14 = load i32, i32* %13
%15 = call i32 @stat(i32 %14, %struct.stat* %4)
%16 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %13
%18 = call i32 @strcat(i8* %6, i32 %17)
%19 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i64 0, i32 0
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 8
br i1 %21, label %22, label %76
22: ; preds = %11
%23 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @feof(i32* %23)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %74
26: ; preds = %22, %71
%27 = phi i32 [ %41, %71 ], [ 0, %22 ]
%28 = phi i32 [ %40, %71 ], [ 1, %22 ]
%29 = call i32 @fread(i8* %3, i32 1, i32 1, i32* %23)
%30 = icmp slt i32 %27, 4
br i1 %30, label %31, label %39
31: ; preds = %26
%32 = add nsw i32 %27, 1
%33 = sext i32 %27 to i64
%34 = getelementptr inbounds [5 x i8], [5 x i8]* @__const.main.filesig, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = load i8, i8* %3
%37 = icmp eq i8 %35, %36
%38 = select i1 %37, i32 %28, i32 0
br label %39
39: ; preds = %31, %26
%40 = phi i32 [ %28, %26 ], [ %38, %31 ]
%41 = phi i32 [ %27, %26 ], [ %32, %31 ]
%42 = icmp eq i32 %41, 4
%43 = icmp ne i32 %40, 0
%44 = select i1 %42, i1 %43, i1 false
br i1 %44, label %47, label %45
45: ; preds = %39
%46 = icmp sgt i32 %41, 3
br label %49
47: ; preds = %39
%48 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %6)
br label %74
49: ; preds = %45, %63
%50 = phi i64 [ 0, %45 ], [ %56, %63 ]
%51 = load i8, i8* %3
%52 = call i64 @isprint(i8 signext %51)
%53 = icmp ne i64 %52, 0
%54 = select i1 %53, i1 %46, i1 false
br i1 %54, label %55, label %71
55: ; preds = %49
%56 = add nuw nsw i64 %50, 1
%57 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %50
store i8 %51, i8* %57
%58 = call i32 @fread(i8* %3, i32 1, i32 1, i32* %23)
%59 = icmp eq i64 %50, 999
br i1 %59, label %71, label %60
60: ; preds = %55
%61 = call i64 @strstr(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = call i64 @strstr(i8* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %49, label %66
66: ; preds = %63, %60
%67 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), %60 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), %63 ]
%68 = call i32 @printf(i8* %67, i8* %6)
%69 = call i32 @clearbuf(i8* %5)
%70 = call i32 @feof(i32* %23)
br label %74
71: ; preds = %55, %49
%72 = call i32 @feof(i32* %23)
%73 = icmp eq i32 %72, 0
br i1 %73, label %26, label %74
74: ; preds = %71, %66, %22, %47
%75 = call i32 @fclose(i32* %23)
br label %76
76: ; preds = %74, %11
%77 = call %struct.dirent* @readdir(i32* %8)
%78 = icmp eq %struct.dirent* %77, null
br i1 %78, label %79, label %11
79: ; preds = %76, %0
ret i32 0
}