; LLVM IR from kala13x/libxutils :: src/data (hash)

; 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"

%struct.XHashIterator = type { ptr, ptr }
%struct.XHash = type { ptr, ptr, i64, [32 x %struct.xlist] }
%struct.xlist = type { ptr, ptr, %struct.xlist_data, i8 }
%struct.xlist_data = type { ptr, ptr, ptr, i64 }

; 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

declare ptr @XList_Search(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @XHash_Iterate(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.XHashIterator, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.XHashIterator, ptr %7, i32 0, i32 1
  store ptr %11, ptr %12, align 8, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.XHashIterator, ptr %7, i32 0, i32 0
  store ptr %13, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %15

15:                                               ; preds = %32, %3
  %16 = load i32, ptr %8, align 4, !tbaa !12
  %17 = icmp ult i32 %16, 32
  br i1 %17, label %18, label %35

18:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.XHash, ptr %19, i32 0, i32 3
  %21 = load i32, ptr %8, align 4, !tbaa !12
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds [32 x %struct.xlist], ptr %20, i64 0, i64 %22
  store ptr %23, ptr %9, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = call ptr @XList_Search(ptr noundef %24, ptr noundef %7, ptr noundef @XHash_IteratorCb)
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %18
  store i32 2, ptr %10, align 4
  br label %29

28:                                               ; preds = %18
  store i32 0, ptr %10, align 4
  br label %29

29:                                               ; preds = %28, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %30 = load i32, ptr %10, align 4
  switch i32 %30, label %36 [
    i32 0, label %31
    i32 2, label %35
  ]

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %8, align 4, !tbaa !12
  %34 = add i32 %33, 1
  store i32 %34, ptr %8, align 4, !tbaa !12
  br label %15, !llvm.loop !14

35:                                               ; preds = %29, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  ret void

36:                                               ; preds = %29
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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, !6, i64 8}
!10 = !{!"XHashIterator", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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"

%struct.XHashIterator = type { ptr, ptr }

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

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

declare ptr @XList_Search(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @XHash_Iterate(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.XHashIterator, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %2, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = call ptr @XList_Search(ptr noundef nonnull %6, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %8 = icmp eq ptr %7, null
  br i1 %8, label %132, label %9

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %0, i64 80
  %11 = call ptr @XList_Search(ptr noundef nonnull %10, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %12 = icmp eq ptr %11, null
  br i1 %12, label %132, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %0, i64 136
  %15 = call ptr @XList_Search(ptr noundef nonnull %14, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %16 = icmp eq ptr %15, null
  br i1 %16, label %132, label %17

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %0, i64 192
  %19 = call ptr @XList_Search(ptr noundef nonnull %18, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %20 = icmp eq ptr %19, null
  br i1 %20, label %132, label %21

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 248
  %23 = call ptr @XList_Search(ptr noundef nonnull %22, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %24 = icmp eq ptr %23, null
  br i1 %24, label %132, label %25

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %0, i64 304
  %27 = call ptr @XList_Search(ptr noundef nonnull %26, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %28 = icmp eq ptr %27, null
  br i1 %28, label %132, label %29

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %0, i64 360
  %31 = call ptr @XList_Search(ptr noundef nonnull %30, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %32 = icmp eq ptr %31, null
  br i1 %32, label %132, label %33

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %0, i64 416
  %35 = call ptr @XList_Search(ptr noundef nonnull %34, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %36 = icmp eq ptr %35, null
  br i1 %36, label %132, label %37

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %0, i64 472
  %39 = call ptr @XList_Search(ptr noundef nonnull %38, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %40 = icmp eq ptr %39, null
  br i1 %40, label %132, label %41

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %0, i64 528
  %43 = call ptr @XList_Search(ptr noundef nonnull %42, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %44 = icmp eq ptr %43, null
  br i1 %44, label %132, label %45

45:                                               ; preds = %41
  %46 = getelementptr inbounds i8, ptr %0, i64 584
  %47 = call ptr @XList_Search(ptr noundef nonnull %46, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %48 = icmp eq ptr %47, null
  br i1 %48, label %132, label %49

49:                                               ; preds = %45
  %50 = getelementptr inbounds i8, ptr %0, i64 640
  %51 = call ptr @XList_Search(ptr noundef nonnull %50, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %52 = icmp eq ptr %51, null
  br i1 %52, label %132, label %53

53:                                               ; preds = %49
  %54 = getelementptr inbounds i8, ptr %0, i64 696
  %55 = call ptr @XList_Search(ptr noundef nonnull %54, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %56 = icmp eq ptr %55, null
  br i1 %56, label %132, label %57

57:                                               ; preds = %53
  %58 = getelementptr inbounds i8, ptr %0, i64 752
  %59 = call ptr @XList_Search(ptr noundef nonnull %58, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %60 = icmp eq ptr %59, null
  br i1 %60, label %132, label %61

61:                                               ; preds = %57
  %62 = getelementptr inbounds i8, ptr %0, i64 808
  %63 = call ptr @XList_Search(ptr noundef nonnull %62, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %64 = icmp eq ptr %63, null
  br i1 %64, label %132, label %65

65:                                               ; preds = %61
  %66 = getelementptr inbounds i8, ptr %0, i64 864
  %67 = call ptr @XList_Search(ptr noundef nonnull %66, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %68 = icmp eq ptr %67, null
  br i1 %68, label %132, label %69

69:                                               ; preds = %65
  %70 = getelementptr inbounds i8, ptr %0, i64 920
  %71 = call ptr @XList_Search(ptr noundef nonnull %70, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %72 = icmp eq ptr %71, null
  br i1 %72, label %132, label %73

73:                                               ; preds = %69
  %74 = getelementptr inbounds i8, ptr %0, i64 976
  %75 = call ptr @XList_Search(ptr noundef nonnull %74, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %76 = icmp eq ptr %75, null
  br i1 %76, label %132, label %77

77:                                               ; preds = %73
  %78 = getelementptr inbounds i8, ptr %0, i64 1032
  %79 = call ptr @XList_Search(ptr noundef nonnull %78, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %80 = icmp eq ptr %79, null
  br i1 %80, label %132, label %81

81:                                               ; preds = %77
  %82 = getelementptr inbounds i8, ptr %0, i64 1088
  %83 = call ptr @XList_Search(ptr noundef nonnull %82, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %84 = icmp eq ptr %83, null
  br i1 %84, label %132, label %85

85:                                               ; preds = %81
  %86 = getelementptr inbounds i8, ptr %0, i64 1144
  %87 = call ptr @XList_Search(ptr noundef nonnull %86, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %88 = icmp eq ptr %87, null
  br i1 %88, label %132, label %89

89:                                               ; preds = %85
  %90 = getelementptr inbounds i8, ptr %0, i64 1200
  %91 = call ptr @XList_Search(ptr noundef nonnull %90, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %92 = icmp eq ptr %91, null
  br i1 %92, label %132, label %93

93:                                               ; preds = %89
  %94 = getelementptr inbounds i8, ptr %0, i64 1256
  %95 = call ptr @XList_Search(ptr noundef nonnull %94, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %96 = icmp eq ptr %95, null
  br i1 %96, label %132, label %97

97:                                               ; preds = %93
  %98 = getelementptr inbounds i8, ptr %0, i64 1312
  %99 = call ptr @XList_Search(ptr noundef nonnull %98, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %100 = icmp eq ptr %99, null
  br i1 %100, label %132, label %101

101:                                              ; preds = %97
  %102 = getelementptr inbounds i8, ptr %0, i64 1368
  %103 = call ptr @XList_Search(ptr noundef nonnull %102, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %104 = icmp eq ptr %103, null
  br i1 %104, label %132, label %105

105:                                              ; preds = %101
  %106 = getelementptr inbounds i8, ptr %0, i64 1424
  %107 = call ptr @XList_Search(ptr noundef nonnull %106, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %108 = icmp eq ptr %107, null
  br i1 %108, label %132, label %109

109:                                              ; preds = %105
  %110 = getelementptr inbounds i8, ptr %0, i64 1480
  %111 = call ptr @XList_Search(ptr noundef nonnull %110, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %112 = icmp eq ptr %111, null
  br i1 %112, label %132, label %113

113:                                              ; preds = %109
  %114 = getelementptr inbounds i8, ptr %0, i64 1536
  %115 = call ptr @XList_Search(ptr noundef nonnull %114, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %116 = icmp eq ptr %115, null
  br i1 %116, label %132, label %117

117:                                              ; preds = %113
  %118 = getelementptr inbounds i8, ptr %0, i64 1592
  %119 = call ptr @XList_Search(ptr noundef nonnull %118, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %120 = icmp eq ptr %119, null
  br i1 %120, label %132, label %121

121:                                              ; preds = %117
  %122 = getelementptr inbounds i8, ptr %0, i64 1648
  %123 = call ptr @XList_Search(ptr noundef nonnull %122, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %124 = icmp eq ptr %123, null
  br i1 %124, label %132, label %125

125:                                              ; preds = %121
  %126 = getelementptr inbounds i8, ptr %0, i64 1704
  %127 = call ptr @XList_Search(ptr noundef nonnull %126, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  %128 = icmp eq ptr %127, null
  br i1 %128, label %132, label %129

129:                                              ; preds = %125
  %130 = getelementptr inbounds i8, ptr %0, i64 1760
  %131 = call ptr @XList_Search(ptr noundef nonnull %130, ptr noundef nonnull %4, ptr noundef nonnull @XHash_IteratorCb) #3
  br label %132

132:                                              ; preds = %129, %125, %121, %117, %113, %109, %105, %101, %97, %93, %89, %85, %81, %77, %73, %69, %65, %61, %57, %53, %49, %45, %41, %37, %33, %29, %25, %21, %17, %13, %9, %3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #3
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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, !7, i64 8}
!6 = !{!"XHashIterator", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 0}


; Effective O3 passes: ADCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass