#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 */

/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
char tolower(char);
void priklad_tri() {
  printf("========== PRIKLAD 3 ==========\n");
  char str1[100];
  char vzor[6] = {'a', 'e', 'i', 'o', 'u', 'y'};
  int vzorCetnost[6] = {0, 0, 0, 0, 0, 0};
  gets(str1);
  for (int i = 0; i < strlen(str1); i++) {
    str1[i] = tolower(str1[i]);
    for (int j = 0; j < strlen(vzor); j++) {
      if (str1[i] == vzor[j]) {
        vzorCetnost[j]++;
      }
    }
  }
  for (int i = 0; i < strlen(vzor); i++) {
    printf("%c existuje %dx\n", vzor[i], vzorCetnost[i]);
  }
  printf("========== KONEC PRIKLADU 3 ==========\n");
}


x86 assembly (clang, -O0):
<priklad_tri>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0xeeb(%rip),%eax
mov    %eax,-0x76(%rbp)
mov    0xee5(%rip),%ax
mov    %ax,-0x72(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
movl   $0x0,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0xa0(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
cmp    %ecx,%eax
jge    127f <priklad_tri+0x12f>
movslq -0x94(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1070 <tolower@plt>
mov    %al,%cl
movslq -0x94(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
movl   $0x0,-0x98(%rbp)
mov    -0x98(%rbp),%eax
mov    %eax,-0xa4(%rbp)
lea    -0x76(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
cmp    %ecx,%eax
jge    1266 <priklad_tri+0x116>
movslq -0x94(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x98(%rbp),%rcx
movsbl -0x76(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    124d <priklad_tri+0xfd>
movslq -0x98(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x90(%rbp,%rax,4)
jmp    1252 <priklad_tri+0x102>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    11f0 <priklad_tri+0xa0>
jmp    126b <priklad_tri+0x11b>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11a3 <priklad_tri+0x53>
movl   $0x0,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
mov    %eax,-0xa8(%rbp)
lea    -0x76(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xa8(%rbp),%eax
cmp    %ecx,%eax
jge    12ea <priklad_tri+0x19a>
movslq -0x9c(%rbp),%rax
movsbl -0x76(%rbp,%rax,1),%esi
movslq -0x9c(%rbp),%rax
mov    -0x90(%rbp,%rax,4),%edx
lea    0xd52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    1289 <priklad_tri+0x139>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priklad_tri>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xeb2(%rip),%rdi
call   1030 <puts@plt>
movw   $0x7975,0xc(%rsp)
movl   $0x6f696561,0x8(%rsp)
6f
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1226 <priklad_tri+0xd6>
xor    %r12d,%r12d
lea    0x8(%rsp),%r15
lea    0x30(%rsp),%r14
jmp    11d3 <priklad_tri+0x83>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%r12
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%r12
jge    1226 <priklad_tri+0xd6>
movsbl 0x30(%rsp,%r12,1),%edi
call   1070 <tolower@plt>
mov    %al,0x30(%rsp,%r12,1)
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11c0 <priklad_tri+0x70>
xor    %ebx,%ebx
jmp    1213 <priklad_tri+0xc3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11c0 <priklad_tri+0x70>
movzbl 0x30(%rsp,%r12,1),%eax
cmp    0x8(%rsp,%rbx,1),%al
jne    1200 <priklad_tri+0xb0>
addl   $0x1,0x10(%rsp,%rbx,4)
jmp    1200 <priklad_tri+0xb0>
lea    0x8(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1276 <priklad_tri+0x126>
lea    0xdcb(%rip),%r14
lea    0x8(%rsp),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0x8(%rsp,%rbx,1),%esi
mov    0x10(%rsp,%rbx,4),%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1250 <priklad_tri+0x100>
lea    0xdba(%rip),%rdi
call   1030 <puts@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"========== PRIKLAD 3 ==========\0A\00"
@__const.priklad_tri.vzor = [6 x i8] c"aeiouy"
@.str.1 = [17 x i8] c"%c existuje %dx\0A\00"
@.str.2 = [40 x i8] c"========== KONEC PRIKLADU 3 ==========\0A\00"
define void @priklad_tri() {
%1 = alloca [100 x i8]
%2 = alloca [6 x i8]
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [6 x i8]* %2 to i8*
%9 = bitcast [6 x i32]* %3 to i8*
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%11 = call i32 @gets(i8* %10)
store i32 0, i32* %4
br label %12
12: ; preds = %54, %0
%13 = load i32, i32* %4
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %57
17: ; preds = %12
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call signext i8 @tolower(i8 signext %21)
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %24
store i8 %22, i8* %25
store i32 0, i32* %5
br label %26
26: ; preds = %50, %17
%27 = load i32, i32* %5
%28 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = icmp slt i32 %27, %29
br i1 %30, label %31, label %53
31: ; preds = %26
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %36, %41
br i1 %42, label %43, label %49
43: ; preds = %31
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = add nsw i32 %47, 1
store i32 %48, i32* %46
br label %49
49: ; preds = %43, %31
br label %50
50: ; preds = %49
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %26
53: ; preds = %26
br label %54
54: ; preds = %53
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %12
57: ; preds = %12
store i32 0, i32* %6
br label %58
58: ; preds = %74, %57
%59 = load i32, i32* %6
%60 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%61 = call i32 @strlen(i8* %60)
%62 = icmp slt i32 %59, %61
br i1 %62, label %63, label %77
63: ; preds = %58
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %68, i32 %72)
br label %74
74: ; preds = %63
%75 = load i32, i32* %6
%76 = add nsw i32 %75, 1
store i32 %76, i32* %6
br label %58
77: ; preds = %58
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.priklad_tri.vzor = [6 x i8] c"aeiouy"
@.str.1 = [17 x i8] c"%c existuje %dx\0A\00"
@str = [32 x i8] c"========== PRIKLAD 3 ==========\00"
@str.3 = [39 x i8] c"========== KONEC PRIKLADU 3 ==========\00"
define void @priklad_tri() {
%1 = alloca [100 x i8]
%2 = alloca [6 x i8]
%3 = alloca [6 x i32]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = bitcast [6 x i32]* %3 to i8*
%8 = call i32 @gets(i8* %5)
%9 = call i32 @strlen(i8* %5)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %21, %0
%12 = call i32 @strlen(i8* %6)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %43, label %41
14: ; preds = %0, %21
%15 = phi i64 [ %22, %21 ], [ 0, %0 ]
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = call signext i8 @tolower(i8 signext %17)
store i8 %18, i8* %16
%19 = call i32 @strlen(i8* %6)
%20 = icmp sgt i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %36, %14
%22 = add nuw nsw i64 %15, 1
%23 = call i32 @strlen(i8* %5)
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %22, %24
br i1 %25, label %14, label %11
26: ; preds = %14, %36
%27 = phi i64 [ %37, %36 ], [ 0, %14 ]
%28 = load i8, i8* %16
%29 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %27
%30 = load i8, i8* %29
%31 = icmp eq i8 %28, %30
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %27
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %36
36: ; preds = %26, %32
%37 = add nuw nsw i64 %27, 1
%38 = call i32 @strlen(i8* %6)
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %26, label %21
41: ; preds = %43, %11
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.3, i64 0, i64 0))
ret void
43: ; preds = %11, %43
%44 = phi i64 [ %51, %43 ], [ 0, %11 ]
%45 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %44
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %47, i32 %49)
%51 = add nuw nsw i64 %44, 1
%52 = call i32 @strlen(i8* %6)
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %51, %53
br i1 %54, label %43, label %41
}