#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*/ StripBlanks(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int CheckSet(char *keyword) {
  FILE *infile;
  int i;
  int found;
  char *pchar;
  static char keywords[20][75];
  static int init = 1;
  static int nokeyw = 0;
  if (init == 1) {
    init = 0;
    infile = fopen("chksysc.set", "r");
    if (infile == NULL) {
      printf("Warning: no keywords file - general test only!");
      nokeyw = 1;
      strcpy(keywords[0], "@GENERAL");
    } else {
      while (nokeyw < 20) {
        fgets(&keywords[nokeyw][0], 75, infile);
        if (feof(infile) || ferror(infile)) {
          break;
        }
        if (keywords[nokeyw][0] == '#') {
          continue;
        }
        pchar = strchr(&keywords[nokeyw][0], '\n');
        if (pchar != NULL) {
          *pchar = '\0';
        } else {
          keywords[nokeyw][75 - 1] = '\0';
        }
        StripBlanks(&keywords[nokeyw][0]);
        nokeyw++;
      }
      fclose(infile);
    }
  }
  found = 0;
  for (i = 0; i < nokeyw; i++) {
    if (strcmp(&keywords[i][0], keyword) == 0) {
      found = 1;
    }
  }
  if (!found) {
    printf("(Skipping: %s)\n", keyword);
  }
  return found;
}


x86 assembly (clang, -O0):
<CheckSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x1,0x2ebd(%rip)
jne    132a <CheckSet+0x18a>
movl   $0x0,0x2ead(%rip)
lea    0xe36(%rip),%rdi
lea    0xe3b(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1215 <CheckSet+0x75>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,0x346f(%rip)
lea    0x2e8c(%rip),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1325 <CheckSet+0x185>
jmp    121a <CheckSet+0x7a>
cmpl   $0x14,0x344b(%rip)
jge    131c <CheckSet+0x17c>
movslq 0x343e(%rip),%rax
lea    0x2e5b(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
mov    $0x4b,%esi
call   1080 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%rax
jne    1270 <CheckSet+0xd0>
mov    -0x10(%rbp),%rdi
call   1040 <ferror@plt>
cmp    $0x0,%rax
je     1275 <CheckSet+0xd5>
jmp    131c <CheckSet+0x17c>
movslq 0x33f0(%rip),%rcx
lea    0x2e0d(%rip),%rax
imul   $0x4b,%rcx,%rcx
add    %rcx,%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    129b <CheckSet+0xfb>
jmp    121a <CheckSet+0x7a>
movslq 0x33ca(%rip),%rax
lea    0x2de7(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     12d5 <CheckSet+0x135>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
jmp    12ee <CheckSet+0x14e>
movslq 0x3390(%rip),%rcx
lea    0x2dad(%rip),%rax
imul   $0x4b,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x4a(%rax)
movslq 0x3377(%rip),%rax
lea    0x2d94(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
call   10c0 <StripBlanks@plt>
mov    0x335e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x3355(%rip)
jmp    121a <CheckSet+0x7a>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
jmp    132a <CheckSet+0x18a>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    0x332b(%rip),%eax
jge    1386 <CheckSet+0x1e6>
movslq -0x14(%rbp),%rax
lea    0x2d3e(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1373 <CheckSet+0x1d3>
movl   $0x1,-0x18(%rbp)
jmp    1378 <CheckSet+0x1d8>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1338 <CheckSet+0x198>
cmpl   $0x0,-0x18(%rbp)
jne    13a2 <CheckSet+0x202>
mov    -0x8(%rbp),%rsi
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckSet>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
cmpb   $0x0,0x34aa(%rip)
jne    1292 <CheckSet+0xf2>
movb   $0x1,0x349d(%rip)
lea    0xe3a(%rip),%rdi
lea    0xe3f(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12dd <CheckSet+0x13d>
mov    %rax,%r14
mov    0x347c(%rip),%eax
cmp    $0x13,%eax
jg     128a <CheckSet+0xea>
lea    0x2e8c(%rip),%r12
jmp    1209 <CheckSet+0x69>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x14,%eax
jge    128a <CheckSet+0xea>
cltq
imul   $0x4b,%rax,%rdi
add    %r12,%rdi
mov    $0x4b,%esi
mov    %r14,%rdx
call   1080 <fgets@plt>
mov    %r14,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
jne    128a <CheckSet+0xea>
mov    %r14,%rdi
call   1040 <ferror@plt>
test   %rax,%rax
jne    128a <CheckSet+0xea>
mov    0x3421(%rip),%eax
movslq %eax,%rcx
imul   $0x4b,%rcx,%rbp
cmpb   $0x23,0x0(%rbp,%r12,1)
je     1200 <CheckSet+0x60>
lea    (%r12,%rbp,1),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
lea    0x4a(%rbp,%r12,1),%rcx
cmovne %rax,%rcx
movb   $0x0,(%rcx)
mov    %rbx,%rdi
call   10c0 <StripBlanks@plt>
mov    0x33e4(%rip),%eax
add    $0x1,%eax
mov    %eax,0x33db(%rip)
jmp    1200 <CheckSet+0x60>
mov    %r14,%rdi
call   1050 <fclose@plt>
cmpl   $0x0,0x33c7(%rip)
jle    1311 <CheckSet+0x171>
xor    %ebp,%ebp
lea    0x2ddc(%rip),%rbx
mov    $0x1,%r12d
xor    %r14d,%r14d
nopl   (%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
cmove  %r12d,%r14d
add    $0x1,%rbp
movslq 0x3393(%rip),%rax
add    $0x4b,%rbx
cmp    %rax,%rbp
jl     12b0 <CheckSet+0x110>
test   %r14d,%r14d
jne    1325 <CheckSet+0x185>
jmp    1311 <CheckSet+0x171>
lea    0xd2a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0x1,0x336b(%rip)
lea    0x2d84(%rip),%rdi
lea    0xd3a(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x0,0x3351(%rip)
jg     129b <CheckSet+0xfb>
lea    0xd2e(%rip),%rdi
xor    %r14d,%r14d
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@CheckSet.keywords = internal global [20 x [75 x i8]] zeroinitializer
@CheckSet.init = internal global i32 1
@CheckSet.nokeyw = internal global i32 0
@.str = [12 x i8] c"chksysc.set\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [47 x i8] c"Warning: no keywords file - general test only!\00"
@.str.3 = [9 x i8] c"@GENERAL\00"
@.str.4 = [16 x i8] c"(Skipping: %s)\0A\00"
define i32 @CheckSet(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i32, i32* @CheckSet.init
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %71
9: ; preds = %1
store i32 0, i32* @CheckSet.init
%10 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* @CheckSet.nokeyw
%15 = call i32 @strcpy(i8* getelementptr inbounds ([20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %70
16: ; preds = %9
br label %17
17: ; preds = %59, %43, %16
%18 = load i32, i32* @CheckSet.nokeyw
%19 = icmp slt i32 %18, 20
br i1 %19, label %20, label %67
20: ; preds = %17
%21 = load i32, i32* @CheckSet.nokeyw
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %22
%24 = getelementptr inbounds [75 x i8], [75 x i8]* %23, i64 0, i64 0
%25 = load i32*, i32** %3
%26 = call i32 @fgets(i8* %24, i32 75, i32* %25)
%27 = load i32*, i32** %3
%28 = call i64 @feof(i32* %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %20
%31 = load i32*, i32** %3
%32 = call i64 @ferror(i32* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30, %20
br label %67
35: ; preds = %30
%36 = load i32, i32* @CheckSet.nokeyw
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %37
%39 = getelementptr inbounds [75 x i8], [75 x i8]* %38, i64 0, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 35
br i1 %42, label %43, label %44
43: ; preds = %35
br label %17
44: ; preds = %35
%45 = load i32, i32* @CheckSet.nokeyw
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %46
%48 = getelementptr inbounds [75 x i8], [75 x i8]* %47, i64 0, i64 0
%49 = call i8* @strchr(i8* %48, i8 signext 10)
store i8* %49, i8** %6
%50 = load i8*, i8** %6
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %54
52: ; preds = %44
%53 = load i8*, i8** %6
store i8 0, i8* %53
br label %59
54: ; preds = %44
%55 = load i32, i32* @CheckSet.nokeyw
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %56
%58 = getelementptr inbounds [75 x i8], [75 x i8]* %57, i64 0, i64 74
store i8 0, i8* %58
br label %59
59: ; preds = %54, %52
%60 = load i32, i32* @CheckSet.nokeyw
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %61
%63 = getelementptr inbounds [75 x i8], [75 x i8]* %62, i64 0, i64 0
%64 = call i32 @StripBlanks(i8* %63)
%65 = load i32, i32* @CheckSet.nokeyw
%66 = add nsw i32 %65, 1
store i32 %66, i32* @CheckSet.nokeyw
br label %17
67: ; preds = %34, %17
%68 = load i32*, i32** %3
%69 = call i32 @fclose(i32* %68)
br label %70
70: ; preds = %67, %13
br label %71
71: ; preds = %70, %1
store i32 0, i32* %5
store i32 0, i32* %4
br label %72
72: ; preds = %86, %71
%73 = load i32, i32* %4
%74 = load i32, i32* @CheckSet.nokeyw
%75 = icmp slt i32 %73, %74
br i1 %75, label %76, label %89
76: ; preds = %72
%77 = load i32, i32* %4
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %78
%80 = getelementptr inbounds [75 x i8], [75 x i8]* %79, i64 0, i64 0
%81 = load i8*, i8** %2
%82 = call i64 @strcmp(i8* %80, i8* %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %76
store i32 1, i32* %5
br label %85
85: ; preds = %84, %76
br label %86
86: ; preds = %85
%87 = load i32, i32* %4
%88 = add nsw i32 %87, 1
store i32 %88, i32* %4
br label %72
89: ; preds = %72
%90 = load i32, i32* %5
%91 = icmp ne i32 %90, 0
br i1 %91, label %95, label %92
92: ; preds = %89
%93 = load i8*, i8** %2
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %93)
br label %95
95: ; preds = %92, %89
%96 = load i32, i32* %5
ret i32 %96
}

LLVM IR (-O2):
@CheckSet.keywords = internal global [20 x [75 x i8]] zeroinitializer
@CheckSet.init = internal unnamed_addr global i1 false
@CheckSet.nokeyw = internal unnamed_addr global i32 0
@.str = [12 x i8] c"chksysc.set\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [47 x i8] c"Warning: no keywords file - general test only!\00"
@.str.3 = [9 x i8] c"@GENERAL\00"
@.str.4 = [16 x i8] c"(Skipping: %s)\0A\00"
define i32 @CheckSet(i8* %0) {
%2 = load i1, i1* @CheckSet.init
br i1 %2, label %41, label %3
3: ; preds = %1
store i1 true, i1* @CheckSet.init
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* @CheckSet.nokeyw
%8 = tail call i32 @strcpy(i8* getelementptr inbounds ([20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %41
9: ; preds = %3
%10 = load i32, i32* @CheckSet.nokeyw
%11 = icmp slt i32 %10, 20
br i1 %11, label %12, label %39
12: ; preds = %9, %36
%13 = phi i32 [ %37, %36 ], [ %10, %9 ]
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %14, i64 0
%16 = tail call i32 @fgets(i8* %15, i32 75, i32* %4)
%17 = tail call i64 @feof(i32* %4)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %39
19: ; preds = %12
%20 = tail call i64 @ferror(i32* %4)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %39
22: ; preds = %19
%23 = load i32, i32* @CheckSet.nokeyw
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %24, i64 0
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 35
br i1 %27, label %36, label %28
28: ; preds = %22
%29 = tail call i8* @strchr(i8* %25, i8 signext 10)
%30 = icmp eq i8* %29, null
%31 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %24, i64 74
%32 = select i1 %30, i8* %31, i8* %29
store i8 0, i8* %32
%33 = tail call i32 @StripBlanks(i8* %25)
%34 = load i32, i32* @CheckSet.nokeyw
%35 = add nsw i32 %34, 1
store i32 %35, i32* @CheckSet.nokeyw
br label %36
36: ; preds = %28, %22
%37 = phi i32 [ %23, %22 ], [ %35, %28 ]
%38 = icmp slt i32 %37, 20
br i1 %38, label %12, label %39
39: ; preds = %36, %19, %12, %9
%40 = tail call i32 @fclose(i32* %4)
br label %41
41: ; preds = %6, %39, %1
%42 = load i32, i32* @CheckSet.nokeyw
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %57
44: ; preds = %41, %44
%45 = phi i64 [ %51, %44 ], [ 0, %41 ]
%46 = phi i32 [ %50, %44 ], [ 0, %41 ]
%47 = getelementptr inbounds [20 x [75 x i8]], [20 x [75 x i8]]* @CheckSet.keywords, i64 0, i64 %45, i64 0
%48 = tail call i64 @strcmp(i8* %47, i8* %0)
%49 = icmp eq i64 %48, 0
%50 = select i1 %49, i32 1, i32 %46
%51 = add nuw nsw i64 %45, 1
%52 = load i32, i32* @CheckSet.nokeyw
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %51, %53
br i1 %54, label %44, label %55
55: ; preds = %44
%56 = icmp eq i32 %50, 0
br i1 %56, label %57, label %59
57: ; preds = %41, %55
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %59
59: ; preds = %57, %55
%60 = phi i32 [ 0, %57 ], [ %50, %55 ]
ret i32 %60
}