; LLVM IR from JessonYue/LeetCodeLearning :: Array/zhanchengguo/0727-LRU缓存机制 (LRUCache)

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

@.str = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  %5 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 80) #7
  invoke void @_ZN8LRUCacheC2Ei(ptr noundef nonnull align 8 dereferenceable(80) %5, i32 noundef 2)
          to label %6 unwind label %40

6:                                                ; preds = %0
  store ptr %5, ptr %2, align 8, !tbaa !5
  %7 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %8, i32 noundef 1, i32 noundef 1)
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %11, i32 noundef 2, i32 noundef 2)
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %12)
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %14, i32 noundef 1)
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %16)
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %18, i32 noundef 3, i32 noundef 3)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %19)
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %21, i32 noundef 2)
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %23)
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %25, i32 noundef 4, i32 noundef 4)
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %26)
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %28, i32 noundef 1)
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %29)
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %31)
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %33, i32 noundef 3)
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %35)
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %37, i32 noundef 4)
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %39)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  ret i32 0

40:                                               ; preds = %0
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %3, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %5, i64 noundef 80) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %44

44:                                               ; preds = %40
  %45 = load ptr, ptr %3, align 8
  %46 = load i32, ptr %4, align 4
  %47 = insertvalue { ptr, i32 } poison, ptr %45, 0
  %48 = insertvalue { ptr, i32 } %47, i32 %46, 1
  resume { ptr, i32 } %48
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LRUCacheC2Ei(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) #3 align 2

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

attributes #0 = { mustprogress norecurse 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin allocsize(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 = { 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 #4 = { nobuiltin 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 #5 = { "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 #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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"}


; 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 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = tail call noalias noundef nonnull dereferenceable(80) ptr @_Znwm(i64 noundef 80) #5
  invoke void @_ZN8LRUCacheC2Ei(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 2)
          to label %2 unwind label %18

2:                                                ; preds = %0
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  tail call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 1, i32 noundef 1)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  tail call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 2, i32 noundef 2)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %6 = tail call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 1)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  tail call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 3, i32 noundef 3)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %9 = tail call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 2)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  tail call void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 4, i32 noundef 4)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %12 = tail call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 1)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %12)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %15 = tail call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 3)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %17 = tail call noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80) %1, i32 noundef 4)
  tail call void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80) %1)
  ret i32 0

18:                                               ; preds = %0
  %19 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %1, i64 noundef 80) #6
  resume { ptr, i32 } %19
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LRUCacheC2Ei(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LRUCache3putEii(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LRUCache11printfCacheEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN8LRUCache3getEi(ptr noundef nonnull align 8 dereferenceable(80), i32 noundef) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse 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 = { nobuiltin allocsize(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 = { 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 #3 = { nobuiltin 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 #4 = { 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" }
attributes #5 = { builtin allocsize(0) }
attributes #6 = { builtin 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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass