#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ hash32_fmix(int /*<<< orphan*/);
int /*<<< orphan*/ hash32_partial_unicode_prefix(int /*<<< orphan*/ *, size_t,
                                                 size_t, size_t);
int /*<<< orphan*/ utf8_decode(int /*<<< orphan*/ *, size_t *, void const *,
                               size_t);
uint32_t hash32_utf8_prefix(const void *p, size_t len, size_t prefix_len,
                            size_t min_stem) {
  uint32_t buf[len];
  size_t buf_len = len;
  utf8_decode(buf, &buf_len, p, len);
  return hash32_fmix(
      hash32_partial_unicode_prefix(buf, buf_len, prefix_len, min_stem));
}


x86 assembly (clang, -O0):
<hash32_utf8_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x38(%rbp),%rsi
call   1050 <utf8_decode@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <hash32_partial_unicode_prefix@plt>
mov    %eax,%edi
call   1040 <hash32_fmix@plt>
mov    -0x28(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash32_utf8_prefix>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    %rsp,%rbx
lea    0xf(,%rsi,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rsi,-0x20(%rbp)
lea    -0x20(%rbp),%rsi
mov    %rbx,%rdi
call   1050 <utf8_decode@plt>
mov    -0x20(%rbp),%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <hash32_partial_unicode_prefix@plt>
mov    %eax,%edi
call   1040 <hash32_fmix@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hash32_utf8_prefix(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%12 = load i64, i64* %6
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %9
%14 = alloca i32, i64 %12
store i64 %12, i64* %10
%15 = load i64, i64* %6
store i64 %15, i64* %11
%16 = load i8*, i8** %5
%17 = load i64, i64* %6
%18 = call i32 @utf8_decode(i32* %14, i64* %11, i8* %16, i64 %17)
%19 = load i64, i64* %11
%20 = load i64, i64* %7
%21 = load i64, i64* %8
%22 = call i32 @hash32_partial_unicode_prefix(i32* %14, i64 %19, i64 %20, i64 %21)
%23 = call i32 @hash32_fmix(i32 %22)
%24 = load i8*, i8** %9
ret i32 %23
}

LLVM IR (-O2):
define i32 @hash32_utf8_prefix(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i32, i64 %1
%7 = bitcast i64* %5 to i8*
store i64 %1, i64* %5
%8 = call i32 @utf8_decode(i32* %6, i64* %5, i8* %0, i64 %1)
%9 = load i64, i64* %5
%10 = call i32 @hash32_partial_unicode_prefix(i32* %6, i64 %9, i64 %2, i64 %3)
%11 = call i32 @hash32_fmix(i32 %10)
ret i32 %11
}