#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 */
unsigned int usl_hash_end_name(unsigned long);
unsigned long usl_hash_partial_name(int /*<<< orphan*/, unsigned long);
unsigned int usl_hash_full_name(const unsigned char *name, unsigned int len) {
  unsigned long hash = 0;
  while (len--) {
    hash = usl_hash_partial_name(*name++, hash);
  }
  return usl_hash_end_name(hash);
}


x86 assembly (clang, -O0):
<usl_hash_full_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     116f <usl_hash_full_name+0x4f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edi
mov    -0x18(%rbp),%rsi
call   1040 <usl_hash_partial_name@plt>
mov    %rax,-0x18(%rbp)
jmp    1137 <usl_hash_full_name+0x17>
mov    -0x18(%rbp),%rdi
call   1030 <usl_hash_end_name@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usl_hash_full_name>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1158 <usl_hash_full_name+0x38>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%r14,%rbx,1),%edi
mov    %rax,%rsi
call   1040 <usl_hash_partial_name@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1140 <usl_hash_full_name+0x20>
jmp    115a <usl_hash_full_name+0x3a>
xor    %eax,%eax
mov    %rax,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <usl_hash_end_name@plt>

LLVM IR (-O0):
define i32 @usl_hash_full_name(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
store i8* %0, i8** %3
store i32 %1, i32* %4
store i64 0, i64* %5
br label %6
6: ; preds = %10, %2
%7 = load i32, i32* %4
%8 = add i32 %7, -1
store i32 %8, i32* %4
%9 = icmp ne i32 %7, 0
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = zext i8 %13 to i32
%15 = load i64, i64* %5
%16 = call i64 @usl_hash_partial_name(i32 %14, i64 %15)
store i64 %16, i64* %5
br label %6
17: ; preds = %6
%18 = load i64, i64* %5
%19 = call i32 @usl_hash_end_name(i64 %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @usl_hash_full_name(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %12, %4 ], [ 0, %2 ]
%6 = phi i32 [ %8, %4 ], [ %1, %2 ]
%7 = phi i8* [ %9, %4 ], [ %0, %2 ]
%8 = add i32 %6, -1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %7
%11 = zext i8 %10 to i32
%12 = tail call i64 @usl_hash_partial_name(i32 %11, i64 %5)
%13 = icmp eq i32 %8, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %2
%15 = phi i64 [ 0, %2 ], [ %12, %4 ]
%16 = tail call i32 @usl_hash_end_name(i64 %15)
ret i32 %16
}