; LLVM IR from xhub/reshop :: gui/external/imguial/imguial_term.ll (ZN7ImGuiAl3LogC2EPvm)

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

%"class.ImGuiAl::Log" = type { %"class.ImGuiAl::Crt.base", i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, [3 x i8], %struct.ImGuiTextFilter }
%"class.ImGuiAl::Crt.base" = type <{ %"class.ImGuiAl::Fifo", i32, i32, i8 }>
%"class.ImGuiAl::Fifo" = type { ptr, i64, i64, i64, i64 }
%struct.ImGuiTextFilter = type <{ [256 x i8], %struct.ImVector, i32, [4 x i8] }>
%struct.ImVector = type { i32, i32, ptr }

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7ImGuiAl3CrtC2EPvm(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef, i64 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7ImGuiAl3LogC2EPvm(ptr noundef nonnull align 8 dereferenceable(456) %0, ptr noundef %1, i64 noundef %2) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = load i64, ptr %6, align 8, !tbaa !9
  call void @_ZN7ImGuiAl3CrtC2EPvm(ptr noundef nonnull align 8 dereferenceable(49) %9, ptr noundef %10, i64 noundef %11)
  %12 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 13
  store ptr @.str.1, ptr %12, align 8, !tbaa !11
  %13 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 14
  store ptr @.str.2, ptr %13, align 8, !tbaa !20
  %14 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 15
  store ptr @.str.3, ptr %14, align 8, !tbaa !21
  %15 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 16
  store ptr @.str.4, ptr %15, align 8, !tbaa !22
  %16 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 17
  store ptr @.str.5, ptr %16, align 8, !tbaa !23
  %17 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 18
  store ptr @.str.6, ptr %17, align 8, !tbaa !24
  %18 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 19
  store ptr null, ptr %18, align 8, !tbaa !25
  %19 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 20
  store ptr null, ptr %19, align 8, !tbaa !26
  %20 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 21
  store i32 0, ptr %20, align 8, !tbaa !27
  %21 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 22
  store i8 1, ptr %21, align 4, !tbaa !28
  %22 = getelementptr inbounds %"class.ImGuiAl::Log", ptr %9, i32 0, i32 24
  call void @_ZN15ImGuiTextFilterC1EPKc(ptr noundef nonnull align 8 dereferenceable(276) %22, ptr noundef @.str.7)
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %9, i32 noundef 0, i32 noundef -43691)
          to label %23 unwind label %27

23:                                               ; preds = %3
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %9, i32 noundef 1, i32 noundef -11141291)
          to label %24 unwind label %27

24:                                               ; preds = %23
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %9, i32 noundef 2, i32 noundef -11141121)
          to label %25 unwind label %27

25:                                               ; preds = %24
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %9, i32 noundef 3, i32 noundef -11184641)
          to label %26 unwind label %27

26:                                               ; preds = %25
  ret void

27:                                               ; preds = %25, %24, %23, %3
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %7, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %8, align 4
  call void @_ZN15ImGuiTextFilterD2Ev(ptr noundef nonnull align 8 dereferenceable(276) %22) #3
  br label %31

31:                                               ; preds = %27
  %32 = load ptr, ptr %7, align 8
  %33 = load i32, ptr %8, align 4
  %34 = insertvalue { ptr, i32 } poison, ptr %32, 0
  %35 = insertvalue { ptr, i32 } %34, i32 %33, 1
  resume { ptr, i32 } %35
}

declare void @_ZN15ImGuiTextFilterC1EPKc(ptr noundef nonnull align 8 dereferenceable(276), ptr noundef) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456), i32 noundef, i32 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN15ImGuiTextFilterD2Ev(ptr noundef nonnull align 8 dereferenceable(276)) 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 = { "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" }
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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 104}
!12 = !{!"_ZTSN7ImGuiAl3LogE", !13, i64 0, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !15, i64 80, !15, i64 84, !15, i64 88, !15, i64 92, !15, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !17, i64 168, !16, i64 172, !18, i64 176}
!13 = !{!"_ZTSN7ImGuiAl3CrtE", !14, i64 0, !15, i64 40, !15, i64 44, !16, i64 48}
!14 = !{!"_ZTSN7ImGuiAl4FifoE", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32}
!15 = !{!"int", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSN7ImGuiAl3Log5LevelE", !7, i64 0}
!18 = !{!"_ZTS15ImGuiTextFilter", !7, i64 0, !19, i64 256, !15, i64 272}
!19 = !{!"_ZTS8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE", !15, i64 0, !15, i64 4, !6, i64 8}
!20 = !{!12, !6, i64 112}
!21 = !{!12, !6, i64 120}
!22 = !{!12, !6, i64 128}
!23 = !{!12, !6, i64 136}
!24 = !{!12, !6, i64 144}
!25 = !{!12, !6, i64 152}
!26 = !{!12, !6, i64 160}
!27 = !{!12, !17, i64 168}
!28 = !{!12, !16, i64 172}


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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7ImGuiAl3CrtC2EPvm(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef, i64 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7ImGuiAl3LogC2EPvm(ptr noundef nonnull align 8 dereferenceable(456) %0, ptr noundef %1, i64 noundef %2) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN7ImGuiAl3CrtC2EPvm(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %1, i64 noundef %2)
  %4 = getelementptr inbounds i8, ptr %0, i64 104
  store ptr @.str.1, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr @.str.2, ptr %5, align 8, !tbaa !18
  %6 = getelementptr inbounds i8, ptr %0, i64 120
  store ptr @.str.3, ptr %6, align 8, !tbaa !19
  %7 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr @.str.4, ptr %7, align 8, !tbaa !20
  %8 = getelementptr inbounds i8, ptr %0, i64 136
  store ptr @.str.5, ptr %8, align 8, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %0, i64 144
  store ptr @.str.6, ptr %9, align 8, !tbaa !22
  %10 = getelementptr inbounds i8, ptr %0, i64 152
  %11 = getelementptr inbounds i8, ptr %0, i64 172
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %10, i8 0, i64 20, i1 false)
  store i8 1, ptr %11, align 4, !tbaa !23
  %12 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @_ZN15ImGuiTextFilterC1EPKc(ptr noundef nonnull align 8 dereferenceable(276) %12, ptr noundef nonnull @.str.7)
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %0, i32 noundef 0, i32 noundef -43691)
          to label %13 unwind label %17

13:                                               ; preds = %3
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %0, i32 noundef 1, i32 noundef -11141291)
          to label %14 unwind label %17

14:                                               ; preds = %13
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %0, i32 noundef 2, i32 noundef -11141121)
          to label %15 unwind label %17

15:                                               ; preds = %14
  invoke void @_ZN7ImGuiAl3Log8setColorENS0_5LevelEj(ptr noundef nonnull align 8 dereferenceable(456) %0, i32 noundef 3, i32 noundef -11184641)
          to label %16 unwind label %17

16:                                               ; preds = %15
  ret void

17:                                               ; preds = %15, %14, %13, %3
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN15ImGuiTextFilterD2Ev(ptr noundef nonnull align 8 dereferenceable(276) %12) #4
  resume { ptr, i32 } %18
}

declare void @_ZN15ImGuiTextFilterC1EPKc(ptr noundef nonnull align 8 dereferenceable(276), ptr noundef) unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN15ImGuiTextFilterD2Ev(ptr noundef nonnull align 8 dereferenceable(276)) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { "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" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !9, i64 104}
!6 = !{!"_ZTSN7ImGuiAl3LogE", !7, i64 0, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !13, i64 88, !13, i64 92, !13, i64 96, !9, i64 104, !9, i64 112, !9, i64 120, !9, i64 128, !9, i64 136, !9, i64 144, !9, i64 152, !9, i64 160, !15, i64 168, !14, i64 172, !16, i64 176}
!7 = !{!"_ZTSN7ImGuiAl3CrtE", !8, i64 0, !13, i64 40, !13, i64 44, !14, i64 48}
!8 = !{!"_ZTSN7ImGuiAl4FifoE", !9, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"int", !10, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = !{!"_ZTSN7ImGuiAl3Log5LevelE", !10, i64 0}
!16 = !{!"_ZTS15ImGuiTextFilter", !10, i64 0, !17, i64 256, !13, i64 272}
!17 = !{!"_ZTS8ImVectorIN15ImGuiTextFilter14ImGuiTextRangeEE", !13, i64 0, !13, i64 4, !9, i64 8}
!18 = !{!6, !9, i64 112}
!19 = !{!6, !9, i64 120}
!20 = !{!6, !9, i64 128}
!21 = !{!6, !9, i64 136}
!22 = !{!6, !9, i64 144}
!23 = !{!6, !14, i64 172}


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