#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 */
char EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  FILE *fp;
  char ch;
  int co = 0;
  int wo = 0;
  int tot = 0;
  fp = fopen("italian.txt", "r");
  if (fp == NULL) {
    printf("Cannot open file.\n");
    exit(1);
  }
  while ((ch = fgetc(fp)) != EOF) {
    if (ch >= 'a' && ch <= 'z') {
      tot++;
      if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') {
        wo++;
      } else {
        co++;
      }
    }
  }
  printf("Totals: %d \n", tot);
  printf("Vovels: %d \n", wo);
  printf("Consonants: %d \n", co);
  printf("Percentage of Vovels: %.3f percent", (double)wo / tot);
  fclose(fp);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xe75(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11be <main+0x5e>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    11c3 <main+0x63>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e0f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1269 <main+0x109>
movsbl -0x11(%rbp),%eax
cmp    $0x61,%eax
jl     1264 <main+0x104>
movsbl -0x11(%rbp),%eax
cmp    $0x7a,%eax
jg     1264 <main+0x104>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x61,%eax
je     1248 <main+0xe8>
movsbl -0x11(%rbp),%eax
cmp    $0x65,%eax
je     1248 <main+0xe8>
movsbl -0x11(%rbp),%eax
cmp    $0x69,%eax
je     1248 <main+0xe8>
movsbl -0x11(%rbp),%eax
cmp    $0x6f,%eax
je     1248 <main+0xe8>
movsbl -0x11(%rbp),%eax
cmp    $0x75,%eax
jne    1256 <main+0xf6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    125f <main+0xff>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1264 <main+0x104>
jmp    11c3 <main+0x63>
mov    -0x20(%rbp),%esi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cvtsi2sdl -0x1c(%rbp),%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xd9b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe7e(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     126f <main+0xff>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <fgetc@plt>
mov    0x2e3f(%rip),%r12
xor    %r15d,%r15d
mov    $0x0,%ebx
mov    $0x0,%ebp
cmp    (%r12),%al
jne    1227 <main+0xb7>
lea    0xe4b(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe48(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe45(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cvtsi2sd %ebx,%xmm0
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm0
lea    0xe39(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
mov    $0x495,%r13d
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1252 <main+0xe2>
add    $0x1,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <fgetc@plt>
cmp    (%r12),%al
je     11bc <main+0x4c>
add    $0x9f,%al
cmp    $0x19,%al
ja     1240 <main+0xd0>
add    $0x1,%ebp
ror    %al
cmp    $0xa,%al
ja     1236 <main+0xc6>
movzbl %al,%eax
bt     %rax,%r13
jae    1236 <main+0xc6>
add    $0x1,%ebx
jmp    1240 <main+0xd0>
lea    0xde6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"italian.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Cannot open file.\0A\00"
@EOF = global i8 0
@.str.3 = [13 x i8] c"Totals: %d \0A\00"
@.str.4 = [13 x i8] c"Vovels: %d \0A\00"
@.str.5 = [17 x i8] c"Consonants: %d \0A\00"
@.str.6 = [35 x i8] c"Percentage of Vovels: %.3f percent\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = 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* %7, i32** %2
%8 = load i32*, i32** %2
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
br label %14
14: ; preds = %58, %13
%15 = load i32*, i32** %2
%16 = call signext i8 @fgetc(i32* %15)
store i8 %16, i8* %3
%17 = sext i8 %16 to i32
%18 = load i8, i8* @EOF
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %17, %19
br i1 %20, label %21, label %59
21: ; preds = %14
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 97
br i1 %24, label %25, label %58
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 122
br i1 %28, label %29, label %58
29: ; preds = %25
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 97
br i1 %34, label %51, label %35
35: ; preds = %29
%36 = load i8, i8* %3
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 101
br i1 %38, label %51, label %39
39: ; preds = %35
%40 = load i8, i8* %3
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 105
br i1 %42, label %51, label %43
43: ; preds = %39
%44 = load i8, i8* %3
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 111
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = load i8, i8* %3
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 117
br i1 %50, label %51, label %54
51: ; preds = %47, %43, %39, %35, %29
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %57
54: ; preds = %47
%55 = load i32, i32* %4
%56 = add nsw i32 %55, 1
store i32 %56, i32* %4
br label %57
57: ; preds = %54, %51
br label %58
58: ; preds = %57, %25, %21
br label %14
59: ; preds = %14
%60 = load i32, i32* %6
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %5
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %4
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %5
%67 = sitofp i32 %66 to double
%68 = load i32, i32* %6
%69 = sitofp i32 %68 to double
%70 = fdiv double %67, %69
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %70)
%72 = load i32*, i32** %2
%73 = call i32 @fclose(i32* %72)
%74 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"italian.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.3 = [13 x i8] c"Totals: %d \0A\00"
@.str.4 = [13 x i8] c"Vovels: %d \0A\00"
@.str.5 = [17 x i8] c"Consonants: %d \0A\00"
@.str.6 = [35 x i8] c"Percentage of Vovels: %.3f percent\00"
@str = [18 x i8] c"Cannot open file.\00"
define i32 @main() {
%1 = 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))
%2 = icmp eq i32* %1, null
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call signext i8 @fgetc(i32* %1)
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %31, label %10
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3, %24
%11 = phi i8 [ %28, %24 ], [ %4, %3 ]
%12 = phi i32 [ %27, %24 ], [ 0, %3 ]
%13 = phi i32 [ %26, %24 ], [ 0, %3 ]
%14 = phi i32 [ %25, %24 ], [ 0, %3 ]
%15 = add i8 %11, -97
%16 = icmp ult i8 %15, 26
br i1 %16, label %17, label %24
17: ; preds = %10
%18 = add nsw i32 %12, 1
%19 = tail call i8 @llvm.fshl.i8(i8 %15, i8 %15, i8 7)
switch i8 %19, label %22 [
i8 10, label %20
i8 7, label %20
i8 4, label %20
i8 2, label %20
i8 0, label %20
]
20: ; preds = %17, %17, %17, %17, %17
%21 = add nsw i32 %13, 1
br label %24
22: ; preds = %17
%23 = add nsw i32 %14, 1
br label %24
24: ; preds = %20, %22, %10
%25 = phi i32 [ %14, %20 ], [ %23, %22 ], [ %14, %10 ]
%26 = phi i32 [ %21, %20 ], [ %13, %22 ], [ %13, %10 ]
%27 = phi i32 [ %18, %20 ], [ %18, %22 ], [ %12, %10 ]
%28 = tail call signext i8 @fgetc(i32* %1)
%29 = load i8, i8* @EOF
%30 = icmp eq i8 %28, %29
br i1 %30, label %31, label %10
31: ; preds = %24, %3
%32 = phi i32 [ 0, %3 ], [ %25, %24 ]
%33 = phi i32 [ 0, %3 ], [ %26, %24 ]
%34 = phi i32 [ 0, %3 ], [ %27, %24 ]
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %34)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %33)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %32)
%38 = sitofp i32 %33 to double
%39 = sitofp i32 %34 to double
%40 = fdiv double %38, %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), double %40)
%42 = tail call i32 @fclose(i32* %1)
%43 = tail call i32 (...) @getchar()
ret i32 0
}