; LLVM IR from MostafaTwfiq/C-DataStructures-And-Algorithms :: Unit Test/Tests/DataStructuresTests/TreesTest/TrieTest (TrieTest)

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

; 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: nounwind uwtable
define dso_local i32 @checkOnlyWordCharactersExistInTheArrTrT(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %57, %2
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp slt i32 %11, 26
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  store i32 2, ptr %7, align 4
  br label %60

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %15, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %29, %14
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = load i8, ptr %17, align 1, !tbaa !11
  %19 = sext i8 %18 to i32
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %32

21:                                               ; preds = %16
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = load i8, ptr %22, align 1, !tbaa !11
  %24 = sext i8 %23 to i32
  %25 = sub nsw i32 %24, 97
  %26 = load i32, ptr %6, align 4, !tbaa !9
  %27 = icmp eq i32 %25, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %21
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %32

29:                                               ; preds = %21
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i32 1
  store ptr %31, ptr %8, align 8, !tbaa !5
  br label %16, !llvm.loop !12

32:                                               ; preds = %28, %16
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %42, label %35

35:                                               ; preds = %32
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %36, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %52, label %42

42:                                               ; preds = %35, %32
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %53

45:                                               ; preds = %42
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr %46, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %45, %35
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %54

53:                                               ; preds = %45, %42
  store i32 0, ptr %7, align 4
  br label %54

54:                                               ; preds = %53, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %55 = load i32, ptr %7, align 4
  switch i32 %55, label %60 [
    i32 0, label %56
  ]

56:                                               ; preds = %54
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %6, align 4, !tbaa !9
  br label %10, !llvm.loop !14

60:                                               ; preds = %54, %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %61 = load i32, ptr %7, align 4
  switch i32 %61, label %65 [
    i32 2, label %62
    i32 1, label %63
  ]

62:                                               ; preds = %60
  store i32 1, ptr %3, align 4
  br label %63

63:                                               ; preds = %62, %60
  %64 = load i32, ptr %3, align 4
  ret i32 %64

65:                                               ; preds = %60
  unreachable
}

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

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


