; 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 i32 @XHash_Init(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  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
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.XHash, ptr %10, i32 0, i32 1
  store ptr %9, ptr %11, align 8, !tbaa !9
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.XHash, ptr %13, i32 0, i32 0
  store ptr %12, ptr %14, align 8, !tbaa !12
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.XHash, ptr %15, i32 0, i32 2
  store i64 0, ptr %16, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !14
  br label %17

17:                                               ; preds = %28, %3
  %18 = load i32, ptr %7, align 4, !tbaa !14
  %19 = icmp ult i32 %18, 32
  br i1 %19, label %20, label %31

20:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.XHash, ptr %21, i32 0, i32 3
  %23 = load i32, ptr %7, align 4, !tbaa !14
  %24 = zext i32 %23 to i64
  %25 = getelementptr inbounds [32 x %struct.xlist], ptr %22, i64 0, i64 %24
  store ptr %25, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @XList_Init(ptr noundef %26, ptr noundef null, i64 noundef 0, ptr noundef @XHash_ClearCb, ptr noundef %27)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %28

28:                                               ; preds = %20
  %29 = load i32, ptr %7, align 4, !tbaa !14
  %30 = add i32 %29, 1
  store i32 %30, ptr %7, align 4, !tbaa !14
  br label %17, !llvm.loop !16

31:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret i32 1
}

declare void @XList_Init(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @XHash_ClearCb(ptr noundef, ptr noundef) #1

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, !6, i64 8}
!10 = !{!"XHash", !6, i64 0, !6, i64 8, !11, i64 16, !7, i64 24}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !11, i64 16}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"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"

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @XHash_Init(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %2, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %0, align 8, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %5, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @XList_Init(ptr noundef nonnull %6, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %7 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @XList_Init(ptr noundef nonnull %7, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %8 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @XList_Init(ptr noundef nonnull %8, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %9 = getelementptr inbounds i8, ptr %0, i64 192
  tail call void @XList_Init(ptr noundef nonnull %9, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %10 = getelementptr inbounds i8, ptr %0, i64 248
  tail call void @XList_Init(ptr noundef nonnull %10, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %11 = getelementptr inbounds i8, ptr %0, i64 304
  tail call void @XList_Init(ptr noundef nonnull %11, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %12 = getelementptr inbounds i8, ptr %0, i64 360
  tail call void @XList_Init(ptr noundef nonnull %12, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %13 = getelementptr inbounds i8, ptr %0, i64 416
  tail call void @XList_Init(ptr noundef nonnull %13, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %14 = getelementptr inbounds i8, ptr %0, i64 472
  tail call void @XList_Init(ptr noundef nonnull %14, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %15 = getelementptr inbounds i8, ptr %0, i64 528
  tail call void @XList_Init(ptr noundef nonnull %15, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %16 = getelementptr inbounds i8, ptr %0, i64 584
  tail call void @XList_Init(ptr noundef nonnull %16, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %17 = getelementptr inbounds i8, ptr %0, i64 640
  tail call void @XList_Init(ptr noundef nonnull %17, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %18 = getelementptr inbounds i8, ptr %0, i64 696
  tail call void @XList_Init(ptr noundef nonnull %18, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %19 = getelementptr inbounds i8, ptr %0, i64 752
  tail call void @XList_Init(ptr noundef nonnull %19, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %20 = getelementptr inbounds i8, ptr %0, i64 808
  tail call void @XList_Init(ptr noundef nonnull %20, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %21 = getelementptr inbounds i8, ptr %0, i64 864
  tail call void @XList_Init(ptr noundef nonnull %21, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %22 = getelementptr inbounds i8, ptr %0, i64 920
  tail call void @XList_Init(ptr noundef nonnull %22, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %23 = getelementptr inbounds i8, ptr %0, i64 976
  tail call void @XList_Init(ptr noundef nonnull %23, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %24 = getelementptr inbounds i8, ptr %0, i64 1032
  tail call void @XList_Init(ptr noundef nonnull %24, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %25 = getelementptr inbounds i8, ptr %0, i64 1088
  tail call void @XList_Init(ptr noundef nonnull %25, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %26 = getelementptr inbounds i8, ptr %0, i64 1144
  tail call void @XList_Init(ptr noundef nonnull %26, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %27 = getelementptr inbounds i8, ptr %0, i64 1200
  tail call void @XList_Init(ptr noundef nonnull %27, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %28 = getelementptr inbounds i8, ptr %0, i64 1256
  tail call void @XList_Init(ptr noundef nonnull %28, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %29 = getelementptr inbounds i8, ptr %0, i64 1312
  tail call void @XList_Init(ptr noundef nonnull %29, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %30 = getelementptr inbounds i8, ptr %0, i64 1368
  tail call void @XList_Init(ptr noundef nonnull %30, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %31 = getelementptr inbounds i8, ptr %0, i64 1424
  tail call void @XList_Init(ptr noundef nonnull %31, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %32 = getelementptr inbounds i8, ptr %0, i64 1480
  tail call void @XList_Init(ptr noundef nonnull %32, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %33 = getelementptr inbounds i8, ptr %0, i64 1536
  tail call void @XList_Init(ptr noundef nonnull %33, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %34 = getelementptr inbounds i8, ptr %0, i64 1592
  tail call void @XList_Init(ptr noundef nonnull %34, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %35 = getelementptr inbounds i8, ptr %0, i64 1648
  tail call void @XList_Init(ptr noundef nonnull %35, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %36 = getelementptr inbounds i8, ptr %0, i64 1704
  tail call void @XList_Init(ptr noundef nonnull %36, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  %37 = getelementptr inbounds i8, ptr %0, i64 1760
  tail call void @XList_Init(ptr noundef nonnull %37, ptr noundef null, i64 noundef 0, ptr noundef nonnull @XHash_ClearCb, ptr noundef nonnull %0) #2
  ret i32 1
}

declare void @XList_Init(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @XHash_ClearCb(ptr noundef, ptr noundef) #0

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 = { 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 = !{!"XHash", !7, i64 0, !7, i64 8, !10, i64 16, !8, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 16}


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