; LLVM IR from JessonYue/LeetCodeLearning :: Array/yangxin/第五周练习6_28-7_4/LinkListHash缺省方法补全 (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 }

; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z14hash_deleteKeyP11_hash_tablei(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %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 i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp eq ptr null, %9
  br i1 %10, label %20, label %11

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._hash_table, ptr %12, i32 0, i32 0
  %14 = load i32, ptr %5, align 4, !tbaa !9
  %15 = srem i32 %14, 6
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [6 x ptr], ptr %13, i64 0, i64 %16
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %11, %2
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %60

21:                                               ; preds = %11
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._hash_table, ptr %22, i32 0, i32 0
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = srem i32 %24, 6
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [6 x ptr], ptr %23, i64 0, i64 %26
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._hash_node, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  store ptr %30, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._hash_table, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = srem i32 %33, 6
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [6 x ptr], ptr %32, i64 0, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  store ptr %37, ptr %8, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %48, %21
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = icmp ne ptr null, %39
  br i1 %40, label %41, label %53

41:                                               ; preds = %38
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._hash_node, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !13
  %46 = icmp eq i32 %42, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %41
  br label %53

48:                                               ; preds = %41
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %49, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._hash_node, ptr %50, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  store ptr %52, ptr %6, align 8, !tbaa !5
  br label %38, !llvm.loop !14

53:                                               ; preds = %47, %38
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._hash_node, ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._hash_node, ptr %57, i32 0, i32 1
  store ptr %56, ptr %58, align 8, !tbaa !11
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %59) #3
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %60

60:                                               ; preds = %53, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %61 = load i1, ptr %3, align 1
  ret i1 %61
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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++ 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"}


; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z14hash_deleteKeyP11_hash_tablei(ptr noundef readonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  br i1 %3, label %16, label %4

4:                                                ; preds = %2
  %5 = srem i32 %1, 6
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds [6 x ptr], ptr %0, i64 0, i64 %6
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %16, label %.preheader

.preheader:                                       ; preds = %4, %10
  %.0 = phi ptr [ %.015, %10 ], [ %8, %4 ]
  %.015.in = getelementptr inbounds i8, ptr %.0, i64 8
  %.015 = load ptr, ptr %.015.in, align 8, !tbaa !9
  %.not = icmp eq ptr %.015, null
  br i1 %.not, label %13, label %10

10:                                               ; preds = %.preheader
  %11 = load i32, ptr %.015, align 8, !tbaa !12
  %12 = icmp eq i32 %11, %1
  br i1 %12, label %13, label %.preheader, !llvm.loop !13

13:                                               ; preds = %10, %.preheader
  %.015.in.le = getelementptr inbounds i8, ptr %.0, i64 8
  %14 = getelementptr inbounds i8, ptr %.015, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %.015.in.le, align 8, !tbaa !9
  tail call void @free(ptr noundef %.015) #2
  br label %16

16:                                               ; preds = %2, %4, %13
  %.016 = phi i1 [ true, %13 ], [ false, %4 ], [ false, %2 ]
  ret i1 %.016
}

; 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 = { mustprogress 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++ 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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass