; LLVM IR from ahampriyanshu/algo-ds-101 :: Algorithms/Searching/Trie-Search (Trie_Search)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z14getNewTrieNodev() #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6insertP4TriePc(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6searchP4TriePc(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8deletionPP4TriePc(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %3 = call noundef ptr @_Z14getNewTrieNodev()
  store ptr %3, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z6insertP4TriePc(ptr noundef %4, ptr noundef @.str)
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %5, ptr noundef @.str)
  %7 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %6)
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z6insertP4TriePc(ptr noundef %8, ptr noundef @.str.2)
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %9, ptr noundef @.str.2)
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %10)
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %12, ptr noundef @.str.3)
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %13)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z6insertP4TriePc(ptr noundef %15, ptr noundef @.str.4)
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %16, ptr noundef @.str.4)
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %17)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z6insertP4TriePc(ptr noundef %19, ptr noundef @.str.5)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %20, ptr noundef @.str.5)
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %21)
  %23 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef %2, ptr noundef @.str)
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %24, ptr noundef @.str)
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %25)
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %27, ptr noundef @.str.2)
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %28)
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %30, ptr noundef @.str.4)
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %31)
  %33 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef %2, ptr noundef @.str.5)
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %34, ptr noundef @.str.5)
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %35)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %37, ptr noundef @.str.4)
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %38)
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %40, ptr noundef @.str.2)
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %41)
  %43 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef %2, ptr noundef @.str.2)
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %44, ptr noundef @.str.2)
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %45)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %47, ptr noundef @.str.4)
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %48)
  %50 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef %2, ptr noundef @.str.4)
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %51, ptr noundef @.str.4)
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %52)
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %58

56:                                               ; preds = %0
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %58

58:                                               ; preds = %56, %0
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %59, ptr noundef @.str.4)
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %60)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  ret i32 0
}

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { "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 = { 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 [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_Z14getNewTrieNodev() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6insertP4TriePc(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6searchP4TriePc(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8deletionPP4TriePc(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %2 = tail call noundef ptr @_Z14getNewTrieNodev()
  store ptr %2, ptr %1, align 8, !tbaa !5
  tail call void @_Z6insertP4TriePc(ptr noundef %2, ptr noundef nonnull @.str)
  %3 = tail call noundef i32 @_Z6searchP4TriePc(ptr noundef %2, ptr noundef nonnull @.str)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %3)
  tail call void @_Z6insertP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.2)
  %5 = tail call noundef i32 @_Z6searchP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.2)
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %5)
  %7 = tail call noundef i32 @_Z6searchP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.3)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %7)
  tail call void @_Z6insertP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.4)
  %9 = tail call noundef i32 @_Z6searchP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.4)
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %9)
  tail call void @_Z6insertP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.5)
  %11 = tail call noundef i32 @_Z6searchP4TriePc(ptr noundef %2, ptr noundef nonnull @.str.5)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %11)
  %13 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef nonnull %1, ptr noundef nonnull @.str)
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %14, ptr noundef nonnull @.str)
  %16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15)
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %17, ptr noundef nonnull @.str.2)
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
  %20 = load ptr, ptr %1, align 8, !tbaa !5
  %21 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %20, ptr noundef nonnull @.str.4)
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %21)
  %23 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef nonnull %1, ptr noundef nonnull @.str.5)
  %24 = load ptr, ptr %1, align 8, !tbaa !5
  %25 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %24, ptr noundef nonnull @.str.5)
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %25)
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %27, ptr noundef nonnull @.str.4)
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %28)
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  %31 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %30, ptr noundef nonnull @.str.2)
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %31)
  %33 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef nonnull %1, ptr noundef nonnull @.str.2)
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %34, ptr noundef nonnull @.str.2)
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %35)
  %37 = load ptr, ptr %1, align 8, !tbaa !5
  %38 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %37, ptr noundef nonnull @.str.4)
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %38)
  %40 = call noundef i32 @_Z8deletionPP4TriePc(ptr noundef nonnull %1, ptr noundef nonnull @.str.4)
  %41 = load ptr, ptr %1, align 8, !tbaa !5
  %42 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %41, ptr noundef nonnull @.str.4)
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %42)
  %44 = load ptr, ptr %1, align 8, !tbaa !5
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %48

46:                                               ; preds = %0
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %.pre = load ptr, ptr %1, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %46, %0
  %49 = phi ptr [ %.pre, %46 ], [ %44, %0 ]
  %50 = call noundef i32 @_Z6searchP4TriePc(ptr noundef %49, ptr noundef nonnull @.str.4)
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %50)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0
}

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

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


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