#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 strlen(char *);
int tolower(char);
long int totDic(char *str) {
  int i = 0, ndic = 0, size = strlen(str);
  long int tot = 0;
  for (i = 0; i < 7; i++) {
    switch (tolower(str[i])) {
    case 'o':
      ndic++;
      break;
    case 'i':
      ndic++;
      break;
    case 'e':
      ndic++;
      break;
    case 'a':
      ndic++;
      break;
    case 's':
      ndic++;
      break;
    case 'g':
      ndic++;
      break;
    case 't':
      ndic++;
      break;
    case 'b':
      ndic++;
      break;
    default:
      break;
    }
  }
  return tot;
}


x86 assembly (clang, -O0):
<totDic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    121e <totDic+0xfe>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x13,%eax
ja     1206 <totDic+0xe6>
mov    -0x28(%rbp),%rax
lea    0xe73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <totDic+0xeb>
jmp    120b <totDic+0xeb>
jmp    1210 <totDic+0xf0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <totDic+0x35>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<totDic>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movsbl (%rbx),%edi
call   1040 <tolower@plt>
movsbl 0x1(%rbx),%edi
call   1040 <tolower@plt>
movsbl 0x2(%rbx),%edi
call   1040 <tolower@plt>
movsbl 0x3(%rbx),%edi
call   1040 <tolower@plt>
movsbl 0x4(%rbx),%edi
call   1040 <tolower@plt>
movsbl 0x5(%rbx),%edi
call   1040 <tolower@plt>
movsbl 0x6(%rbx),%edi
call   1040 <tolower@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @totDic(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
store i64 0, i64* %6
store i32 0, i32* %3
br label %9
9: ; preds = %45, %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 7
br i1 %11, label %12, label %48
12: ; preds = %9
%13 = load i8*, i8** %2
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = call i32 @tolower(i8 signext %17)
switch i32 %18, label %43 [
i32 111, label %19
i32 105, label %22
i32 101, label %25
i32 97, label %28
i32 115, label %31
i32 103, label %34
i32 116, label %37
i32 98, label %40
]
19: ; preds = %12
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %44
22: ; preds = %12
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %44
25: ; preds = %12
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %44
28: ; preds = %12
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %44
31: ; preds = %12
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %44
34: ; preds = %12
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %44
37: ; preds = %12
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %44
40: ; preds = %12
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %44
43: ; preds = %12
br label %44
44: ; preds = %43, %40, %37, %34, %31, %28, %25, %22, %19
br label %45
45: ; preds = %44
%46 = load i32, i32* %3
%47 = add nsw i32 %46, 1
store i32 %47, i32* %3
br label %9
48: ; preds = %9
%49 = load i64, i64* %6
ret i64 %49
}

LLVM IR (-O2):
define i64 @totDic(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i8, i8* %0
%4 = tail call i32 @tolower(i8 signext %3)
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @tolower(i8 signext %6)
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
%10 = tail call i32 @tolower(i8 signext %9)
%11 = getelementptr inbounds i8, i8* %0, i64 3
%12 = load i8, i8* %11
%13 = tail call i32 @tolower(i8 signext %12)
%14 = getelementptr inbounds i8, i8* %0, i64 4
%15 = load i8, i8* %14
%16 = tail call i32 @tolower(i8 signext %15)
%17 = getelementptr inbounds i8, i8* %0, i64 5
%18 = load i8, i8* %17
%19 = tail call i32 @tolower(i8 signext %18)
%20 = getelementptr inbounds i8, i8* %0, i64 6
%21 = load i8, i8* %20
%22 = tail call i32 @tolower(i8 signext %21)
ret i64 0
}