#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 */
unsigned int char_value(char);
unsigned int email_hash(char *_email) {
  unsigned int hash;
  hash = 40 * 40 * char_value(_email[0]);
  if (_email[1] != '@')
    hash += 40 * char_value(_email[1]);
  if (_email[2] != '@')
    hash += char_value(_email[2]);
  return hash;
}


x86 assembly (clang, -O0):
<email_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <char_value@plt>
imul   $0x640,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x40,%eax
je     1158 <email_hash+0x48>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <char_value@plt>
imul   $0x28,%eax,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x40,%eax
je     117c <email_hash+0x6c>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <char_value@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<email_hash>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <char_value@plt>
imul   $0x640,%eax,%r14d
mov    0x1(%rbx),%al
cmp    $0x40,%al
je     113c <email_hash+0x2c>
movsbl %al,%edi
call   1030 <char_value@plt>
lea    (%rax,%rax,4),%eax
lea    (%r14,%rax,8),%r14d
mov    0x2(%rbx),%al
cmp    $0x40,%al
je     1151 <email_hash+0x41>
movsbl %al,%edi
call   1030 <char_value@plt>
add    %r14d,%eax
mov    %eax,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @email_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = call i32 @char_value(i8 signext %6)
%8 = mul i32 1600, %7
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 64
br i1 %13, label %14, label %22
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = call i32 @char_value(i8 signext %17)
%19 = mul i32 40, %18
%20 = load i32, i32* %3
%21 = add i32 %20, %19
store i32 %21, i32* %3
br label %22
22: ; preds = %14, %1
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 2
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 64
br i1 %27, label %28, label %35
28: ; preds = %22
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 2
%31 = load i8, i8* %30
%32 = call i32 @char_value(i8 signext %31)
%33 = load i32, i32* %3
%34 = add i32 %33, %32
store i32 %34, i32* %3
br label %35
35: ; preds = %28, %22
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
define i32 @email_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @char_value(i8 signext %2)
%4 = mul i32 %3, 1600
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 64
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = tail call i32 @char_value(i8 signext %6)
%10 = mul i32 %9, 40
%11 = add i32 %10, %4
br label %12
12: ; preds = %8, %1
%13 = phi i32 [ %11, %8 ], [ %4, %1 ]
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 64
br i1 %16, label %20, label %17
17: ; preds = %12
%18 = tail call i32 @char_value(i8 signext %15)
%19 = add i32 %18, %13
br label %20
20: ; preds = %17, %12
%21 = phi i32 [ %19, %17 ], [ %13, %12 ]
ret i32 %21
}