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

; Function Attrs: nounwind uwtable
define dso_local void @XHash_Destroy(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %4

4:                                                ; preds = %13, %1
  %5 = load i32, ptr %3, align 4, !tbaa !9
  %6 = icmp ult i32 %5, 32
  br i1 %6, label %7, label %16

7:                                                ; preds = %4
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.XHash, ptr %8, i32 0, i32 3
  %10 = load i32, ptr %3, align 4, !tbaa !9
  %11 = zext i32 %10 to i64
  %12 = getelementptr inbounds [32 x %struct.xlist], ptr %9, i64 0, i64 %11
  call void @XList_Clear(ptr noundef %12)
  br label %13

13:                                               ; preds = %7
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = add i32 %14, 1
  store i32 %15, ptr %3, align 4, !tbaa !9
  br label %4, !llvm.loop !11

16:                                               ; preds = %4
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.XHash, ptr %17, i32 0, i32 1
  store ptr null, ptr %18, align 8, !tbaa !13
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.XHash, ptr %19, i32 0, i32 0
  store ptr null, ptr %20, align 8, !tbaa !16
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.XHash, ptr %21, i32 0, i32 2
  store i64 0, ptr %22, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

declare void @XList_Clear(ptr noundef) #2

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


; 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 @XHash_Destroy(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @XList_Clear(ptr noundef nonnull %2) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @XList_Clear(ptr noundef nonnull %3) #3
  %4 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @XList_Clear(ptr noundef nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @XList_Clear(ptr noundef nonnull %5) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 248
  tail call void @XList_Clear(ptr noundef nonnull %6) #3
  %7 = getelementptr inbounds i8, ptr %0, i64 304
  tail call void @XList_Clear(ptr noundef nonnull %7) #3
  %8 = getelementptr inbounds i8, ptr %0, i64 360
  tail call void @XList_Clear(ptr noundef nonnull %8) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 416
  tail call void @XList_Clear(ptr noundef nonnull %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 472
  tail call void @XList_Clear(ptr noundef nonnull %10) #3
  %11 = getelementptr inbounds i8, ptr %0, i64 528
  tail call void @XList_Clear(ptr noundef nonnull %11) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 584
  tail call void @XList_Clear(ptr noundef nonnull %12) #3
  %13 = getelementptr inbounds i8, ptr %0, i64 640
  tail call void @XList_Clear(ptr noundef nonnull %13) #3
  %14 = getelementptr inbounds i8, ptr %0, i64 696
  tail call void @XList_Clear(ptr noundef nonnull %14) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 752
  tail call void @XList_Clear(ptr noundef nonnull %15) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 808
  tail call void @XList_Clear(ptr noundef nonnull %16) #3
  %17 = getelementptr inbounds i8, ptr %0, i64 864
  tail call void @XList_Clear(ptr noundef nonnull %17) #3
  %18 = getelementptr inbounds i8, ptr %0, i64 920
  tail call void @XList_Clear(ptr noundef nonnull %18) #3
  %19 = getelementptr inbounds i8, ptr %0, i64 976
  tail call void @XList_Clear(ptr noundef nonnull %19) #3
  %20 = getelementptr inbounds i8, ptr %0, i64 1032
  tail call void @XList_Clear(ptr noundef nonnull %20) #3
  %21 = getelementptr inbounds i8, ptr %0, i64 1088
  tail call void @XList_Clear(ptr noundef nonnull %21) #3
  %22 = getelementptr inbounds i8, ptr %0, i64 1144
  tail call void @XList_Clear(ptr noundef nonnull %22) #3
  %23 = getelementptr inbounds i8, ptr %0, i64 1200
  tail call void @XList_Clear(ptr noundef nonnull %23) #3
  %24 = getelementptr inbounds i8, ptr %0, i64 1256
  tail call void @XList_Clear(ptr noundef nonnull %24) #3
  %25 = getelementptr inbounds i8, ptr %0, i64 1312
  tail call void @XList_Clear(ptr noundef nonnull %25) #3
  %26 = getelementptr inbounds i8, ptr %0, i64 1368
  tail call void @XList_Clear(ptr noundef nonnull %26) #3
  %27 = getelementptr inbounds i8, ptr %0, i64 1424
  tail call void @XList_Clear(ptr noundef nonnull %27) #3
  %28 = getelementptr inbounds i8, ptr %0, i64 1480
  tail call void @XList_Clear(ptr noundef nonnull %28) #3
  %29 = getelementptr inbounds i8, ptr %0, i64 1536
  tail call void @XList_Clear(ptr noundef nonnull %29) #3
  %30 = getelementptr inbounds i8, ptr %0, i64 1592
  tail call void @XList_Clear(ptr noundef nonnull %30) #3
  %31 = getelementptr inbounds i8, ptr %0, i64 1648
  tail call void @XList_Clear(ptr noundef nonnull %31) #3
  %32 = getelementptr inbounds i8, ptr %0, i64 1704
  tail call void @XList_Clear(ptr noundef nonnull %32) #3
  %33 = getelementptr inbounds i8, ptr %0, i64 1760
  tail call void @XList_Clear(ptr noundef nonnull %33) #3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, i8 0, i64 24, i1 false)
  ret void
}

declare void @XList_Clear(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass