; LLVM IR from justinxu9905/bustub-2022-fall :: third_party/murmur3/MurmurHash3.ll (ZN7murmur318MurmurHash3_x86_32EPKvjj)

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

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

28:                                               ; preds = %51, %3
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %54

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

51:                                               ; preds = %31
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %9, align 4, !tbaa !9
  br label %28, !llvm.loop !11

54:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = mul nsw i32 %56, 4
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %55, i64 %58
  store ptr %59, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  %60 = load i32, ptr %5, align 4, !tbaa !9
  %61 = and i32 %60, 3
  switch i32 %61, label %96 [
    i32 3, label %62
    i32 2, label %70
    i32 1, label %78
  ]

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

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

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

96:                                               ; preds = %78, %54
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = load i32, ptr %10, align 4, !tbaa !9
  %99 = xor i32 %98, %97
  store i32 %99, ptr %10, align 4, !tbaa !9
  %100 = load i32, ptr %10, align 4, !tbaa !9
  %101 = call noundef i32 @_ZN7murmur3L6fmix32Ej(i32 noundef %100)
  store i32 %101, ptr %10, align 4, !tbaa !9
  %102 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret i32 %102
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7murmur36rotl32Eja(i32 noundef, i8 noundef signext) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { alwaysinline mustprogress 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 = { inlinehint mustprogress 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 #4 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!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: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN7murmur318MurmurHash3_x86_32EPKvjj(ptr noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = and i32 %1, -4
  %5 = zext nneg i32 %4 to i64
  %6 = getelementptr inbounds i8, ptr %0, i64 %5
  %.not41 = icmp ult i32 %1, 4
  br i1 %.not41, label %._crit_edge, label %.lr.ph.preheader

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

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

._crit_edge:                                      ; preds = %.lr.ph, %3
  %.039.lcssa = phi i32 [ %2, %3 ], [ %16, %.lr.ph ]
  %18 = and i32 %1, 3
  switch i32 %18, label %default.unreachable44 [
    i32 3, label %19
    i32 2, label %24
    i32 1, label %30
    i32 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 noundef i32 @_ZN7murmur36rotl32Eja(i32 noundef %34, i8 noundef signext 15)
  %36 = mul i32 %35, 461845907
  %37 = xor i32 %36, %.039.lcssa
  br label %38

default.unreachable44:                            ; preds = %._crit_edge
  unreachable

38:                                               ; preds = %._crit_edge, %30
  %.140 = phi i32 [ %.039.lcssa, %._crit_edge ], [ %37, %30 ]
  %39 = xor i32 %.140, %1
  %40 = tail call noundef i32 @_ZN7murmur3L6fmix32Ej(i32 noundef %39)
  ret i32 %40
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7murmur36rotl32Eja(i32 noundef, i8 noundef signext) local_unnamed_addr #2

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

attributes #0 = { mustprogress 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 mustprogress 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 #2 = { inlinehint mustprogress 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++ TBAA"}


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