#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 *);
void WrMessage(char *keyword) {
  FILE *infile;
  int i;
  int found;
  int prline;
  char *pchar;
  static char contents[800][75];
  static int init = 1;
  static int noline = 0;
  if (init == 1) {
    init = 0;
    infile = fopen("chksysc.msg", "r");
    if (infile == NULL) {
      printf("Warning: no messages file!");
    } else {
      for (i = 0; i < 800; i++) {
        fgets(&contents[i][0], 75, infile);
        if (feof(infile) || ferror(infile)) {
          break;
        }
        noline++;
        pchar = strchr(&contents[i][0], '\n');
        if (pchar != NULL) {
          *pchar = '\0';
        } else {
          contents[i][75 - 1] = '\0';
        }
        StripBlanks(&contents[i][0]);
      }
      fclose(infile);
    }
  }
  found = 0;
  prline = 0;
  for (i = 0; i < noline; i++) {
    if (contents[i][0] == '@') {
      prline = 0;
    }
    if (prline == 1) {
      printf("%s\n", &contents[i][0]);
    }
    if (strcmp(&contents[i][0], keyword) == 0) {
      prline = 1;
      found = 1;
    }
  }
  if (!found) {
    printf("(Not found: %s)\n", keyword);
  }
  return;
}


x86 assembly (clang, -O0):
<WrMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x1,0x2ec5(%rip)
jne    12d6 <WrMessage+0x146>
movl   $0x0,0x2eb5(%rip)
lea    0xe46(%rip),%rdi
lea    0xe4b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11e8 <WrMessage+0x58>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12d1 <WrMessage+0x141>
movl   $0x0,-0x14(%rbp)
cmpl   $0x320,-0x14(%rbp)
jge    12c8 <WrMessage+0x138>
movslq -0x14(%rbp),%rax
lea    0x2e79(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
mov    $0x4b,%esi
call   1070 <fgets@plt>
mov    -0x10(%rbp),%rdi
call   1090 <feof@plt>
cmp    $0x0,%rax
jne    1242 <WrMessage+0xb2>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     1247 <WrMessage+0xb7>
jmp    12c8 <WrMessage+0x138>
mov    0x11893(%rip),%eax
add    $0x1,%eax
mov    %eax,0x1188a(%rip)
movslq -0x14(%rbp),%rax
lea    0x2e1f(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     128d <WrMessage+0xfd>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
jmp    12a3 <WrMessage+0x113>
movslq -0x14(%rbp),%rcx
lea    0x2de8(%rip),%rax
imul   $0x4b,%rcx,%rcx
add    %rcx,%rax
movb   $0x0,0x4a(%rax)
movslq -0x14(%rbp),%rax
lea    0x2dd2(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
call   10b0 <StripBlanks@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ef <WrMessage+0x5f>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
jmp    12d6 <WrMessage+0x146>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    0x117ec(%rip),%eax
jge    138f <WrMessage+0x1ff>
movslq -0x14(%rbp),%rcx
lea    0x2d7b(%rip),%rax
imul   $0x4b,%rcx,%rcx
add    %rcx,%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    131f <WrMessage+0x18f>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1349 <WrMessage+0x1b9>
movslq -0x14(%rbp),%rax
lea    0x2d4c(%rip),%rsi
imul   $0x4b,%rax,%rax
add    %rax,%rsi
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movslq -0x14(%rbp),%rax
lea    0x2d2c(%rip),%rdi
imul   $0x4b,%rax,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    137c <WrMessage+0x1ec>
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
jmp    1381 <WrMessage+0x1f1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12eb <WrMessage+0x15b>
cmpl   $0x0,-0x18(%rbp)
jne    13ab <WrMessage+0x21b>
mov    -0x8(%rbp),%rsi
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WrMessage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
cmpb   $0x0,0x1192a(%rip)
jne    1256 <WrMessage+0xb6>
movb   $0x1,0x1191d(%rip)
lea    0xe36(%rip),%rdi
lea    0xe3b(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     12d6 <WrMessage+0x136>
mov    %rax,%r15
lea    0x2e97(%rip),%rbx
mov    $0x320,%r12d
nop
mov    %rbx,%rdi
mov    $0x4b,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
mov    %r15,%rdi
call   10a0 <feof@plt>
test   %rax,%rax
jne    124e <WrMessage+0xae>
mov    %r15,%rdi
call   1040 <ferror@plt>
test   %rax,%rax
jne    124e <WrMessage+0xae>
addl   $0x1,0x118c3(%rip)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
lea    0x4a(%rbx),%rcx
test   %rax,%rax
cmovne %rax,%rcx
movb   $0x0,(%rcx)
mov    %rbx,%rdi
call   10c0 <StripBlanks@plt>
add    $0x4b,%rbx
add    $0xffffffffffffffff,%r12
jne    11f0 <WrMessage+0x50>
mov    %r15,%rdi
call   1050 <fclose@plt>
cmpl   $0x0,0x11887(%rip)
jle    12f1 <WrMessage+0x151>
xor    %r15d,%r15d
lea    0x2e13(%rip),%rbx
mov    $0x1,%r12d
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    12ab <WrMessage+0x10b>
nopl   (%rax)
mov    %rbx,%rdi
mov    (%rsp),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
cmove  %r12d,%r13d
cmove  %r12d,%r14d
add    $0x1,%rbp
movslq 0x11842(%rip),%rax
add    $0x4b,%rbx
cmp    %rax,%rbp
jge    12c2 <WrMessage+0x122>
cmpb   $0x40,(%rbx)
cmove  %r15d,%r14d
cmp    $0x1,%r14d
jne    1280 <WrMessage+0xe0>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1280 <WrMessage+0xe0>
test   %r13d,%r13d
je     12f1 <WrMessage+0x151>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd31(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpl   $0x0,0x117f9(%rip)
jg     1263 <WrMessage+0xc3>
lea    0xd31(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <printf@plt>

LLVM IR (-O0):
@WrMessage.contents = internal global [800 x [75 x i8]] zeroinitializer
@WrMessage.init = internal global i32 1
@WrMessage.noline = internal global i32 0
@.str = [12 x i8] c"chksysc.msg\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"Warning: no messages file!\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [17 x i8] c"(Not found: %s)\0A\00"
define void @WrMessage(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %2
%8 = load i32, i32* @WrMessage.init
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %65
10: ; preds = %1
store i32 0, i32* @WrMessage.init
%11 = 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* %11, i32** %3
%12 = load i32*, i32** %3
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %64
16: ; preds = %10
store i32 0, i32* %4
br label %17
17: ; preds = %58, %16
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 800
br i1 %19, label %20, label %61
20: ; preds = %17
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, 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 %61
35: ; preds = %30
%36 = load i32, i32* @WrMessage.noline
%37 = add nsw i32 %36, 1
store i32 %37, i32* @WrMessage.noline
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, i64 0, i64 %39
%41 = getelementptr inbounds [75 x i8], [75 x i8]* %40, i64 0, i64 0
%42 = call i8* @strchr(i8* %41, i8 signext 10)
store i8* %42, i8** %7
%43 = load i8*, i8** %7
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %47
45: ; preds = %35
%46 = load i8*, i8** %7
store i8 0, i8* %46
br label %52
47: ; preds = %35
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, i64 0, i64 %49
%51 = getelementptr inbounds [75 x i8], [75 x i8]* %50, i64 0, i64 74
store i8 0, i8* %51
br label %52
52: ; preds = %47, %45
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, i64 0, i64 %54
%56 = getelementptr inbounds [75 x i8], [75 x i8]* %55, i64 0, i64 0
%57 = call i32 @StripBlanks(i8* %56)
br label %58
58: ; preds = %52
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %17
61: ; preds = %34, %17
%62 = load i32*, i32** %3
%63 = call i32 @fclose(i32* %62)
br label %64
64: ; preds = %61, %14
br label %65
65: ; preds = %64, %1
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %4
br label %66
66: ; preds = %98, %65
%67 = load i32, i32* %4
%68 = load i32, i32* @WrMessage.noline
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %101
70: ; preds = %66
%71 = load i32, i32* %4
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, i64 0, i64 %72
%74 = getelementptr inbounds [75 x i8], [75 x i8]* %73, i64 0, i64 0
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp eq i32 %76, 64
br i1 %77, label %78, label %79
78: ; preds = %70
store i32 0, i32* %6
br label %79
79: ; preds = %78, %70
%80 = load i32, i32* %6
%81 = icmp eq i32 %80, 1
br i1 %81, label %82, label %88
82: ; preds = %79
%83 = load i32, i32* %4
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, i64 0, i64 %84
%86 = getelementptr inbounds [75 x i8], [75 x i8]* %85, i64 0, i64 0
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %86)
br label %88
88: ; preds = %82, %79
%89 = load i32, i32* %4
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [800 x [75 x i8]], [800 x [75 x i8]]* @WrMessage.contents, i64 0, i64 %90
%92 = getelementptr inbounds [75 x i8], [75 x i8]* %91, i64 0, i64 0
%93 = load i8*, i8** %2
%94 = call i64 @strcmp(i8* %92, i8* %93)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %88
store i32 1, i32* %6
store i32 1, i32* %5
br label %97
97: ; preds = %96, %88
br label %98
98: ; preds = %97
%99 = load i32, i32* %4
%100 = add nsw i32 %99, 1
store i32 %100, i32* %4
br label %66
101: ; preds = %66
%102 = load i32, i32* %5
%103 = icmp ne i32 %102, 0
br i1 %103, label %107, label %104
104: ; preds = %101
%105 = load i8*, i8** %2
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %105)
br label %107
107: ; preds = %104, %101
ret void
}

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