; LLVM IR from AllAlgorithms/c :: algorithms/data-structures (trie)

; 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 [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @getNewTrieNode() #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: nounwind uwtable
declare dso_local void @insert(ptr noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %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) #3
  %3 = call ptr @getNewTrieNode()
  store ptr %3, ptr %2, align 8, !tbaa !5
  %4 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  call void @insert(ptr noundef %5, ptr noundef @.str.1)
  %6 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = call i32 @search(ptr noundef %7, ptr noundef @.str.1)
  %9 = icmp eq i32 %8, 1
  br i1 %9, label %10, label %12

10:                                               ; preds = %0
  %11 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %14

12:                                               ; preds = %0
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  br label %14

14:                                               ; preds = %12, %10
  %15 = phi i32 [ %11, %10 ], [ %13, %12 ]
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  call void @insert(ptr noundef %17, ptr noundef @.str.6)
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call i32 @search(ptr noundef %19, ptr noundef @.str.6)
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %24

22:                                               ; preds = %14
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %26

24:                                               ; preds = %14
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %26

26:                                               ; preds = %24, %22
  %27 = phi i32 [ %23, %22 ], [ %25, %24 ]
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = call i32 @search(ptr noundef %29, ptr noundef @.str.11)
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %34

32:                                               ; preds = %26
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %36

34:                                               ; preds = %26
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %36

36:                                               ; preds = %34, %32
  %37 = phi i32 [ %33, %32 ], [ %35, %34 ]
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %39 = call i32 @deletion(ptr noundef %2, ptr noundef @.str.1)
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = call i32 @search(ptr noundef %41, ptr noundef @.str.1)
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %44, label %46

44:                                               ; preds = %36
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  br label %48

46:                                               ; preds = %36
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  br label %48

48:                                               ; preds = %46, %44
  %49 = phi i32 [ %45, %44 ], [ %47, %46 ]
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = call i32 @search(ptr noundef %51, ptr noundef @.str.6)
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %56

54:                                               ; preds = %48
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  br label %58

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

58:                                               ; preds = %56, %54
  %59 = phi i32 [ %55, %54 ], [ %57, %56 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  ret i32 0
}

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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/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 [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @getNewTrieNode() 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: nounwind uwtable
declare dso_local void @insert(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  %2 = tail call ptr @getNewTrieNode()
  store ptr %2, ptr %1, align 8, !tbaa !5
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  tail call void @insert(ptr noundef %2, ptr noundef nonnull @.str.1)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %5 = tail call i32 @search(ptr noundef %2, ptr noundef nonnull @.str.1)
  %6 = icmp eq i32 %5, 1
  %.str.3..str.4 = select i1 %6, ptr @.str.3, ptr @.str.4
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.3..str.4)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  tail call void @insert(ptr noundef %2, ptr noundef nonnull @.str.6)
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %10 = tail call i32 @search(ptr noundef %2, ptr noundef nonnull @.str.6)
  %11 = icmp eq i32 %10, 1
  %.str.9.sink = select i1 %11, ptr @.str.8, ptr @.str.9
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.9.sink)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %14 = tail call i32 @search(ptr noundef %2, ptr noundef nonnull @.str.11)
  %15 = icmp eq i32 %14, 1
  %.str.13.sink = select i1 %15, ptr @.str.12, ptr @.str.13
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.13.sink)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %18 = call i32 @deletion(ptr noundef nonnull %1, ptr noundef nonnull @.str.1)
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %20 = load ptr, ptr %1, align 8, !tbaa !5
  %21 = call i32 @search(ptr noundef %20, ptr noundef nonnull @.str.1)
  %22 = icmp eq i32 %21, 1
  %.str.16.sink = select i1 %22, ptr @.str.15, ptr @.str.16
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.16.sink)
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %25 = load ptr, ptr %1, align 8, !tbaa !5
  %26 = call i32 @search(ptr noundef %25, ptr noundef nonnull @.str.6)
  %27 = icmp eq i32 %26, 1
  %.str.18.sink = select i1 %27, ptr @.str.17, ptr @.str.18
  %28 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.18.sink)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret i32 0
}

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

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


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