; 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: nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) uwtable
define dso_local i32 @checkOnlyWordCharactersExistInTheArrTrT(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  %.not27 = icmp eq i8 %3, 0
  br i1 %.not27, label %.split.us, label %.preheader

.split.us:                                        ; preds = %2
  %4 = load i32, ptr %0, align 4, !tbaa !8
  %.not22.us32 = icmp eq i32 %4, 0
  br i1 %.not22.us32, label %.critedge26.us.preheader, label %.split31.us

.critedge26.us.preheader:                         ; preds = %.split.us
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !8
  %.not22.us = icmp eq i32 %6, 0
  br i1 %.not22.us, label %.critedge26.us.1, label %.split31.us, !llvm.loop !10

.critedge26.us.1:                                 ; preds = %.critedge26.us.preheader
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 4, !tbaa !8
  %.not22.us.1 = icmp eq i32 %8, 0
  br i1 %.not22.us.1, label %.critedge26.us.2, label %.split31.us, !llvm.loop !10

.critedge26.us.2:                                 ; preds = %.critedge26.us.1
  %9 = getelementptr inbounds i8, ptr %0, i64 12
  %10 = load i32, ptr %9, align 4, !tbaa !8
  %.not22.us.2 = icmp eq i32 %10, 0
  br i1 %.not22.us.2, label %.critedge26.us.3, label %.split31.us, !llvm.loop !10

.critedge26.us.3:                                 ; preds = %.critedge26.us.2
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load i32, ptr %11, align 4, !tbaa !8
  %.not22.us.3 = icmp eq i32 %12, 0
  br i1 %.not22.us.3, label %.critedge26.us.4, label %.split31.us, !llvm.loop !10

.critedge26.us.4:                                 ; preds = %.critedge26.us.3
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  %14 = load i32, ptr %13, align 4, !tbaa !8
  %.not22.us.4 = icmp eq i32 %14, 0
  br i1 %.not22.us.4, label %.critedge26.us.5, label %.split31.us, !llvm.loop !10

.critedge26.us.5:                                 ; preds = %.critedge26.us.4
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %16 = load i32, ptr %15, align 4, !tbaa !8
  %.not22.us.5 = icmp eq i32 %16, 0
  br i1 %.not22.us.5, label %.critedge26.us.6, label %.split31.us, !llvm.loop !10

.critedge26.us.6:                                 ; preds = %.critedge26.us.5
  %17 = getelementptr inbounds i8, ptr %0, i64 28
  %18 = load i32, ptr %17, align 4, !tbaa !8
  %.not22.us.6 = icmp eq i32 %18, 0
  br i1 %.not22.us.6, label %.critedge26.us.7, label %.split31.us, !llvm.loop !10

.critedge26.us.7:                                 ; preds = %.critedge26.us.6
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = load i32, ptr %19, align 4, !tbaa !8
  %.not22.us.7 = icmp eq i32 %20, 0
  br i1 %.not22.us.7, label %.critedge26.us.8, label %.split31.us, !llvm.loop !10

.critedge26.us.8:                                 ; preds = %.critedge26.us.7
  %21 = getelementptr inbounds i8, ptr %0, i64 36
  %22 = load i32, ptr %21, align 4, !tbaa !8
  %.not22.us.8 = icmp eq i32 %22, 0
  br i1 %.not22.us.8, label %.critedge26.us.9, label %.split31.us, !llvm.loop !10

.critedge26.us.9:                                 ; preds = %.critedge26.us.8
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = load i32, ptr %23, align 4, !tbaa !8
  %.not22.us.9 = icmp eq i32 %24, 0
  br i1 %.not22.us.9, label %.critedge26.us.10, label %.split31.us, !llvm.loop !10

.critedge26.us.10:                                ; preds = %.critedge26.us.9
  %25 = getelementptr inbounds i8, ptr %0, i64 44
  %26 = load i32, ptr %25, align 4, !tbaa !8
  %.not22.us.10 = icmp eq i32 %26, 0
  br i1 %.not22.us.10, label %.critedge26.us.11, label %.split31.us, !llvm.loop !10

.critedge26.us.11:                                ; preds = %.critedge26.us.10
  %27 = getelementptr inbounds i8, ptr %0, i64 48
  %28 = load i32, ptr %27, align 4, !tbaa !8
  %.not22.us.11 = icmp eq i32 %28, 0
  br i1 %.not22.us.11, label %.critedge26.us.12, label %.split31.us, !llvm.loop !10

.critedge26.us.12:                                ; preds = %.critedge26.us.11
  %29 = getelementptr inbounds i8, ptr %0, i64 52
  %30 = load i32, ptr %29, align 4, !tbaa !8
  %.not22.us.12 = icmp eq i32 %30, 0
  br i1 %.not22.us.12, label %.critedge26.us.13, label %.split31.us, !llvm.loop !10

.critedge26.us.13:                                ; preds = %.critedge26.us.12
  %31 = getelementptr inbounds i8, ptr %0, i64 56
  %32 = load i32, ptr %31, align 4, !tbaa !8
  %.not22.us.13 = icmp eq i32 %32, 0
  br i1 %.not22.us.13, label %.critedge26.us.14, label %.split31.us, !llvm.loop !10

.critedge26.us.14:                                ; preds = %.critedge26.us.13
  %33 = getelementptr inbounds i8, ptr %0, i64 60
  %34 = load i32, ptr %33, align 4, !tbaa !8
  %.not22.us.14 = icmp eq i32 %34, 0
  br i1 %.not22.us.14, label %.critedge26.us.15, label %.split31.us, !llvm.loop !10

.critedge26.us.15:                                ; preds = %.critedge26.us.14
  %35 = getelementptr inbounds i8, ptr %0, i64 64
  %36 = load i32, ptr %35, align 4, !tbaa !8
  %.not22.us.15 = icmp eq i32 %36, 0
  br i1 %.not22.us.15, label %.critedge26.us.16, label %.split31.us, !llvm.loop !10

.critedge26.us.16:                                ; preds = %.critedge26.us.15
  %37 = getelementptr inbounds i8, ptr %0, i64 68
  %38 = load i32, ptr %37, align 4, !tbaa !8
  %.not22.us.16 = icmp eq i32 %38, 0
  br i1 %.not22.us.16, label %.critedge26.us.17, label %.split31.us, !llvm.loop !10

.critedge26.us.17:                                ; preds = %.critedge26.us.16
  %39 = getelementptr inbounds i8, ptr %0, i64 72
  %40 = load i32, ptr %39, align 4, !tbaa !8
  %.not22.us.17 = icmp eq i32 %40, 0
  br i1 %.not22.us.17, label %.critedge26.us.18, label %.split31.us, !llvm.loop !10

.critedge26.us.18:                                ; preds = %.critedge26.us.17
  %41 = getelementptr inbounds i8, ptr %0, i64 76
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %.not22.us.18 = icmp eq i32 %42, 0
  br i1 %.not22.us.18, label %.critedge26.us.19, label %.split31.us, !llvm.loop !10

.critedge26.us.19:                                ; preds = %.critedge26.us.18
  %43 = getelementptr inbounds i8, ptr %0, i64 80
  %44 = load i32, ptr %43, align 4, !tbaa !8
  %.not22.us.19 = icmp eq i32 %44, 0
  br i1 %.not22.us.19, label %.critedge26.us.20, label %.split31.us, !llvm.loop !10

.critedge26.us.20:                                ; preds = %.critedge26.us.19
  %45 = getelementptr inbounds i8, ptr %0, i64 84
  %46 = load i32, ptr %45, align 4, !tbaa !8
  %.not22.us.20 = icmp eq i32 %46, 0
  br i1 %.not22.us.20, label %.critedge26.us.21, label %.split31.us, !llvm.loop !10

.critedge26.us.21:                                ; preds = %.critedge26.us.20
  %47 = getelementptr inbounds i8, ptr %0, i64 88
  %48 = load i32, ptr %47, align 4, !tbaa !8
  %.not22.us.21 = icmp eq i32 %48, 0
  br i1 %.not22.us.21, label %.critedge26.us.22, label %.split31.us, !llvm.loop !10

.critedge26.us.22:                                ; preds = %.critedge26.us.21
  %49 = getelementptr inbounds i8, ptr %0, i64 92
  %50 = load i32, ptr %49, align 4, !tbaa !8
  %.not22.us.22 = icmp eq i32 %50, 0
  br i1 %.not22.us.22, label %.critedge26.us.23, label %.split31.us, !llvm.loop !10

.critedge26.us.23:                                ; preds = %.critedge26.us.22
  %51 = getelementptr inbounds i8, ptr %0, i64 96
  %52 = load i32, ptr %51, align 4, !tbaa !8
  %.not22.us.23 = icmp eq i32 %52, 0
  br i1 %.not22.us.23, label %.critedge26.us.24, label %.split31.us, !llvm.loop !10

.critedge26.us.24:                                ; preds = %.critedge26.us.23
  %53 = getelementptr inbounds i8, ptr %0, i64 100
  %54 = load i32, ptr %53, align 4, !tbaa !8
  %.not22.us.24 = icmp eq i32 %54, 0
  br label %.split31.us, !llvm.loop !10

.preheader:                                       ; preds = %2, %.critedge26
  %indvars.iv = phi i64 [ %indvars.iv.next, %.critedge26 ], [ 0, %2 ]
  %55 = phi i1 [ %70, %.critedge26 ], [ false, %2 ]
  br label %59

56:                                               ; preds = %59
  %57 = getelementptr inbounds i8, ptr %.01528, i64 1
  %58 = load i8, ptr %57, align 1, !tbaa !5
  %.not = icmp eq i8 %58, 0
  br i1 %.not, label %..critedge_crit_edge, label %59, !llvm.loop !12

59:                                               ; preds = %.preheader, %56
  %60 = phi i8 [ %3, %.preheader ], [ %58, %56 ]
  %.01528 = phi ptr [ %1, %.preheader ], [ %57, %56 ]
  %61 = sext i8 %60 to i64
  %62 = add nsw i64 %61, 4294967199
  %63 = and i64 %62, 4294967295
  %64 = icmp eq i64 %63, %indvars.iv
  br i1 %64, label %.critedge24, label %56

..critedge_crit_edge:                             ; preds = %56
  %65 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
  %66 = load i32, ptr %65, align 4, !tbaa !8
  %.not22 = icmp eq i32 %66, 0
  br i1 %.not22, label %.critedge26, label %.split31.us

.critedge24:                                      ; preds = %59
  %67 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
  %68 = load i32, ptr %67, align 4, !tbaa !8
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %.split31.us, label %.critedge26

.critedge26:                                      ; preds = %..critedge_crit_edge, %.critedge24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %70 = icmp ugt i64 %indvars.iv, 24
  %exitcond = icmp eq i64 %indvars.iv.next, 26
  br i1 %exitcond, label %.split31.us, label %.preheader, !llvm.loop !10

.split31.us:                                      ; preds = %.critedge26, %..critedge_crit_edge, %.critedge24, %.critedge26.us.24, %.critedge26.us.preheader, %.critedge26.us.1, %.critedge26.us.2, %.critedge26.us.3, %.critedge26.us.4, %.critedge26.us.5, %.critedge26.us.6, %.critedge26.us.7, %.critedge26.us.8, %.critedge26.us.9, %.critedge26.us.10, %.critedge26.us.11, %.critedge26.us.12, %.critedge26.us.13, %.critedge26.us.14, %.critedge26.us.15, %.critedge26.us.16, %.critedge26.us.17, %.critedge26.us.18, %.critedge26.us.19, %.critedge26.us.20, %.critedge26.us.21, %.critedge26.us.22, %.critedge26.us.23, %.split.us
  %.us-phi = phi i1 [ false, %.split.us ], [ false, %.critedge26.us.preheader ], [ false, %.critedge26.us.1 ], [ false, %.critedge26.us.2 ], [ false, %.critedge26.us.3 ], [ false, %.critedge26.us.4 ], [ false, %.critedge26.us.5 ], [ false, %.critedge26.us.6 ], [ false, %.critedge26.us.7 ], [ false, %.critedge26.us.8 ], [ false, %.critedge26.us.9 ], [ false, %.critedge26.us.10 ], [ false, %.critedge26.us.11 ], [ false, %.critedge26.us.12 ], [ false, %.critedge26.us.13 ], [ false, %.critedge26.us.14 ], [ false, %.critedge26.us.15 ], [ false, %.critedge26.us.16 ], [ false, %.critedge26.us.17 ], [ false, %.critedge26.us.18 ], [ false, %.critedge26.us.19 ], [ false, %.critedge26.us.20 ], [ false, %.critedge26.us.21 ], [ false, %.critedge26.us.22 ], [ false, %.critedge26.us.23 ], [ %.not22.us.24, %.critedge26.us.24 ], [ %55, %.critedge24 ], [ %55, %..critedge_crit_edge ], [ %70, %.critedge26 ]
  %spec.select = zext i1 %.us-phi to i32
  ret i32 %spec.select
}

attributes #0 = { nofree norecurse nosync nounwind memory(read, inaccessiblemem: none) 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" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass