#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__ ima_poveke_od2isti(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int main() {
  char zbor[21];
  FILE *f;
  int brzb = 0;
  if ((f = fopen("zborovi.txt", "r")) == NULL) {
    printf("Datotekata %s ne se otvora.\n", "zborovi.txt");
    return -1;
  }
  while (fgets(zbor, 21, f) != NULL) {
    if (ima_poveke_od2isti(zbor)) {
      puts(zbor);
      brzb++;
    }
  }
  printf("\nVkupno %d zborovi.\n", brzb);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xe83(%rip),%rdi
lea    0xe88(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    11b8 <main+0x58>
lea    0xe70(%rip),%rdi
lea    0xe5b(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1224 <main+0xc4>
jmp    11bd <main+0x5d>
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x15,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1203 <main+0xa3>
lea    -0x20(%rbp),%rdi
call   1040 <ima_poveke_od2isti@plt>
cmp    $0x0,%rax
je     11fe <main+0x9e>
lea    -0x20(%rbp),%rdi
call   1030 <puts@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bd <main+0x5d>
mov    -0x2c(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe8f(%rip),%rdi
lea    0xe94(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11f9 <main+0x99>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x15,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
xor    %r14d,%r14d
mov    $0x0,%ebp
test   %rax,%rax
je     11df <main+0x7f>
xor    %ebp,%ebp
mov    %rsp,%rbx
jmp    11c5 <main+0x65>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x15,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     11df <main+0x7f>
mov    %rbx,%rdi
call   1040 <ima_poveke_od2isti@plt>
test   %rax,%rax
je     11b0 <main+0x50>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
jmp    11b0 <main+0x50>
lea    0xe45(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
jmp    1214 <main+0xb4>
lea    0xe0e(%rip),%rdi
lea    0xdf9(%rip),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"zborovi.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"Datotekata %s ne se otvora.\0A\00"
@.str.3 = [21 x i8] c"\0AVkupno %d zborovi.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = 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* %5, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %30
9: ; preds = %0
br label %10
10: ; preds = %24, %9
%11 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%12 = load i32*, i32** %3
%13 = call i32* @fgets(i8* %11, i32 21, i32* %12)
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %25
15: ; preds = %10
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%17 = call i64 @ima_poveke_od2isti(i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%21 = call i32 @puts(i8* %20)
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %24
24: ; preds = %19, %15
br label %10
25: ; preds = %10
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32*, i32** %3
%29 = call i32 @fclose(i32* %28)
store i32 0, i32* %1
br label %30
30: ; preds = %25, %7
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [12 x i8] c"zborovi.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"Datotekata %s ne se otvora.\0A\00"
@.str.3 = [21 x i8] c"\0AVkupno %d zborovi.\0A\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = 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))
%4 = icmp eq i32* %3, null
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = call i32* @fgets(i8* %2, i32 21, i32* %3)
%7 = icmp eq i32* %6, null
br i1 %7, label %21, label %10
8: ; preds = %0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %25
10: ; preds = %5, %17
%11 = phi i32 [ %18, %17 ], [ 0, %5 ]
%12 = call i64 @ima_poveke_od2isti(i8* %2)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = call i32 @puts(i8* %2)
%16 = add nsw i32 %11, 1
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ %16, %14 ], [ %11, %10 ]
%19 = call i32* @fgets(i8* %2, i32 21, i32* %3)
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %10
21: ; preds = %17, %5
%22 = phi i32 [ 0, %5 ], [ %18, %17 ]
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = call i32 @fclose(i32* %3)
br label %25
25: ; preds = %21, %8
%26 = phi i32 [ -1, %8 ], [ 0, %21 ]
ret i32 %26
}