#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*/ assert(int);
scalar_t__ string_hash(char *);
void test_string_hash(void) {
  char test1[] = "this is a test";
  char test2[] = "this is a tesu";
  char test3[] = "this is a test ";
  char test4[] = "this is a test";
  char test5[] = "This is a test";
  assert(string_hash(test1) != string_hash(test2));
  assert(string_hash(test1) != string_hash(test3));
  assert(string_hash(test1) != string_hash(test5));
  assert(string_hash(test1) == string_hash(test4));
}


x86 assembly (clang, -O0):
<test_string_hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xecf(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xec9(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xec1(%rip),%al
mov    %al,-0x1(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeb0(%rip),%ax
mov    %ax,-0x12(%rbp)
mov    0xea8(%rip),%al
mov    %al,-0x10(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe6b(%rip),%rax
mov    %rax,-0x3f(%rbp)
mov    0xe69(%rip),%eax
mov    %eax,-0x37(%rbp)
mov    0xe63(%rip),%ax
mov    %ax,-0x33(%rbp)
mov    0xe5b(%rip),%al
mov    %al,-0x31(%rbp)
mov    0xe61(%rip),%rax
mov    %rax,-0x4e(%rbp)
mov    0xe5f(%rip),%eax
mov    %eax,-0x46(%rbp)
mov    0xe59(%rip),%ax
mov    %ax,-0x42(%rbp)
mov    0xe51(%rip),%al
mov    %al,-0x40(%rbp)
lea    -0xf(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,-0x70(%rbp)
lea    -0x1e(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0xf(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,-0x68(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0xf(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,-0x60(%rbp)
lea    -0x4e(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0xf(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,-0x58(%rbp)
lea    -0x3f(%rbp),%rdi
call   1030 <string_hash@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_string_hash>:
push   %r14
push   %rbx
sub    $0x58,%rsp
movabs $0x74736574206120,%rax
mov    %rax,0x37(%rsp)
movabs $0x2073692073696874,%rcx
69 73 20
mov    %rcx,0x30(%rsp)
movabs $0x75736574206120,%rdx
mov    %rdx,0x27(%rsp)
mov    %rcx,0x20(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
mov    %rax,0x17(%rsp)
mov    %rcx,0x10(%rsp)
mov    %rax,0x7(%rsp)
movabs $0x2073692073696854,%rax
69 73 20
mov    %rax,(%rsp)
lea    0x30(%rsp),%r14
mov    %r14,%rdi
call   1030 <string_hash@plt>
mov    %rax,%rbx
lea    0x20(%rsp),%rdi
call   1030 <string_hash@plt>
xor    %edi,%edi
cmp    %rax,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %r14,%rdi
call   1030 <string_hash@plt>
mov    %rax,%rbx
lea    0x40(%rsp),%rdi
call   1030 <string_hash@plt>
xor    %edi,%edi
cmp    %rax,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %r14,%rdi
call   1030 <string_hash@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
call   1030 <string_hash@plt>
xor    %edi,%edi
cmp    %rax,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %r14,%rdi
call   1030 <string_hash@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
call   1030 <string_hash@plt>
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1040 <assert@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.test_string_hash.test1 = [15 x i8] c"this is a test\00"
@__const.test_string_hash.test2 = [15 x i8] c"this is a tesu\00"
@__const.test_string_hash.test3 = [16 x i8] c"this is a test \00"
@__const.test_string_hash.test4 = [15 x i8] c"this is a test\00"
@__const.test_string_hash.test5 = [15 x i8] c"This is a test\00"
define void @test_string_hash() {
%1 = alloca [15 x i8]
%2 = alloca [15 x i8]
%3 = alloca [16 x i8]
%4 = alloca [15 x i8]
%5 = alloca [15 x i8]
%6 = bitcast [15 x i8]* %1 to i8*
%7 = bitcast [15 x i8]* %2 to i8*
%8 = bitcast [16 x i8]* %3 to i8*
%9 = bitcast [15 x i8]* %4 to i8*
%10 = bitcast [15 x i8]* %5 to i8*
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%12 = call i64 @string_hash(i8* %11)
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%14 = call i64 @string_hash(i8* %13)
%15 = icmp ne i64 %12, %14
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%19 = call i64 @string_hash(i8* %18)
%20 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%21 = call i64 @string_hash(i8* %20)
%22 = icmp ne i64 %19, %21
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%26 = call i64 @string_hash(i8* %25)
%27 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%28 = call i64 @string_hash(i8* %27)
%29 = icmp ne i64 %26, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%33 = call i64 @string_hash(i8* %32)
%34 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%35 = call i64 @string_hash(i8* %34)
%36 = icmp eq i64 %33, %35
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
ret void
}

LLVM IR (-O2):
@__const.test_string_hash.test2 = [15 x i8] c"this is a tesu\00"
@__const.test_string_hash.test3 = [16 x i8] c"this is a test \00"
@__const.test_string_hash.test4 = [15 x i8] c"this is a test\00"
@__const.test_string_hash.test5 = [15 x i8] c"This is a test\00"
define void @test_string_hash() {
%1 = alloca [15 x i8]
%2 = alloca [15 x i8]
%3 = alloca [16 x i8]
%4 = alloca [15 x i8]
%5 = alloca [15 x i8]
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%11 = call i64 @string_hash(i8* %6)
%12 = call i64 @string_hash(i8* %7)
%13 = icmp ne i64 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = call i64 @string_hash(i8* %6)
%17 = call i64 @string_hash(i8* %8)
%18 = icmp ne i64 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i64 @string_hash(i8* %6)
%22 = call i64 @string_hash(i8* %10)
%23 = icmp ne i64 %21, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i64 @string_hash(i8* %6)
%27 = call i64 @string_hash(i8* %9)
%28 = icmp eq i64 %26, %27
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
ret void
}