#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 toupper(char const);
int compute_vowel_count(const char *sentence) {
  int letter = 0;
  int vowels = 0;
  while (sentence[letter] != '\n') {
    switch (toupper(sentence[letter])) {
    case 'A':
    case 'E':
    case 'I':
    case 'O':
    case 'U':
      vowels += 1;
      break;
    }
    letter += 1;
  }
  return vowels;
}


x86 assembly (clang, -O0):
<compute_vowel_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     11be <compute_vowel_count+0xae>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x41,%eax
je     11a7 <compute_vowel_count+0x97>
jmp    1163 <compute_vowel_count+0x53>
mov    -0x14(%rbp),%eax
sub    $0x45,%eax
je     11a7 <compute_vowel_count+0x97>
jmp    1174 <compute_vowel_count+0x64>
mov    -0x14(%rbp),%eax
sub    $0x49,%eax
je     11a7 <compute_vowel_count+0x97>
jmp    1185 <compute_vowel_count+0x75>
mov    -0x14(%rbp),%eax
sub    $0x4f,%eax
je     11a7 <compute_vowel_count+0x97>
jmp    1196 <compute_vowel_count+0x86>
mov    -0x14(%rbp),%eax
sub    $0x55,%eax
jne    11b0 <compute_vowel_count+0xa0>
jmp    11a7 <compute_vowel_count+0x97>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <compute_vowel_count+0x1a>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_vowel_count>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
xor    %ebp,%ebp
cmp    $0xa,%al
jne    1123 <compute_vowel_count+0x13>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
mov    $0x495,%r14d
jmp    114b <compute_vowel_count+0x3b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx),%eax
add    $0x1,%rbx
cmp    $0xa,%al
je     111c <compute_vowel_count+0xc>
movsbl %al,%edi
call   1030 <toupper@plt>
add    $0xffffffbf,%eax
ror    %eax
cmp    $0xa,%eax
ja     1140 <compute_vowel_count+0x30>
bt     %eax,%r14d
jae    1140 <compute_vowel_count+0x30>
add    $0x1,%ebp
jmp    1140 <compute_vowel_count+0x30>

LLVM IR (-O0):
define i32 @compute_vowel_count(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %26
13: ; preds = %5
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call i32 @toupper(i8 signext %18)
switch i32 %19, label %23 [
i32 65, label %20
i32 69, label %20
i32 73, label %20
i32 79, label %20
i32 85, label %20
]
20: ; preds = %13, %13, %13, %13, %13
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %23
23: ; preds = %13, %20
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @compute_vowel_count(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 10
br i1 %3, label %19, label %4
4: ; preds = %1, %13
%5 = phi i64 [ %15, %13 ], [ 0, %1 ]
%6 = phi i8 [ %17, %13 ], [ %2, %1 ]
%7 = phi i32 [ %14, %13 ], [ 0, %1 ]
%8 = tail call i32 @toupper(i8 signext %6)
%9 = add i32 %8, -65
%10 = tail call i32 @llvm.fshl.i32(i32 %9, i32 %9, i32 31)
switch i32 %10, label %13 [
i32 0, label %11
i32 2, label %11
i32 4, label %11
i32 7, label %11
i32 10, label %11
]
11: ; preds = %4, %4, %4, %4, %4
%12 = add nsw i32 %7, 1
br label %13
13: ; preds = %4, %11
%14 = phi i32 [ %7, %4 ], [ %12, %11 ]
%15 = add nuw i64 %5, 1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 10
br i1 %18, label %19, label %4
19: ; preds = %13, %1
%20 = phi i32 [ 0, %1 ], [ %14, %13 ]
ret i32 %20
}