; LLVM IR from JessonYue/LeetCodeLearning :: Array/wuchao/hashmap/6-26 完善直播的LinkedListHash (LinkedListHash)

; 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_table = type { [6 x ptr] }
%struct._hash_node = type { i32, ptr }

@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16print_hash_tableP11_hash_table(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = 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 %5

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

8:                                                ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct._hash_table, ptr %9, i32 0, i32 0
  %11 = load i32, ptr %3, align 4, !tbaa !9
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [6 x ptr], ptr %10, i64 0, i64 %12
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %14, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %35

17:                                               ; preds = %8
  br label %18

18:                                               ; preds = %23, %17
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._hash_node, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %33

23:                                               ; preds = %18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._hash_node, ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds %struct._hash_node, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !13
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %28)
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._hash_node, ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  store ptr %32, ptr %4, align 8, !tbaa !5
  br label %18, !llvm.loop !14

33:                                               ; preds = %18
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %35

35:                                               ; preds = %33, %8
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %5, !llvm.loop !16

38:                                               ; preds = %5
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

declare i32 @printf(ptr noundef, ...) #2

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

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


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

@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local void @_Z16print_hash_tableP11_hash_table(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %13, label %.preheader

.preheader:                                       ; preds = %1
  %3 = getelementptr inbounds i8, ptr %2, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !9
  %.not1011 = icmp eq ptr %4, null
  br i1 %.not1011, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %5 = phi ptr [ %11, %.lr.ph ], [ %4, %.preheader ]
  %6 = phi ptr [ %10, %.lr.ph ], [ %3, %.preheader ]
  %7 = load i32, ptr %5, align 8, !tbaa !12
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %7)
  %9 = load ptr, ptr %6, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %.not10 = icmp eq ptr %11, null
  br i1 %.not10, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %13

13:                                               ; preds = %._crit_edge, %1
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %.not.1 = icmp eq ptr %15, null
  br i1 %.not.1, label %26, label %.preheader.1

.preheader.1:                                     ; preds = %13
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %.not1011.1 = icmp eq ptr %17, null
  br i1 %.not1011.1, label %._crit_edge.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.preheader.1, %.lr.ph.1
  %18 = phi ptr [ %24, %.lr.ph.1 ], [ %17, %.preheader.1 ]
  %19 = phi ptr [ %23, %.lr.ph.1 ], [ %16, %.preheader.1 ]
  %20 = load i32, ptr %18, align 8, !tbaa !12
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %20)
  %22 = load ptr, ptr %19, align 8, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %.not10.1 = icmp eq ptr %24, null
  br i1 %.not10.1, label %._crit_edge.1, label %.lr.ph.1, !llvm.loop !13

._crit_edge.1:                                    ; preds = %.lr.ph.1, %.preheader.1
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %26

26:                                               ; preds = %._crit_edge.1, %13
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %.not.2 = icmp eq ptr %28, null
  br i1 %.not.2, label %39, label %.preheader.2

.preheader.2:                                     ; preds = %26
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %.not1011.2 = icmp eq ptr %30, null
  br i1 %.not1011.2, label %._crit_edge.2, label %.lr.ph.2

.lr.ph.2:                                         ; preds = %.preheader.2, %.lr.ph.2
  %31 = phi ptr [ %37, %.lr.ph.2 ], [ %30, %.preheader.2 ]
  %32 = phi ptr [ %36, %.lr.ph.2 ], [ %29, %.preheader.2 ]
  %33 = load i32, ptr %31, align 8, !tbaa !12
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
  %35 = load ptr, ptr %32, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %.not10.2 = icmp eq ptr %37, null
  br i1 %.not10.2, label %._crit_edge.2, label %.lr.ph.2, !llvm.loop !13

._crit_edge.2:                                    ; preds = %.lr.ph.2, %.preheader.2
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %39

39:                                               ; preds = %._crit_edge.2, %26
  %40 = getelementptr inbounds i8, ptr %0, i64 24
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %.not.3 = icmp eq ptr %41, null
  br i1 %.not.3, label %52, label %.preheader.3

.preheader.3:                                     ; preds = %39
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %.not1011.3 = icmp eq ptr %43, null
  br i1 %.not1011.3, label %._crit_edge.3, label %.lr.ph.3

.lr.ph.3:                                         ; preds = %.preheader.3, %.lr.ph.3
  %44 = phi ptr [ %50, %.lr.ph.3 ], [ %43, %.preheader.3 ]
  %45 = phi ptr [ %49, %.lr.ph.3 ], [ %42, %.preheader.3 ]
  %46 = load i32, ptr %44, align 8, !tbaa !12
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %46)
  %48 = load ptr, ptr %45, align 8, !tbaa !9
  %49 = getelementptr inbounds i8, ptr %48, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %.not10.3 = icmp eq ptr %50, null
  br i1 %.not10.3, label %._crit_edge.3, label %.lr.ph.3, !llvm.loop !13

._crit_edge.3:                                    ; preds = %.lr.ph.3, %.preheader.3
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %52

52:                                               ; preds = %._crit_edge.3, %39
  %53 = getelementptr inbounds i8, ptr %0, i64 32
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %.not.4 = icmp eq ptr %54, null
  br i1 %.not.4, label %65, label %.preheader.4

.preheader.4:                                     ; preds = %52
  %55 = getelementptr inbounds i8, ptr %54, i64 8
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %.not1011.4 = icmp eq ptr %56, null
  br i1 %.not1011.4, label %._crit_edge.4, label %.lr.ph.4

.lr.ph.4:                                         ; preds = %.preheader.4, %.lr.ph.4
  %57 = phi ptr [ %63, %.lr.ph.4 ], [ %56, %.preheader.4 ]
  %58 = phi ptr [ %62, %.lr.ph.4 ], [ %55, %.preheader.4 ]
  %59 = load i32, ptr %57, align 8, !tbaa !12
  %60 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %59)
  %61 = load ptr, ptr %58, align 8, !tbaa !9
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %.not10.4 = icmp eq ptr %63, null
  br i1 %.not10.4, label %._crit_edge.4, label %.lr.ph.4, !llvm.loop !13

._crit_edge.4:                                    ; preds = %.lr.ph.4, %.preheader.4
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %65

65:                                               ; preds = %._crit_edge.4, %52
  %66 = getelementptr inbounds i8, ptr %0, i64 40
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %.not.5 = icmp eq ptr %67, null
  br i1 %.not.5, label %78, label %.preheader.5

.preheader.5:                                     ; preds = %65
  %68 = getelementptr inbounds i8, ptr %67, i64 8
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %.not1011.5 = icmp eq ptr %69, null
  br i1 %.not1011.5, label %._crit_edge.5, label %.lr.ph.5

.lr.ph.5:                                         ; preds = %.preheader.5, %.lr.ph.5
  %70 = phi ptr [ %76, %.lr.ph.5 ], [ %69, %.preheader.5 ]
  %71 = phi ptr [ %75, %.lr.ph.5 ], [ %68, %.preheader.5 ]
  %72 = load i32, ptr %70, align 8, !tbaa !12
  %73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %72)
  %74 = load ptr, ptr %71, align 8, !tbaa !9
  %75 = getelementptr inbounds i8, ptr %74, i64 8
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %.not10.5 = icmp eq ptr %76, null
  br i1 %.not10.5, label %._crit_edge.5, label %.lr.ph.5, !llvm.loop !13

._crit_edge.5:                                    ; preds = %.lr.ph.5, %.preheader.5
  %77 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %78

78:                                               ; preds = %._crit_edge.5, %65
  %79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { mustprogress nofree 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 = { nofree 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" }

!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++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTS10_hash_node", !11, i64 0, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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