; LLVM IR from hadryansalles/Luz :: deps/imgui/imgui.ll (ZNK15ImGuiTextFilter10PassFilterEPKcS1_)

; 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.ImGuiTextFilter = type <{ [256 x i8], %struct.ImVector.37, i32, [4 x i8] }>
%struct.ImVector.37 = type { i32, i32, ptr }
%"struct.ImGuiTextFilter::ImGuiTextRange" = type { ptr, ptr }

@.str.17 = external hidden unnamed_addr constant [1 x i8], align 1

; 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 uwtable
declare dso_local noundef ptr @_Z9ImStristrPKcS0_S0_S0_(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK15ImGuiTextFilter14ImGuiTextRange5emptyEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK15ImGuiTextFilter10PassFilterEPKcS1_(ptr noundef nonnull align 8 dereferenceable(276) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8
  %14 = getelementptr inbounds %struct.ImGuiTextFilter, ptr %13, i32 0, i32 1
  %15 = call noundef zeroext i1 @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(16) %14)
  br i1 %15, label %16, label %17

16:                                               ; preds = %3
  store i1 true, ptr %4, align 1
  br label %87

17:                                               ; preds = %3
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  store ptr @.str.17, ptr %6, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %20, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %22 = getelementptr inbounds %struct.ImGuiTextFilter, ptr %13, i32 0, i32 1
  store ptr %22, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = call noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %23)
  store ptr %24, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = call noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %25)
  store ptr %26, ptr %10, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %76, %21
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = icmp ne ptr %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 2, ptr %11, align 4
  br label %79

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %33, ptr %12, align 8, !tbaa !5
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = call noundef zeroext i1 @_ZNK15ImGuiTextFilter14ImGuiTextRange5emptyEv(ptr noundef nonnull align 8 dereferenceable(16) %34)
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store i32 3, ptr %11, align 4
  br label %73

37:                                               ; preds = %32
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.ImGuiTextFilter::ImGuiTextRange", ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %40, i64 0
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = sext i8 %42 to i32
  %44 = icmp eq i32 %43, 45
  br i1 %44, label %45, label %59

45:                                               ; preds = %37
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.ImGuiTextFilter::ImGuiTextRange", ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds i8, ptr %50, i64 1
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.ImGuiTextFilter::ImGuiTextRange", ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !12
  %55 = call noundef ptr @_Z9ImStristrPKcS0_S0_S0_(ptr noundef %46, ptr noundef %47, ptr noundef %51, ptr noundef %54)
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %58

57:                                               ; preds = %45
  store i1 false, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %73

58:                                               ; preds = %45
  br label %72

59:                                               ; preds = %37
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.ImGuiTextFilter::ImGuiTextRange", ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.ImGuiTextFilter::ImGuiTextRange", ptr %65, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !12
  %68 = call noundef ptr @_Z9ImStristrPKcS0_S0_S0_(ptr noundef %60, ptr noundef %61, ptr noundef %64, ptr noundef %67)
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %71

70:                                               ; preds = %59
  store i1 true, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %73

71:                                               ; preds = %59
  br label %72

72:                                               ; preds = %71, %58
  store i32 0, ptr %11, align 4
  br label %73

73:                                               ; preds = %72, %70, %57, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %74 = load i32, ptr %11, align 4
  switch i32 %74, label %79 [
    i32 0, label %75
    i32 3, label %76
  ]

75:                                               ; preds = %73
  br label %76

76:                                               ; preds = %75, %73
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.ImGuiTextFilter::ImGuiTextRange", ptr %77, i32 1
  store ptr %78, ptr %9, align 8, !tbaa !5
  br label %27

79:                                               ; preds = %73, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %80 = load i32, ptr %11, align 4
  switch i32 %80, label %89 [
    i32 2, label %81
    i32 1, label %87
  ]

81:                                               ; preds = %79
  %82 = getelementptr inbounds %struct.ImGuiTextFilter, ptr %13, i32 0, i32 2
  %83 = load i32, ptr %82, align 8, !tbaa !13
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store i1 true, ptr %4, align 1
  br label %87

86:                                               ; preds = %81
  store i1 false, ptr %4, align 1
  br label %87

87:                                               ; preds = %86, %85, %79, %16
  %88 = load i1, ptr %4, align 1
  ret i1 %88

89:                                               ; preds = %79
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { inlinehint 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 #4 = { 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 0}
!10 = !{!"_ZTSN15ImGuiTextFilter14ImGuiTextRangeE", !6, i64 0, !6, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!14, !16, i64 272}
!14 = !{!"_ZTS15ImGuiTextFilter", !7, i64 0, !15, i64 256, !16, i64 272}
!15 = !{!"_ZTS8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE", !16, i64 0, !16, i64 4, !6, i64 8}
!16 = !{!"int", !7, i64 0}


; 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.17 = external hidden unnamed_addr constant [1 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK15ImGuiTextFilter14ImGuiTextRange5emptyEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK15ImGuiTextFilter10PassFilterEPKcS1_(ptr noundef nonnull align 8 dereferenceable(276) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 256
  %5 = tail call noundef zeroext i1 @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  br i1 %5, label %.loopexit, label %6

6:                                                ; preds = %3
  %7 = icmp eq ptr %1, null
  %spec.store.select = select i1 %7, ptr @.str.17, ptr %1
  %8 = tail call noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %9 = tail call noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %.not32 = icmp eq ptr %8, %9
  br i1 %.not32, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %6, %23
  %.02233 = phi ptr [ %24, %23 ], [ %8, %6 ]
  %10 = tail call noundef zeroext i1 @_ZNK15ImGuiTextFilter14ImGuiTextRange5emptyEv(ptr noundef nonnull align 8 dereferenceable(16) %.02233)
  br i1 %10, label %23, label %11

11:                                               ; preds = %.lr.ph
  %12 = load ptr, ptr %.02233, align 8, !tbaa !5
  %13 = load i8, ptr %12, align 1, !tbaa !10
  %.not34.not = icmp ne i8 %13, 45
  br i1 %.not34.not, label %19, label %14

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %12, i64 1
  %16 = getelementptr inbounds i8, ptr %.02233, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = tail call noundef ptr @_Z9ImStristrPKcS0_S0_S0_(ptr noundef nonnull %spec.store.select, ptr noundef %2, ptr noundef nonnull %15, ptr noundef %17)
  %.not24 = icmp eq ptr %18, null
  br i1 %.not24, label %23, label %.loopexit

19:                                               ; preds = %11
  %20 = getelementptr inbounds i8, ptr %.02233, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = tail call noundef ptr @_Z9ImStristrPKcS0_S0_S0_(ptr noundef nonnull %spec.store.select, ptr noundef %2, ptr noundef nonnull %12, ptr noundef %21)
  %.not23 = icmp eq ptr %22, null
  br i1 %.not23, label %23, label %.loopexit

23:                                               ; preds = %14, %19, %.lr.ph
  %24 = getelementptr inbounds i8, ptr %.02233, i64 16
  %.not = icmp eq ptr %24, %9
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %23, %6
  %25 = getelementptr inbounds i8, ptr %0, i64 272
  %26 = load i32, ptr %25, align 8, !tbaa !12
  %27 = icmp eq i32 %26, 0
  br label %.loopexit

.loopexit:                                        ; preds = %19, %14, %._crit_edge, %3
  %.3 = phi i1 [ true, %3 ], [ %27, %._crit_edge ], [ %.not34.not, %14 ], [ %.not34.not, %19 ]
  ret i1 %.3
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE3endEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

attributes #0 = { 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 #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 = { inlinehint 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" }

!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, !7, i64 0}
!6 = !{!"_ZTSN15ImGuiTextFilter14ImGuiTextRangeE", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{!6, !7, i64 8}
!12 = !{!13, !15, i64 272}
!13 = !{!"_ZTS15ImGuiTextFilter", !8, i64 0, !14, i64 256, !15, i64 272}
!14 = !{!"_ZTS8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE", !15, i64 0, !15, i64 4, !7, i64 8}
!15 = !{!"int", !8, i64 0}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass