#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 APHash(char *);
int BKDRHash(char *);
int DJBHash(char *);
int ELFHash(char *);
int JSHash(char *);
int PJWHash(char *);
int RSHash(char *);
int SDBMHash(char *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int, int);
int main() {
  char *str = "Hello, world!\n";
  printf("%#010x\n%#010x\n%#010x\n%#010x\n%#010x\n%#010x\n%#010x\n%#010x\n",
         APHash(str), DJBHash(str), BKDRHash(str), ELFHash(str), SDBMHash(str),
         JSHash(str), PJWHash(str), RSHash(str));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe5a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <APHash@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <DJBHash@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   10b0 <BKDRHash@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <ELFHash@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   10a0 <SDBMHash@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <JSHash@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <PJWHash@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <RSHash@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    -0x14(%rbp),%r10d
lea    0xde8(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe5e(%rip),%rbx
mov    %rbx,%rdi
call   1070 <APHash@plt>
mov    %eax,0x4(%rsp)
mov    %rbx,%rdi
call   1080 <DJBHash@plt>
mov    %eax,(%rsp)
mov    %rbx,%rdi
call   10b0 <BKDRHash@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1040 <ELFHash@plt>
mov    %eax,%r13d
mov    %rbx,%rdi
call   10a0 <SDBMHash@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <JSHash@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1050 <PJWHash@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1090 <RSHash@plt>
sub    $0x8,%rsp
lea    0xe0d(%rip),%rdi
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %ebp,%r9d
push   %rax
push   %r15
push   %r14
call   1030 <printf@plt>
add    $0x20,%rsp
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, world!\0A\00"
@.str.1 = [57 x i8] c"%x\0A%x\0A%x\0A%x\0A%x\0A%x\0A%x\0A%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @APHash(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @DJBHash(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @BKDRHash(i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @ELFHash(i8* %9)
%11 = load i8*, i8** %2
%12 = call i32 @SDBMHash(i8* %11)
%13 = load i8*, i8** %2
%14 = call i32 @JSHash(i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 @PJWHash(i8* %15)
%17 = load i8*, i8** %2
%18 = call i32 @RSHash(i8* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16, i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, world!\0A\00"
@.str.1 = [57 x i8] c"%x\0A%x\0A%x\0A%x\0A%x\0A%x\0A%x\0A%x\0A\00"
define i32 @main() {
%1 = tail call i32 @APHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @DJBHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @BKDRHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @ELFHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @SDBMHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @JSHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @PJWHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @RSHash(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8)
ret i32 0
}