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

/* Variables and functions */
int UINT32_MAX;
int htole64(int /*<<< orphan*/);
int /*<<< orphan*/ rgph_xxh32s_finalise(int /*<<< orphan*/ *);
int /*<<< orphan*/ rgph_xxh32s_fmix4(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_u64(uint64_t value, uintptr_t seed) {
  uint32_t h[4];
  rgph_xxh32s_init(sizeof(value), seed, h);
  rgph_xxh32s_fold(sizeof(value), h);
  rgph_xxh32s_fmix4(htole64(value) & UINT32_MAX, h);
  rgph_xxh32s_fmix4(htole64(value) >> 32, h);
  rgph_xxh32s_finalise(h);
  return h[0];
}


x86 assembly (clang, -O0):
<rgph_u32_xxh32s_u64>:
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   1040 <rgph_xxh32s_init@plt>
lea    -0x20(%rbp),%rsi
mov    $0x4,%edi
call   1060 <rgph_xxh32s_fold@plt>
mov    -0x4(%rbp),%edi
call   1070 <htole64@plt>
mov    %eax,%edi
mov    0x2e68(%rip),%rax
and    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1050 <rgph_xxh32s_fmix4@plt>
mov    -0x4(%rbp),%edi
call   1070 <htole64@plt>
mov    %eax,%edi
mov    $0x20,%ecx
sar    %cl,%edi
lea    -0x20(%rbp),%rsi
call   1050 <rgph_xxh32s_fmix4@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_u64>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebp
mov    %rsp,%rbx
mov    $0x4,%edi
mov    %rbx,%rdx
call   1040 <rgph_xxh32s_init@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1060 <rgph_xxh32s_fold@plt>
mov    %ebp,%edi
call   1070 <htole64@plt>
mov    0x2e75(%rip),%rcx
and    (%rcx),%eax
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <rgph_xxh32s_fmix4@plt>
mov    %ebp,%edi
call   1070 <htole64@plt>
mov    %rbx,%rsi
call   1050 <rgph_xxh32s_fmix4@plt>
mov    %rbx,%rdi
call   1030 <rgph_xxh32s_finalise@plt>
mov    (%rsp),%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@UINT32_MAX = global i32 0
define i32 @rgph_u32_xxh32s_u64(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 @htole64(i32 %11)
%13 = load i32, i32* @UINT32_MAX
%14 = and i32 %12, %13
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%16 = call i32 @rgph_xxh32s_fmix4(i32 %14, i32* %15)
%17 = load i32, i32* %3
%18 = call i32 @htole64(i32 %17)
%19 = ashr i32 %18, 32
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%21 = call i32 @rgph_xxh32s_fmix4(i32 %19, i32* %20)
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%23 = call i32 @rgph_xxh32s_finalise(i32* %22)
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%25 = load i32, i32* %24
ret i32 %25
}

LLVM IR (-O2):
@UINT32_MAX = global i32 0
define i32 @rgph_u32_xxh32s_u64(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 @htole64(i32 %0)
%9 = load i32, i32* @UINT32_MAX
%10 = and i32 %9, %8
%11 = call i32 @rgph_xxh32s_fmix4(i32 %10, i32* %5)
%12 = call i32 @htole64(i32 %0)
%13 = call i32 @rgph_xxh32s_fmix4(i32 poison, i32* %5)
%14 = call i32 @rgph_xxh32s_finalise(i32* %5)
%15 = load i32, i32* %5
ret i32 %15
}