#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 */
scalar_t__ strlen(char const *);
int tolower(char const);
int getHashEstranhoParaEMails(const char *email) {
  int value = 0;
  int i = 0;
  if (!email || strlen(email) == 0) {
    return -1;
  }
  while (email[i] != '\0') {
    int c = tolower(email[i++]);
    if ((c >= 'a') && (c <= 'z')) {
      value ^= (c - 'a');
    }
  }
  return value;
}


x86 assembly (clang, -O0):
<getHashEstranhoParaEMails>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1158 <getHashEstranhoParaEMails+0x38>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1164 <getHashEstranhoParaEMails+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c7 <getHashEstranhoParaEMails+0xa7>
jmp    1169 <getHashEstranhoParaEMails+0x49>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11c1 <getHashEstranhoParaEMails+0xa1>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x61,-0x1c(%rbp)
jl     11bc <getHashEstranhoParaEMails+0x9c>
cmpl   $0x7a,-0x1c(%rbp)
jg     11bc <getHashEstranhoParaEMails+0x9c>
mov    -0x1c(%rbp),%eax
sub    $0x61,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <getHashEstranhoParaEMails+0x49>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHashEstranhoParaEMails>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     114f <getHashEstranhoParaEMails+0x3f>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     114f <getHashEstranhoParaEMails+0x3f>
add    $0x1,%rbx
xor    %r14d,%r14d
xor    %ebp,%ebp
movsbl %al,%edi
call   1030 <tolower@plt>
add    $0xffffff9f,%eax
cmp    $0x1a,%eax
cmovae %r14d,%eax
xor    %eax,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <getHashEstranhoParaEMails+0x20>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getHashEstranhoParaEMails(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strlen(i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9, %1
store i32 -1, i32* %2
br label %44
14: ; preds = %9
br label %15
15: ; preds = %41, %14
%16 = load i8*, i8** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %42
23: ; preds = %15
%24 = load i8*, i8** %3
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
%29 = load i8, i8* %28
%30 = call i32 @tolower(i8 signext %29)
store i32 %30, i32* %6
%31 = load i32, i32* %6
%32 = icmp sge i32 %31, 97
br i1 %32, label %33, label %41
33: ; preds = %23
%34 = load i32, i32* %6
%35 = icmp sle i32 %34, 122
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i32, i32* %6
%38 = sub nsw i32 %37, 97
%39 = load i32, i32* %4
%40 = xor i32 %39, %38
store i32 %40, i32* %4
br label %41
41: ; preds = %36, %33, %23
br label %15
42: ; preds = %15
%43 = load i32, i32* %4
store i32 %43, i32* %2
br label %44
44: ; preds = %42, %13
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @getHashEstranhoParaEMails(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %10, %6 ], [ 0, %3 ]
%8 = phi i8 [ %17, %6 ], [ %4, %3 ]
%9 = phi i32 [ %15, %6 ], [ 0, %3 ]
%10 = add nuw i64 %7, 1
%11 = tail call i32 @tolower(i8 signext %8)
%12 = add i32 %11, -97
%13 = icmp ult i32 %12, 26
%14 = select i1 %13, i32 %12, i32 0
%15 = xor i32 %14, %9
%16 = getelementptr inbounds i8, i8* %0, i64 %10
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %6
19: ; preds = %6, %1, %3
%20 = phi i32 [ -1, %3 ], [ -1, %1 ], [ %15, %6 ]
ret i32 %20
}