; LLVM IR from Water-Melon/Melon :: src (mln_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.mln_hash_s = type { ptr, i64, ptr, ptr, ptr, ptr, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.mln_hash_entry_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct.mln_hash_mgr_s = type { ptr, ptr }

; 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: inlinehint nounwind uwtable
declare hidden void @mln_hash_entry_free(ptr noundef nonnull, ptr noundef, i32 noundef) #1

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

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

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

14:                                               ; preds = %78, %29, %3
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %79

17:                                               ; preds = %14
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %18, ptr %9, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.mln_hash_s, ptr %19, i32 0, i32 14
  store ptr %18, ptr %20, align 8, !tbaa !13
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %21, i32 0, i32 5
  %23 = load ptr, ptr %22, align 8, !tbaa !14
  store ptr %23, ptr %8, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %24, i32 0, i32 8
  %26 = load i32, ptr %25, align 4
  %27 = and i32 %26, 1
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %17
  br label %14, !llvm.loop !16

30:                                               ; preds = %17
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %48

33:                                               ; preds = %30
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %36, i32 0, i32 3
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %39, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !19
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = call i32 %34(ptr noundef %35, ptr noundef %38, ptr noundef %41, ptr noundef %42)
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %33
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.mln_hash_s, ptr %46, i32 0, i32 14
  store ptr null, ptr %47, align 8, !tbaa !13
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %82

48:                                               ; preds = %33, %30
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %49, i32 0, i32 8
  %51 = load i32, ptr %50, align 4
  %52 = and i32 %51, 1
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %78

54:                                               ; preds = %48
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %55, i32 0, i32 6
  %57 = load ptr, ptr %56, align 8, !tbaa !20
  %58 = getelementptr inbounds %struct.mln_hash_mgr_s, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %59, i32 0, i32 6
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  %62 = getelementptr inbounds %struct.mln_hash_mgr_s, ptr %61, i32 0, i32 1
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  call void @mln_hash_entry_chain_del(ptr noundef %58, ptr noundef %62, ptr noundef %63)
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mln_hash_s, ptr %64, i32 0, i32 12
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.mln_hash_s, ptr %66, i32 0, i32 13
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  call void @mln_hash_entry_iter_chain_del(ptr noundef %65, ptr noundef %67, ptr noundef %68)
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.mln_hash_s, ptr %69, i32 0, i32 6
  %71 = load i32, ptr %70, align 8, !tbaa !21
  %72 = add i32 %71, -1
  store i32 %72, ptr %70, align 8, !tbaa !21
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.mln_hash_entry_s, ptr %75, i32 0, i32 7
  %77 = load i32, ptr %76, align 8, !tbaa !22
  call void @mln_hash_entry_free(ptr noundef %73, ptr noundef %74, i32 noundef %77)
  br label %78

78:                                               ; preds = %54, %48
  br label %14, !llvm.loop !16

79:                                               ; preds = %14
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.mln_hash_s, ptr %80, i32 0, i32 14
  store ptr null, ptr %81, align 8, !tbaa !13
  store i32 0, ptr %4, align 4
  store i32 1, ptr %10, align 4
  br label %82

82:                                               ; preds = %79, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %83 = load i32, ptr %4, align 4
  ret i32 %83
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 88}
!10 = !{!"mln_hash_s", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 104}
!14 = !{!15, !6, i64 40}
!15 = !{!"mln_hash_entry_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 60, !12, i64 60}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!15, !6, i64 24}
!19 = !{!15, !6, i64 16}
!20 = !{!15, !6, i64 48}
!21 = !{!10, !12, i64 48}
!22 = !{!15, !12, i64 56}


; 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: inlinehint nounwind uwtable
declare hidden void @mln_hash_entry_free(ptr noundef nonnull, ptr noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @mln_hash_iterate(ptr noundef nonnull %0, ptr noundef readonly %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not30 = icmp eq ptr %5, null
  br i1 %.not30, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 104
  %.not28 = icmp eq ptr %1, null
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  br i1 %.not28, label %._crit_edge, label %.lr.ph.split

.lr.ph.split:                                     ; preds = %.lr.ph, %.backedge
  %.02531 = phi ptr [ %10, %.backedge ], [ %5, %.lr.ph ]
  store ptr %.02531, ptr %6, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %.02531, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %.02531, i64 60
  %12 = load i32, ptr %11, align 4
  %13 = and i32 %12, 1
  %.not27 = icmp eq i32 %13, 0
  br i1 %.not27, label %14, label %.backedge

14:                                               ; preds = %.lr.ph.split
  %15 = getelementptr inbounds i8, ptr %.02531, i64 24
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %.02531, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = tail call i32 %1(ptr noundef nonnull %0, ptr noundef %16, ptr noundef %18, ptr noundef %2) #2
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %.loopexit, label %21

21:                                               ; preds = %14
  %22 = load i32, ptr %11, align 4
  %23 = and i32 %22, 1
  %.not29 = icmp eq i32 %23, 0
  br i1 %.not29, label %.backedge, label %24

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %.02531, i64 48
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  tail call void @mln_hash_entry_chain_del(ptr noundef %26, ptr noundef nonnull %27, ptr noundef nonnull %.02531)
  tail call void @mln_hash_entry_iter_chain_del(ptr noundef nonnull %4, ptr noundef nonnull %7, ptr noundef nonnull %.02531)
  %28 = load i32, ptr %8, align 8, !tbaa !18
  %29 = add i32 %28, -1
  store i32 %29, ptr %8, align 8, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %.02531, i64 56
  %31 = load i32, ptr %30, align 8, !tbaa !19
  tail call void @mln_hash_entry_free(ptr noundef %0, ptr noundef nonnull %.02531, i32 noundef %31)
  br label %.backedge

.backedge:                                        ; preds = %21, %24, %.lr.ph.split
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %._crit_edge, label %.lr.ph.split, !llvm.loop !20

._crit_edge:                                      ; preds = %.backedge, %.lr.ph, %3
  %32 = getelementptr inbounds i8, ptr %0, i64 104
  br label %.loopexit

.loopexit:                                        ; preds = %14, %._crit_edge
  %.sink = phi ptr [ %32, %._crit_edge ], [ %6, %14 ]
  %.0 = phi i32 [ 0, %._crit_edge ], [ -1, %14 ]
  store ptr null, ptr %.sink, align 8, !tbaa !12
  ret i32 %.0
}

attributes #0 = { inlinehint 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 = { 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 = { 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 88}
!6 = !{!"mln_hash_s", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !7, i64 104}
!13 = !{!14, !7, i64 40}
!14 = !{!"mln_hash_entry_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !11, i64 56, !11, i64 60, !11, i64 60}
!15 = !{!14, !7, i64 24}
!16 = !{!14, !7, i64 16}
!17 = !{!14, !7, i64 48}
!18 = !{!6, !11, i64 48}
!19 = !{!14, !11, i64 56}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: ADCEPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass