#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ isAllowedWord(char *);
scalar_t__ isalnum(char);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main() {
  int i, inWord;
  int count = 0, totalallowed = 0, totalwords = 0;
  char row[100], zbor[20];
  FILE *ptr;
  if ((ptr = fopen("D:\\_strukturno\\vlez.txt", "r")) == NULL) {
    printf("Vlez.txt can not be opened!");
    return -1;
  }
  while (fgets(row, 100, ptr) != NULL) {
    inWord = count = 0;
    for (i = 0; i < strlen(row); i++) {
      if (isalnum(row[i])) {
        if (!inWord) {
          inWord = 1;
        }
        zbor[count++] = row[i];
      } else if (inWord) {
        inWord = 0;
        zbor[count] = '\0';
        if (isAllowedWord(zbor)) {
          printf("%s ", zbor);
          totalallowed++;
        }
        totalwords++;
        count = 0;
      }
    }
  }
  printf("Total allowed words: %d\n", totalallowed);
  printf("Total words: %d\n", totalwords);
  fclose(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe62(%rip),%rdi
lea    0xe73(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xa8(%rbp)
cmp    $0x0,%rax
jne    11d5 <main+0x65>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    132d <main+0x1bd>
jmp    11da <main+0x6a>
lea    -0x80(%rbp),%rdi
mov    -0xa8(%rbp),%rdx
mov    $0x64,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     12f8 <main+0x188>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xac(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xac(%rbp),%eax
cmp    %ecx,%eax
jge    12f3 <main+0x183>
movslq -0x8(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%rax
je     127a <main+0x10a>
cmpl   $0x0,-0xc(%rbp)
jne    1259 <main+0xe9>
movl   $0x1,-0xc(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x80(%rbp,%rax,1),%cl
mov    -0x10(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cltq
mov    %cl,-0xa0(%rbp,%rax,1)
jmp    12e0 <main+0x170>
cmpl   $0x0,-0xc(%rbp)
je     12db <main+0x16b>
movl   $0x0,-0xc(%rbp)
movslq -0x10(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    -0xa0(%rbp),%rdi
call   1080 <isAllowedWord@plt>
cmp    $0x0,%rax
je     12cb <main+0x15b>
lea    -0xa0(%rbp),%rsi
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    12e0 <main+0x170>
jmp    12e5 <main+0x175>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    120e <main+0x9e>
jmp    11da <main+0x6a>
mov    -0x14(%rbp),%esi
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xe78(%rip),%rdi
lea    0xe89(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     12e5 <main+0x175>
mov    %rax,%r14
lea    0x30(%rsp),%rdi
mov    $0x64,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
movl   $0x0,0x4(%rsp)
mov    $0x0,%r15d
test   %rax,%rax
je     12b6 <main+0x146>
lea    0x30(%rsp),%rbx
mov    $0x1,%ebp
xor    %r15d,%r15d
movl   $0x0,0x4(%rsp)
mov    %r14,0x8(%rsp)
jmp    120e <main+0x9e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x64,%esi
mov    0x8(%rsp),%r14
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12b6 <main+0x146>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11f0 <main+0x80>
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    125b <main+0xeb>
cs nopw 0x0(%rax,%rax,1)
nop
test   %r12d,%r12d
cmove  %ebp,%r12d
movzbl 0x30(%rsp,%r14,1),%eax
movslq %r13d,%rcx
add    $0x1,%r13d
mov    %al,0x10(%rsp,%rcx,1)
add    $0x1,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%r14
jge    11f0 <main+0x80>
movsbl 0x30(%rsp,%r14,1),%edi
call   1060 <isalnum@plt>
test   %rax,%rax
jne    1230 <main+0xc0>
test   %r12d,%r12d
je     12b1 <main+0x141>
movslq %r13d,%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1080 <isAllowedWord@plt>
test   %rax,%rax
je     12a0 <main+0x130>
lea    0xda5(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
addl   $0x1,0x4(%rsp)
mov    $0x1,%ebp
add    $0x1,%r15d
xor    %r12d,%r12d
xor    %r13d,%r13d
jmp    1248 <main+0xd8>
xor    %r12d,%r12d
jmp    1248 <main+0xd8>
lea    0xd7d(%rip),%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd84(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    12f8 <main+0x188>
lea    0xd2e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"D:\\_strukturno\\vlez.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [28 x i8] c"Vlez.txt can not be opened!\00"
@.str.3 = [4 x i8] c"%s \00"
@.str.4 = [25 x i8] c"Total allowed words: %d\0A\00"
@.str.5 = [17 x i8] c"Total words: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [100 x i8]
%8 = alloca [20 x i8]
%9 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%10 = call i32* @fopen(i8* getelementptr inbounds ([24 x i8], [24 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** %9
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %77
14: ; preds = %0
br label %15
15: ; preds = %69, %14
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%17 = load i32*, i32** %9
%18 = call i32* @fgets(i8* %16, i32 100, i32* %17)
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %70
20: ; preds = %15
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
br label %21
21: ; preds = %66, %20
%22 = load i32, i32* %2
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %69
26: ; preds = %21
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = call i64 @isalnum(i8 signext %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %46
33: ; preds = %26
%34 = load i32, i32* %3
%35 = icmp ne i32 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %33
store i32 1, i32* %3
br label %37
37: ; preds = %36, %33
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 %44
store i8 %41, i8* %45
br label %65
46: ; preds = %26
%47 = load i32, i32* %3
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %64
49: ; preds = %46
store i32 0, i32* %3
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 %51
store i8 0, i8* %52
%53 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%54 = call i64 @isAllowedWord(i8* %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %61
56: ; preds = %49
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
br label %61
61: ; preds = %56, %49
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
store i32 0, i32* %4
br label %64
64: ; preds = %61, %46
br label %65
65: ; preds = %64, %37
br label %66
66: ; preds = %65
%67 = load i32, i32* %2
%68 = add nsw i32 %67, 1
store i32 %68, i32* %2
br label %21
69: ; preds = %21
br label %15
70: ; preds = %15
%71 = load i32, i32* %5
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %6
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %73)
%75 = load i32*, i32** %9
%76 = call i32 @fclose(i32* %75)
store i32 0, i32* %1
br label %77
77: ; preds = %70, %12
%78 = load i32, i32* %1
ret i32 %78
}

LLVM IR (-O2):
@.str = [24 x i8] c"D:\\_strukturno\\vlez.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [28 x i8] c"Vlez.txt can not be opened!\00"
@.str.3 = [4 x i8] c"%s \00"
@.str.4 = [25 x i8] c"Total allowed words: %d\0A\00"
@.str.5 = [17 x i8] c"Total words: %d\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = call i32* @fgets(i8* %3, i32 100, i32* %5)
%9 = icmp eq i32* %8, null
br i1 %9, label %60, label %17
10: ; preds = %0
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %66
12: ; preds = %51, %17
%13 = phi i32 [ %19, %17 ], [ %54, %51 ]
%14 = phi i32 [ %18, %17 ], [ %55, %51 ]
%15 = call i32* @fgets(i8* %3, i32 100, i32* %5)
%16 = icmp eq i32* %15, null
br i1 %16, label %60, label %17
17: ; preds = %7, %12
%18 = phi i32 [ %14, %12 ], [ 0, %7 ]
%19 = phi i32 [ %13, %12 ], [ 0, %7 ]
%20 = call i32 @strlen(i8* %3)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %12
22: ; preds = %17, %51
%23 = phi i64 [ %56, %51 ], [ 0, %17 ]
%24 = phi i32 [ %55, %51 ], [ %18, %17 ]
%25 = phi i32 [ %54, %51 ], [ %19, %17 ]
%26 = phi i32 [ %53, %51 ], [ 0, %17 ]
%27 = phi i32 [ %52, %51 ], [ 0, %17 ]
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %23
%29 = load i8, i8* %28
%30 = call i64 @isalnum(i8 signext %29)
%31 = icmp eq i64 %30, 0
%32 = icmp eq i32 %27, 0
br i1 %31, label %39, label %33
33: ; preds = %22
%34 = select i1 %32, i32 1, i32 %27
%35 = load i8, i8* %28
%36 = add nsw i32 %26, 1
%37 = sext i32 %26 to i64
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %37
store i8 %35, i8* %38
br label %51
39: ; preds = %22
br i1 %32, label %51, label %40
40: ; preds = %39
%41 = sext i32 %26 to i64
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %41
store i8 0, i8* %42
%43 = call i64 @isAllowedWord(i8* %4)
%44 = icmp eq i64 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%47 = add nsw i32 %25, 1
br label %48
48: ; preds = %45, %40
%49 = phi i32 [ %47, %45 ], [ %25, %40 ]
%50 = add nsw i32 %24, 1
br label %51
51: ; preds = %33, %48, %39
%52 = phi i32 [ %34, %33 ], [ 0, %48 ], [ 0, %39 ]
%53 = phi i32 [ %36, %33 ], [ 0, %48 ], [ %26, %39 ]
%54 = phi i32 [ %25, %33 ], [ %49, %48 ], [ %25, %39 ]
%55 = phi i32 [ %24, %33 ], [ %50, %48 ], [ %24, %39 ]
%56 = add nuw nsw i64 %23, 1
%57 = call i32 @strlen(i8* %3)
%58 = sext i32 %57 to i64
%59 = icmp slt i64 %56, %58
br i1 %59, label %22, label %12
60: ; preds = %12, %7
%61 = phi i32 [ 0, %7 ], [ %13, %12 ]
%62 = phi i32 [ 0, %7 ], [ %14, %12 ]
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %61)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %62)
%65 = call i32 @fclose(i32* %5)
br label %66
66: ; preds = %60, %10
%67 = phi i32 [ -1, %10 ], [ 0, %60 ]
ret i32 %67
}