void test_hash_function_same() {
  char *one = "test";
  char *two = "test";
  assert(&one != &two);
  assert(default_hash(&one, 20) == default_hash(&two, 20));
  assert(default_hash(one, 20) == default_hash("test", 20));
}


x86 assembly (clang, -O0):
<test_hash_function_same>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xec6(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rax
lea    -0x10(%rbp),%rcx
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
lea    -0x8(%rbp),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <default_hash@plt>
mov    %eax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <default_hash@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <default_hash@plt>
mov    %eax,-0x14(%rbp)
lea    0xe55(%rip),%rdi
mov    $0x14,%esi
mov    $0x0,%al
call   1030 <default_hash@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hash_function_same>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xed3(%rip),%rbx
mov    %rbx,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <assert@plt>
lea    0x8(%rsp),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <default_hash@plt>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <default_hash@plt>
xor    %edi,%edi
cmp    %eax,%ebp
sete   %dil
xor    %eax,%eax
call   1040 <assert@plt>
mov    0x8(%rsp),%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <default_hash@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    $0x14,%esi
xor    %eax,%eax
call   1030 <default_hash@plt>
xor    %edi,%edi
cmp    %eax,%ebp
sete   %dil
xor    %eax,%eax
call   1040 <assert@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"test\00"
define void @test_hash_function_same() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = icmp ne i8** %1, %2
%4 = zext i1 %3 to i32
%5 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %4)
%6 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8**, i32, ...)*)(i8** %1, i32 20)
%7 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8**, i32, ...)*)(i8** %2, i32 20)
%8 = icmp eq i32 %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %9)
%11 = load i8*, i8** %1
%12 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8*, i32, ...)*)(i8* %11, i32 20)
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 20)
%14 = icmp eq i32 %12, %13
%15 = zext i1 %14 to i32
%16 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define void @test_hash_function_same() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = bitcast i8** %2 to i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%6 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8**, i32, ...)*)(i8** %1, i32 20)
%7 = call i32 (i8**, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8**, i32, ...)*)(i8** %2, i32 20)
%8 = icmp eq i32 %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %9)
%11 = load i8*, i8** %1
%12 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8*, i32, ...)*)(i8* %11, i32 20)
%13 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @default_hash to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 20)
%14 = icmp eq i32 %12, %13
%15 = zext i1 %14 to i32
%16 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %15)
ret void
}