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

/* Variables and functions */
int htole16(int /*<<< orphan*/);
int /*<<< orphan*/ rgph_xxh32s_finalise(int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh32s_fmix1(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh32s_fold(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh32s_init(int, uintptr_t, int /*<<< orphan*/ *);
uint32_t rgph_u32_xxh32s_u16(uint16_t value, uintptr_t seed) {
  uint32_t h[4];
  rgph_xxh32s_init(sizeof(value), seed, h);
  rgph_xxh32s_fold(sizeof(value), h);
  rgph_xxh32s_fmix1(htole16(value) & 0xff, h);
  rgph_xxh32s_fmix1(htole16(value) >> 8, h);
  rgph_xxh32s_finalise(h);
  return h[0];
}


x86 assembly (clang, -O0):
<rgph_u32_xxh32s_u16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    $0x4,%edi
call   1050 <rgph_xxh32s_init@plt>
lea    -0x20(%rbp),%rsi
mov    $0x4,%edi
call   1060 <rgph_xxh32s_fold@plt>
mov    -0x4(%rbp),%edi
call   1040 <htole16@plt>
mov    %eax,%edi
and    $0xff,%edi
lea    -0x20(%rbp),%rsi
call   1070 <rgph_xxh32s_fmix1@plt>
mov    -0x4(%rbp),%edi
call   1040 <htole16@plt>
mov    %eax,%edi
sar    $0x8,%edi
lea    -0x20(%rbp),%rsi
call   1070 <rgph_xxh32s_fmix1@plt>
lea    -0x20(%rbp),%rdi
call   1030 <rgph_xxh32s_finalise@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u32_xxh32s_u16>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
mov    %rsp,%rbx
mov    $0x4,%edi
mov    %rbx,%rdx
call   1050 <rgph_xxh32s_init@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1060 <rgph_xxh32s_fold@plt>
mov    %ebp,%edi
call   1040 <htole16@plt>
movzbl %al,%edi
mov    %rbx,%rsi
call   1070 <rgph_xxh32s_fmix1@plt>
mov    %ebp,%edi
call   1040 <htole16@plt>
sar    $0x8,%eax
mov    %eax,%edi
mov    %rbx,%rsi
call   1070 <rgph_xxh32s_fmix1@plt>
mov    %rbx,%rdi
call   1030 <rgph_xxh32s_finalise@plt>
mov    (%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rgph_u32_xxh32s_u16(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca [4 x i32]
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%8 = call i32 @rgph_xxh32s_init(i32 4, i64 %6, i32* %7)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%10 = call i32 @rgph_xxh32s_fold(i32 4, i32* %9)
%11 = load i32, i32* %3
%12 = call i32 @htole16(i32 %11)
%13 = and i32 %12, 255
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%15 = call i32 @rgph_xxh32s_fmix1(i32 %13, i32* %14)
%16 = load i32, i32* %3
%17 = call i32 @htole16(i32 %16)
%18 = ashr i32 %17, 8
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%20 = call i32 @rgph_xxh32s_fmix1(i32 %18, i32* %19)
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%22 = call i32 @rgph_xxh32s_finalise(i32* %21)
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%24 = load i32, i32* %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @rgph_u32_xxh32s_u16(i32 %0, i64 %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%6 = call i32 @rgph_xxh32s_init(i32 4, i64 %1, i32* %5)
%7 = call i32 @rgph_xxh32s_fold(i32 4, i32* %5)
%8 = call i32 @htole16(i32 %0)
%9 = and i32 %8, 255
%10 = call i32 @rgph_xxh32s_fmix1(i32 %9, i32* %5)
%11 = call i32 @htole16(i32 %0)
%12 = ashr i32 %11, 8
%13 = call i32 @rgph_xxh32s_fmix1(i32 %12, i32* %5)
%14 = call i32 @rgph_xxh32s_finalise(i32* %5)
%15 = load i32, i32* %5
ret i32 %15
}