; LLVM IR from kfv/leetcode :: src/1 (hash_table)

; 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.hash_node = type { i32, i32, 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: nounwind uwtable
define dso_local void @hash_node_free(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  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 %6

6:                                                ; preds = %26, %1
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = icmp slt i32 %7, 17
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %29

10:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = load i32, ptr %3, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds ptr, ptr %11, i64 %13
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %15, ptr %4, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %19, %10
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %25

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %20, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.hash_node, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  store ptr %23, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %16, !llvm.loop !13

25:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %26

26:                                               ; preds = %25
  %27 = load i32, ptr %3, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !15

29:                                               ; preds = %9
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %30) #3
  ret void
}

; Function Attrs: nounwind
declare void @free(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 = { nounwind "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 = !{!12, !6, i64 8}
!12 = !{!"hash_node", !10, i64 0, !10, i64 4, !6, i64 8}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 @hash_node_free(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %.not9 = icmp eq ptr %2, null
  br i1 %.not9, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.0810 = phi ptr [ %4, %.lr.ph ], [ %2, %1 ]
  %3 = getelementptr inbounds i8, ptr %.0810, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810) #2
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph, %1
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not9.1 = icmp eq ptr %6, null
  br i1 %.not9.1, label %._crit_edge.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %.0810.1 = phi ptr [ %8, %.lr.ph.1 ], [ %6, %._crit_edge ]
  %7 = getelementptr inbounds i8, ptr %.0810.1, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.1) #2
  %.not.1 = icmp eq ptr %8, null
  br i1 %.not.1, label %._crit_edge.1, label %.lr.ph.1, !llvm.loop !12

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %.not9.2 = icmp eq ptr %10, null
  br i1 %.not9.2, label %._crit_edge.2, label %.lr.ph.2

.lr.ph.2:                                         ; preds = %._crit_edge.1, %.lr.ph.2
  %.0810.2 = phi ptr [ %12, %.lr.ph.2 ], [ %10, %._crit_edge.1 ]
  %11 = getelementptr inbounds i8, ptr %.0810.2, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.2) #2
  %.not.2 = icmp eq ptr %12, null
  br i1 %.not.2, label %._crit_edge.2, label %.lr.ph.2, !llvm.loop !12

._crit_edge.2:                                    ; preds = %.lr.ph.2, %._crit_edge.1
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %.not9.3 = icmp eq ptr %14, null
  br i1 %.not9.3, label %._crit_edge.3, label %.lr.ph.3

.lr.ph.3:                                         ; preds = %._crit_edge.2, %.lr.ph.3
  %.0810.3 = phi ptr [ %16, %.lr.ph.3 ], [ %14, %._crit_edge.2 ]
  %15 = getelementptr inbounds i8, ptr %.0810.3, i64 8
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.3) #2
  %.not.3 = icmp eq ptr %16, null
  br i1 %.not.3, label %._crit_edge.3, label %.lr.ph.3, !llvm.loop !12

._crit_edge.3:                                    ; preds = %.lr.ph.3, %._crit_edge.2
  %17 = getelementptr inbounds i8, ptr %0, i64 32
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %.not9.4 = icmp eq ptr %18, null
  br i1 %.not9.4, label %._crit_edge.4, label %.lr.ph.4

.lr.ph.4:                                         ; preds = %._crit_edge.3, %.lr.ph.4
  %.0810.4 = phi ptr [ %20, %.lr.ph.4 ], [ %18, %._crit_edge.3 ]
  %19 = getelementptr inbounds i8, ptr %.0810.4, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.4) #2
  %.not.4 = icmp eq ptr %20, null
  br i1 %.not.4, label %._crit_edge.4, label %.lr.ph.4, !llvm.loop !12

._crit_edge.4:                                    ; preds = %.lr.ph.4, %._crit_edge.3
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  %.not9.5 = icmp eq ptr %22, null
  br i1 %.not9.5, label %._crit_edge.5, label %.lr.ph.5

.lr.ph.5:                                         ; preds = %._crit_edge.4, %.lr.ph.5
  %.0810.5 = phi ptr [ %24, %.lr.ph.5 ], [ %22, %._crit_edge.4 ]
  %23 = getelementptr inbounds i8, ptr %.0810.5, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.5) #2
  %.not.5 = icmp eq ptr %24, null
  br i1 %.not.5, label %._crit_edge.5, label %.lr.ph.5, !llvm.loop !12

._crit_edge.5:                                    ; preds = %.lr.ph.5, %._crit_edge.4
  %25 = getelementptr inbounds i8, ptr %0, i64 48
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %.not9.6 = icmp eq ptr %26, null
  br i1 %.not9.6, label %._crit_edge.6, label %.lr.ph.6

.lr.ph.6:                                         ; preds = %._crit_edge.5, %.lr.ph.6
  %.0810.6 = phi ptr [ %28, %.lr.ph.6 ], [ %26, %._crit_edge.5 ]
  %27 = getelementptr inbounds i8, ptr %.0810.6, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.6) #2
  %.not.6 = icmp eq ptr %28, null
  br i1 %.not.6, label %._crit_edge.6, label %.lr.ph.6, !llvm.loop !12

._crit_edge.6:                                    ; preds = %.lr.ph.6, %._crit_edge.5
  %29 = getelementptr inbounds i8, ptr %0, i64 56
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %.not9.7 = icmp eq ptr %30, null
  br i1 %.not9.7, label %._crit_edge.7, label %.lr.ph.7

.lr.ph.7:                                         ; preds = %._crit_edge.6, %.lr.ph.7
  %.0810.7 = phi ptr [ %32, %.lr.ph.7 ], [ %30, %._crit_edge.6 ]
  %31 = getelementptr inbounds i8, ptr %.0810.7, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.7) #2
  %.not.7 = icmp eq ptr %32, null
  br i1 %.not.7, label %._crit_edge.7, label %.lr.ph.7, !llvm.loop !12

._crit_edge.7:                                    ; preds = %.lr.ph.7, %._crit_edge.6
  %33 = getelementptr inbounds i8, ptr %0, i64 64
  %34 = load ptr, ptr %33, align 8, !tbaa !5
  %.not9.8 = icmp eq ptr %34, null
  br i1 %.not9.8, label %._crit_edge.8, label %.lr.ph.8

.lr.ph.8:                                         ; preds = %._crit_edge.7, %.lr.ph.8
  %.0810.8 = phi ptr [ %36, %.lr.ph.8 ], [ %34, %._crit_edge.7 ]
  %35 = getelementptr inbounds i8, ptr %.0810.8, i64 8
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.8) #2
  %.not.8 = icmp eq ptr %36, null
  br i1 %.not.8, label %._crit_edge.8, label %.lr.ph.8, !llvm.loop !12

._crit_edge.8:                                    ; preds = %.lr.ph.8, %._crit_edge.7
  %37 = getelementptr inbounds i8, ptr %0, i64 72
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %.not9.9 = icmp eq ptr %38, null
  br i1 %.not9.9, label %._crit_edge.9, label %.lr.ph.9

.lr.ph.9:                                         ; preds = %._crit_edge.8, %.lr.ph.9
  %.0810.9 = phi ptr [ %40, %.lr.ph.9 ], [ %38, %._crit_edge.8 ]
  %39 = getelementptr inbounds i8, ptr %.0810.9, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.9) #2
  %.not.9 = icmp eq ptr %40, null
  br i1 %.not.9, label %._crit_edge.9, label %.lr.ph.9, !llvm.loop !12

._crit_edge.9:                                    ; preds = %.lr.ph.9, %._crit_edge.8
  %41 = getelementptr inbounds i8, ptr %0, i64 80
  %42 = load ptr, ptr %41, align 8, !tbaa !5
  %.not9.10 = icmp eq ptr %42, null
  br i1 %.not9.10, label %._crit_edge.10, label %.lr.ph.10

.lr.ph.10:                                        ; preds = %._crit_edge.9, %.lr.ph.10
  %.0810.10 = phi ptr [ %44, %.lr.ph.10 ], [ %42, %._crit_edge.9 ]
  %43 = getelementptr inbounds i8, ptr %.0810.10, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.10) #2
  %.not.10 = icmp eq ptr %44, null
  br i1 %.not.10, label %._crit_edge.10, label %.lr.ph.10, !llvm.loop !12

._crit_edge.10:                                   ; preds = %.lr.ph.10, %._crit_edge.9
  %45 = getelementptr inbounds i8, ptr %0, i64 88
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %.not9.11 = icmp eq ptr %46, null
  br i1 %.not9.11, label %._crit_edge.11, label %.lr.ph.11

.lr.ph.11:                                        ; preds = %._crit_edge.10, %.lr.ph.11
  %.0810.11 = phi ptr [ %48, %.lr.ph.11 ], [ %46, %._crit_edge.10 ]
  %47 = getelementptr inbounds i8, ptr %.0810.11, i64 8
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.11) #2
  %.not.11 = icmp eq ptr %48, null
  br i1 %.not.11, label %._crit_edge.11, label %.lr.ph.11, !llvm.loop !12

._crit_edge.11:                                   ; preds = %.lr.ph.11, %._crit_edge.10
  %49 = getelementptr inbounds i8, ptr %0, i64 96
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %.not9.12 = icmp eq ptr %50, null
  br i1 %.not9.12, label %._crit_edge.12, label %.lr.ph.12

.lr.ph.12:                                        ; preds = %._crit_edge.11, %.lr.ph.12
  %.0810.12 = phi ptr [ %52, %.lr.ph.12 ], [ %50, %._crit_edge.11 ]
  %51 = getelementptr inbounds i8, ptr %.0810.12, i64 8
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.12) #2
  %.not.12 = icmp eq ptr %52, null
  br i1 %.not.12, label %._crit_edge.12, label %.lr.ph.12, !llvm.loop !12

._crit_edge.12:                                   ; preds = %.lr.ph.12, %._crit_edge.11
  %53 = getelementptr inbounds i8, ptr %0, i64 104
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %.not9.13 = icmp eq ptr %54, null
  br i1 %.not9.13, label %._crit_edge.13, label %.lr.ph.13

.lr.ph.13:                                        ; preds = %._crit_edge.12, %.lr.ph.13
  %.0810.13 = phi ptr [ %56, %.lr.ph.13 ], [ %54, %._crit_edge.12 ]
  %55 = getelementptr inbounds i8, ptr %.0810.13, i64 8
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.13) #2
  %.not.13 = icmp eq ptr %56, null
  br i1 %.not.13, label %._crit_edge.13, label %.lr.ph.13, !llvm.loop !12

._crit_edge.13:                                   ; preds = %.lr.ph.13, %._crit_edge.12
  %57 = getelementptr inbounds i8, ptr %0, i64 112
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %.not9.14 = icmp eq ptr %58, null
  br i1 %.not9.14, label %._crit_edge.14, label %.lr.ph.14

.lr.ph.14:                                        ; preds = %._crit_edge.13, %.lr.ph.14
  %.0810.14 = phi ptr [ %60, %.lr.ph.14 ], [ %58, %._crit_edge.13 ]
  %59 = getelementptr inbounds i8, ptr %.0810.14, i64 8
  %60 = load ptr, ptr %59, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.14) #2
  %.not.14 = icmp eq ptr %60, null
  br i1 %.not.14, label %._crit_edge.14, label %.lr.ph.14, !llvm.loop !12

._crit_edge.14:                                   ; preds = %.lr.ph.14, %._crit_edge.13
  %61 = getelementptr inbounds i8, ptr %0, i64 120
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  %.not9.15 = icmp eq ptr %62, null
  br i1 %.not9.15, label %._crit_edge.15, label %.lr.ph.15

.lr.ph.15:                                        ; preds = %._crit_edge.14, %.lr.ph.15
  %.0810.15 = phi ptr [ %64, %.lr.ph.15 ], [ %62, %._crit_edge.14 ]
  %63 = getelementptr inbounds i8, ptr %.0810.15, i64 8
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.15) #2
  %.not.15 = icmp eq ptr %64, null
  br i1 %.not.15, label %._crit_edge.15, label %.lr.ph.15, !llvm.loop !12

._crit_edge.15:                                   ; preds = %.lr.ph.15, %._crit_edge.14
  %65 = getelementptr inbounds i8, ptr %0, i64 128
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %.not9.16 = icmp eq ptr %66, null
  br i1 %.not9.16, label %._crit_edge.16, label %.lr.ph.16

.lr.ph.16:                                        ; preds = %._crit_edge.15, %.lr.ph.16
  %.0810.16 = phi ptr [ %68, %.lr.ph.16 ], [ %66, %._crit_edge.15 ]
  %67 = getelementptr inbounds i8, ptr %.0810.16, i64 8
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %.0810.16) #2
  %.not.16 = icmp eq ptr %68, null
  br i1 %.not.16, label %._crit_edge.16, label %.lr.ph.16, !llvm.loop !12

._crit_edge.16:                                   ; preds = %.lr.ph.16, %._crit_edge.15
  tail call void @free(ptr noundef %0) #2
  ret void
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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, !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 = !{!"hash_node", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass