; LLVM IR from Softmotions/iowow :: src/utils (murmur3)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
define dso_local void @murmur3_x86_32(ptr noundef %0, i64 noundef %1, i32 noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !11
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %19, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %20 = load i64, ptr %6, align 8, !tbaa !9
  %21 = udiv i64 %20, 4
  store i64 %21, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %22 = load i32, ptr %7, align 4, !tbaa !11
  store i32 %22, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 -862048943, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 461845907, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = load i64, ptr %10, align 8, !tbaa !9
  %25 = mul i64 %24, 4
  %26 = getelementptr inbounds i8, ptr %23, i64 %25
  store ptr %26, ptr %15, align 8, !tbaa !5
  %27 = load i64, ptr %10, align 8, !tbaa !9
  %28 = sub i64 0, %27
  store i64 %28, ptr %11, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %52, %4
  %30 = load i64, ptr %11, align 8, !tbaa !9
  %31 = icmp ne i64 %30, 0
  br i1 %31, label %32, label %55

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %33 = load ptr, ptr %15, align 8, !tbaa !5
  %34 = load i64, ptr %11, align 8, !tbaa !9
  %35 = call i32 @getblock32(ptr noundef %33, i64 noundef %34)
  store i32 %35, ptr %16, align 4, !tbaa !11
  %36 = load i32, ptr %13, align 4, !tbaa !11
  %37 = load i32, ptr %16, align 4, !tbaa !11
  %38 = mul i32 %37, %36
  store i32 %38, ptr %16, align 4, !tbaa !11
  %39 = load i32, ptr %16, align 4, !tbaa !11
  %40 = call i32 @rotl32(i32 noundef %39, i8 noundef signext 15)
  store i32 %40, ptr %16, align 4, !tbaa !11
  %41 = load i32, ptr %14, align 4, !tbaa !11
  %42 = load i32, ptr %16, align 4, !tbaa !11
  %43 = mul i32 %42, %41
  store i32 %43, ptr %16, align 4, !tbaa !11
  %44 = load i32, ptr %16, align 4, !tbaa !11
  %45 = load i32, ptr %12, align 4, !tbaa !11
  %46 = xor i32 %45, %44
  store i32 %46, ptr %12, align 4, !tbaa !11
  %47 = load i32, ptr %12, align 4, !tbaa !11
  %48 = call i32 @rotl32(i32 noundef %47, i8 noundef signext 13)
  store i32 %48, ptr %12, align 4, !tbaa !11
  %49 = load i32, ptr %12, align 4, !tbaa !11
  %50 = mul i32 %49, 5
  %51 = add i32 %50, -430675100
  store i32 %51, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %52

52:                                               ; preds = %32
  %53 = load i64, ptr %11, align 8, !tbaa !9
  %54 = add i64 %53, 1
  store i64 %54, ptr %11, align 8, !tbaa !9
  br label %29, !llvm.loop !13

55:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load i64, ptr %10, align 8, !tbaa !9
  %58 = mul i64 %57, 4
  %59 = getelementptr inbounds i8, ptr %56, i64 %58
  store ptr %59, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i32 0, ptr %18, align 4, !tbaa !11
  %60 = load i64, ptr %6, align 8, !tbaa !9
  %61 = and i64 %60, 3
  switch i64 %61, label %96 [
    i64 3, label %62
    i64 2, label %70
    i64 1, label %78
  ]

62:                                               ; preds = %55
  %63 = load ptr, ptr %17, align 8, !tbaa !5
  %64 = getelementptr inbounds i8, ptr %63, i64 2
  %65 = load i8, ptr %64, align 1, !tbaa !15
  %66 = zext i8 %65 to i32
  %67 = shl i32 %66, 16
  %68 = load i32, ptr %18, align 4, !tbaa !11
  %69 = xor i32 %68, %67
  store i32 %69, ptr %18, align 4, !tbaa !11
  br label %70

70:                                               ; preds = %62, %55
  %71 = load ptr, ptr %17, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 1
  %73 = load i8, ptr %72, align 1, !tbaa !15
  %74 = zext i8 %73 to i32
  %75 = shl i32 %74, 8
  %76 = load i32, ptr %18, align 4, !tbaa !11
  %77 = xor i32 %76, %75
  store i32 %77, ptr %18, align 4, !tbaa !11
  br label %78

78:                                               ; preds = %70, %55
  %79 = load ptr, ptr %17, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 0
  %81 = load i8, ptr %80, align 1, !tbaa !15
  %82 = zext i8 %81 to i32
  %83 = load i32, ptr %18, align 4, !tbaa !11
  %84 = xor i32 %83, %82
  store i32 %84, ptr %18, align 4, !tbaa !11
  %85 = load i32, ptr %13, align 4, !tbaa !11
  %86 = load i32, ptr %18, align 4, !tbaa !11
  %87 = mul i32 %86, %85
  store i32 %87, ptr %18, align 4, !tbaa !11
  %88 = load i32, ptr %18, align 4, !tbaa !11
  %89 = call i32 @rotl32(i32 noundef %88, i8 noundef signext 15)
  store i32 %89, ptr %18, align 4, !tbaa !11
  %90 = load i32, ptr %14, align 4, !tbaa !11
  %91 = load i32, ptr %18, align 4, !tbaa !11
  %92 = mul i32 %91, %90
  store i32 %92, ptr %18, align 4, !tbaa !11
  %93 = load i32, ptr %18, align 4, !tbaa !11
  %94 = load i32, ptr %12, align 4, !tbaa !11
  %95 = xor i32 %94, %93
  store i32 %95, ptr %12, align 4, !tbaa !11
  br label %96

96:                                               ; preds = %78, %55
  %97 = load i64, ptr %6, align 8, !tbaa !9
  %98 = trunc i64 %97 to i32
  %99 = load i32, ptr %12, align 4, !tbaa !11
  %100 = xor i32 %99, %98
  store i32 %100, ptr %12, align 4, !tbaa !11
  %101 = load i32, ptr %12, align 4, !tbaa !11
  %102 = call i32 @fmix32(i32 noundef %101)
  store i32 %102, ptr %12, align 4, !tbaa !11
  %103 = load i32, ptr %12, align 4, !tbaa !11
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %103, ptr %104, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @getblock32(ptr noundef, i64 noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @rotl32(i32 noundef, i8 noundef signext) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @fmix32(i32 noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!7, !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
define dso_local void @murmur3_x86_32(ptr noundef %0, i64 noundef %1, i32 noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %5 = and i64 %1, -4
  %6 = getelementptr inbounds i8, ptr %0, i64 %5
  %.not42 = icmp ult i64 %1, 4
  br i1 %.not42, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %4
  %7 = lshr i64 %1, 2
  %8 = sub nsw i64 0, %7
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.03944 = phi i64 [ %17, %.lr.ph ], [ %8, %.lr.ph.preheader ]
  %.04043 = phi i32 [ %16, %.lr.ph ], [ %2, %.lr.ph.preheader ]
  %9 = tail call i32 @getblock32(ptr noundef %6, i64 noundef %.03944)
  %10 = mul i32 %9, -862048943
  %11 = tail call i32 @rotl32(i32 noundef %10, i8 noundef signext 15)
  %12 = mul i32 %11, 461845907
  %13 = xor i32 %12, %.04043
  %14 = tail call i32 @rotl32(i32 noundef %13, i8 noundef signext 13)
  %15 = mul i32 %14, 5
  %16 = add i32 %15, -430675100
  %17 = add nsw i64 %.03944, 1
  %.not = icmp eq i64 %17, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %4
  %.040.lcssa = phi i32 [ %2, %4 ], [ %16, %.lr.ph ]
  %18 = and i64 %1, 3
  switch i64 %18, label %default.unreachable45 [
    i64 3, label %19
    i64 2, label %24
    i64 1, label %30
    i64 0, label %38
  ]

19:                                               ; preds = %._crit_edge
  %20 = getelementptr inbounds i8, ptr %6, i64 2
  %21 = load i8, ptr %20, align 1, !tbaa !7
  %22 = zext i8 %21 to i32
  %23 = shl nuw nsw i32 %22, 16
  br label %24

24:                                               ; preds = %._crit_edge, %19
  %.0 = phi i32 [ 0, %._crit_edge ], [ %23, %19 ]
  %25 = getelementptr inbounds i8, ptr %6, i64 1
  %26 = load i8, ptr %25, align 1, !tbaa !7
  %27 = zext i8 %26 to i32
  %28 = shl nuw nsw i32 %27, 8
  %29 = or disjoint i32 %28, %.0
  br label %30

30:                                               ; preds = %._crit_edge, %24
  %.1 = phi i32 [ 0, %._crit_edge ], [ %29, %24 ]
  %31 = load i8, ptr %6, align 1, !tbaa !7
  %32 = zext i8 %31 to i32
  %33 = xor i32 %.1, %32
  %34 = mul i32 %33, -862048943
  %35 = tail call i32 @rotl32(i32 noundef %34, i8 noundef signext 15)
  %36 = mul i32 %35, 461845907
  %37 = xor i32 %36, %.040.lcssa
  br label %38

default.unreachable45:                            ; preds = %._crit_edge
  unreachable

38:                                               ; preds = %._crit_edge, %30
  %.141 = phi i32 [ %.040.lcssa, %._crit_edge ], [ %37, %30 ]
  %39 = trunc i64 %1 to i32
  %40 = xor i32 %.141, %39
  %41 = tail call i32 @fmix32(i32 noundef %40)
  store i32 %41, ptr %3, align 4, !tbaa !10
  ret void
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @getblock32(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @rotl32(i32 noundef, i8 noundef signext) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @fmix32(i32 noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { alwaysinline nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass