#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*/ printf(char *, ...);
unsigned Vec_IntUniqueHashKeyDebug(unsigned char *pStr, int nChars,
                                   int TableMask) {
  static unsigned s_BigPrimes[4] = {12582917, 25165843, 50331653, 100663319};
  unsigned Key = 0;
  int c;
  for (c = 0; c < nChars; c++) {
    Key += (unsigned)pStr[c] * s_BigPrimes[c & 3];
    printf("%d : ", c);
    printf("%3d  ", pStr[c]);
    printf("%12u ", Key);
    printf("%12u ", Key & TableMask);
    printf("\n");
  }
  return Key;
}


x86 assembly (clang, -O0):
<Vec_IntUniqueHashKeyDebug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ce <Vec_IntUniqueHashKeyDebug+0xbe>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%ecx
and    $0x3,%ecx
movslq %ecx,%rdx
lea    0x2ed8(%rip),%rcx
imul   (%rcx,%rdx,4),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
and    -0x10(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1130 <Vec_IntUniqueHashKeyDebug+0x20>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vec_IntUniqueHashKeyDebug>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    11bc <Vec_IntUniqueHashKeyDebug+0x9c>
mov    %edx,%r15d
mov    %rdi,%rbx
mov    %esi,%r12d
lea    0xed9(%rip),%r13
xor    %r14d,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movzbl (%rbx,%r14,1),%eax
mov    %r14d,%ecx
and    $0x3,%ecx
lea    0xe9e(%rip),%rdx
imul   (%rdx,%rcx,4),%eax
add    %eax,%ebp
lea    0xea1(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%rbx,%r14,1),%esi
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%esi
and    %r15d,%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    %r14,%r12
jne    1150 <Vec_IntUniqueHashKeyDebug+0x30>
jmp    11be <Vec_IntUniqueHashKeyDebug+0x9e>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@Vec_IntUniqueHashKeyDebug.s_BigPrimes = internal global [4 x i32] [i32 12582917, i32 25165843, i32 50331653, i32 100663319]
@.str = [6 x i8] c"%d : \00"
@.str.1 = [6 x i8] c"%3d \00"
@.str.2 = [6 x i8] c"%12u \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @Vec_IntUniqueHashKeyDebug(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %44, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %47
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = load i32, i32* %8
%21 = and i32 %20, 3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [4 x i32], [4 x i32]* @Vec_IntUniqueHashKeyDebug.s_BigPrimes, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = mul i32 %19, %24
%26 = load i32, i32* %7
%27 = add i32 %26, %25
store i32 %27, i32* %7
%28 = load i32, i32* %8
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i8*, i8** %4
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %7
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = and i32 %39, %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %13
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %9
47: ; preds = %9
%48 = load i32, i32* %7
ret i32 %48
}

LLVM IR (-O2):
@Vec_IntUniqueHashKeyDebug.s_BigPrimes = internal unnamed_addr constant [4 x i32] [i32 12582917, i32 25165843, i32 50331653, i32 100663319]
@.str = [6 x i8] c"%d : \00"
@.str.1 = [6 x i8] c"%3d \00"
@.str.2 = [6 x i8] c"%12u \00"
define i32 @Vec_IntUniqueHashKeyDebug(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %29
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %27, %7 ]
%9 = phi i32 [ 0, %5 ], [ %18, %7 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %8
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = trunc i64 %8 to i32
%14 = and i64 %8, 3
%15 = getelementptr inbounds [4 x i32], [4 x i32]* @Vec_IntUniqueHashKeyDebug.s_BigPrimes, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = mul i32 %16, %12
%18 = add i32 %17, %9
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %13)
%20 = load i8, i8* %10
%21 = zext i8 %20 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%24 = and i32 %18, %2
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = tail call i32 @putchar(i32 10)
%27 = add nuw nsw i64 %8, 1
%28 = icmp eq i64 %27, %6
br i1 %28, label %29, label %7
29: ; preds = %7, %3
%30 = phi i32 [ 0, %3 ], [ %18, %7 ]
ret i32 %30
}