#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 /*<<< orphan*/ soundex(char *, char *);
unsigned int hash_soundex(char lastName[]) {
  char output[5];
  soundex(lastName, output);
  unsigned long value = 0;
  value += (output[0] - 97) * 1000;
  value += (output[1] - 48) * 100;
  value += (output[2] - 48) * 10;
  value += (output[3] - 48);
  return value;
}


x86 assembly (clang, -O0):
<hash_soundex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xd(%rbp),%rsi
call   1030 <soundex@plt>
movq   $0x0,-0x18(%rbp)
movsbl -0xd(%rbp),%eax
sub    $0x61,%eax
imul   $0x3e8,%eax,%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl -0xc(%rbp),%eax
sub    $0x30,%eax
imul   $0x64,%eax,%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl -0xb(%rbp),%eax
sub    $0x30,%eax
imul   $0xa,%eax,%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl -0xa(%rbp),%eax
sub    $0x30,%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_soundex>:
push   %rax
lea    0x3(%rsp),%rsi
call   1030 <soundex@plt>
movsbl 0x3(%rsp),%eax
imul   $0x3e8,%eax,%eax
movsbl 0x4(%rsp),%ecx
imul   $0x64,%ecx,%ecx
add    %eax,%ecx
movsbl 0x5(%rsp),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x6(%rsp),%edx
lea    (%rcx,%rax,2),%eax
add    %edx,%eax
add    $0xfffe7048,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hash_soundex(i8* %0) {
%2 = alloca i8*
%3 = alloca [5 x i8]
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = call i32 @soundex(i8* %5, i8* %6)
store i64 0, i64* %4
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %10, 97
%12 = mul nsw i32 %11, 1000
%13 = sext i32 %12 to i64
%14 = load i64, i64* %4
%15 = add i64 %14, %13
store i64 %15, i64* %4
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 48
%20 = mul nsw i32 %19, 100
%21 = sext i32 %20 to i64
%22 = load i64, i64* %4
%23 = add i64 %22, %21
store i64 %23, i64* %4
%24 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 48
%28 = mul nsw i32 %27, 10
%29 = sext i32 %28 to i64
%30 = load i64, i64* %4
%31 = add i64 %30, %29
store i64 %31, i64* %4
%32 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
%36 = sext i32 %35 to i64
%37 = load i64, i64* %4
%38 = add i64 %37, %36
store i64 %38, i64* %4
%39 = load i64, i64* %4
%40 = trunc i64 %39 to i32
ret i32 %40
}

LLVM IR (-O2):
define i32 @hash_soundex(i8* %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = call i32 @soundex(i8* %0, i8* %3)
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = mul nsw i32 %10, 100
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = mul nsw i32 %14, 10
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = add nsw i32 %7, -102328
%20 = add nsw i32 %19, %11
%21 = add nsw i32 %20, %15
%22 = add nsw i32 %21, %18
ret i32 %22
}