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

; 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.ImFontAtlas = type <{ i32, [4 x i8], ptr, i32, i32, i8, [7 x i8], ptr, i8, i8, [6 x i8], ptr, ptr, i32, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVector.8, %struct.ImVector.9, %struct.ImVector.10, [64 x %struct.ImVec4], ptr, i32, i32, i32, [4 x i8] }>
%struct.ImVec2 = type { float, float }
%struct.ImVector.8 = type { i32, i32, ptr }
%struct.ImVector.9 = type { i32, i32, ptr }
%struct.ImVector.10 = type { i32, i32, ptr }
%struct.ImVec4 = type { float, float, float, float }
%struct.ImFontConfig = type { ptr, i32, i8, i32, float, i32, i32, i8, %struct.ImVec2, %struct.ImVec2, ptr, float, float, i8, i32, float, float, i16, [40 x i8], ptr }
%struct.ImFont = type <{ %struct.ImVector.6, float, float, %struct.ImVector.1, %struct.ImVector.7, ptr, ptr, ptr, i16, i16, i16, i16, float, float, i8, [3 x i8], float, float, float, i32, [2 x i8], [2 x i8] }>
%struct.ImVector.6 = type { i32, i32, ptr }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.7 = type { i32, i32, ptr }

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN8ImVectorI12ImFontConfigE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z35ImFontAtlasUpdateConfigDataPointersP11ImFontAtlas(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ImFontAtlas, ptr %8, i32 0, i32 19
  store ptr %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call noundef ptr @_ZN8ImVectorI12ImFontConfigE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  store ptr %11, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = call noundef ptr @_ZN8ImVectorI12ImFontConfigE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  store ptr %13, ptr %5, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %39, %1
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %42

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %20, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ImFontConfig, ptr %21, i32 0, i32 19
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  store ptr %23, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ImFontConfig, ptr %24, i32 0, i32 13
  %26 = load i8, ptr %25, align 8, !tbaa !16, !range !17, !noundef !18
  %27 = trunc i8 %26 to i1
  br i1 %27, label %34, label %28

28:                                               ; preds = %19
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ImFont, ptr %30, i32 0, i32 7
  store ptr %29, ptr %31, align 8, !tbaa !19
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ImFont, ptr %32, i32 0, i32 8
  store i16 0, ptr %33, align 8, !tbaa !24
  br label %34

34:                                               ; preds = %28, %19
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.ImFont, ptr %35, i32 0, i32 8
  %37 = load i16, ptr %36, align 8, !tbaa !24
  %38 = add i16 %37, 1
  store i16 %38, ptr %36, align 8, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %39

39:                                               ; preds = %34
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.ImFontConfig, ptr %40, i32 1
  store ptr %41, ptr %4, align 8, !tbaa !5
  br label %14

42:                                               ; preds = %18
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 136}
!10 = !{!"_ZTS12ImFontConfig", !6, i64 0, !11, i64 8, !12, i64 12, !11, i64 16, !13, i64 20, !11, i64 24, !11, i64 28, !12, i64 32, !14, i64 36, !14, i64 44, !6, i64 56, !13, i64 64, !13, i64 68, !12, i64 72, !11, i64 76, !13, i64 80, !13, i64 84, !15, i64 88, !7, i64 90, !6, i64 136}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!15 = !{!"short", !7, i64 0}
!16 = !{!10, !12, i64 72}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !6, i64 72}
!20 = !{!"_ZTS6ImFont", !21, i64 0, !13, i64 16, !13, i64 20, !22, i64 24, !23, i64 40, !6, i64 56, !6, i64 64, !6, i64 72, !15, i64 80, !15, i64 82, !15, i64 84, !15, i64 86, !13, i64 88, !13, i64 92, !12, i64 96, !13, i64 100, !13, i64 104, !13, i64 108, !11, i64 112, !7, i64 116}
!21 = !{!"_ZTS8ImVectorIfE", !11, i64 0, !11, i64 4, !6, i64 8}
!22 = !{!"_ZTS8ImVectorItE", !11, i64 0, !11, i64 4, !6, i64 8}
!23 = !{!"_ZTS8ImVectorI11ImFontGlyphE", !11, i64 0, !11, i64 4, !6, i64 8}
!24 = !{!20, !15, i64 80}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN8ImVectorI12ImFontConfigE5beginEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z35ImFontAtlasUpdateConfigDataPointersP11ImFontAtlas(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 120
  %3 = tail call noundef ptr @_ZN8ImVectorI12ImFontConfigE5beginEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %4 = tail call noundef ptr @_ZN8ImVectorI12ImFontConfigE3endEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %.not13 = icmp eq ptr %3, %4
  br i1 %.not13, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %12, %1
  ret void

.lr.ph:                                           ; preds = %1, %12
  %.014 = phi ptr [ %16, %12 ], [ %3, %1 ]
  %5 = getelementptr inbounds i8, ptr %.014, i64 136
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %.014, i64 72
  %8 = load i8, ptr %7, align 8, !tbaa !15, !range !16, !noundef !17
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %.lr.ph._crit_edge, label %10

.lr.ph._crit_edge:                                ; preds = %.lr.ph
  %.phi.trans.insert = getelementptr inbounds i8, ptr %6, i64 80
  %.pre = load i16, ptr %.phi.trans.insert, align 8, !tbaa !18
  br label %12

10:                                               ; preds = %.lr.ph
  %11 = getelementptr inbounds i8, ptr %6, i64 72
  store ptr %.014, ptr %11, align 8, !tbaa !23
  br label %12

12:                                               ; preds = %.lr.ph._crit_edge, %10
  %13 = phi i16 [ %.pre, %.lr.ph._crit_edge ], [ 0, %10 ]
  %14 = getelementptr inbounds i8, ptr %6, i64 80
  %15 = add i16 %13, 1
  store i16 %15, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %.014, i64 144
  %.not = icmp eq ptr %16, %4
  br i1 %.not, label %._crit_edge, label %.lr.ph
}

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

!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 136}
!6 = !{!"_ZTS12ImFontConfig", !7, i64 0, !10, i64 8, !11, i64 12, !10, i64 16, !12, i64 20, !10, i64 24, !10, i64 28, !11, i64 32, !13, i64 36, !13, i64 44, !7, i64 56, !12, i64 64, !12, i64 68, !11, i64 72, !10, i64 76, !12, i64 80, !12, i64 84, !14, i64 88, !8, i64 90, !7, i64 136}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"float", !8, i64 0}
!13 = !{!"_ZTS6ImVec2", !12, i64 0, !12, i64 4}
!14 = !{!"short", !8, i64 0}
!15 = !{!6, !11, i64 72}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !14, i64 80}
!19 = !{!"_ZTS6ImFont", !20, i64 0, !12, i64 16, !12, i64 20, !21, i64 24, !22, i64 40, !7, i64 56, !7, i64 64, !7, i64 72, !14, i64 80, !14, i64 82, !14, i64 84, !14, i64 86, !12, i64 88, !12, i64 92, !11, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !10, i64 112, !8, i64 116}
!20 = !{!"_ZTS8ImVectorIfE", !10, i64 0, !10, i64 4, !7, i64 8}
!21 = !{!"_ZTS8ImVectorItE", !10, i64 0, !10, i64 4, !7, i64 8}
!22 = !{!"_ZTS8ImVectorI11ImFontGlyphE", !10, i64 0, !10, i64 4, !7, i64 8}
!23 = !{!19, !7, i64 72}


; Effective O3 passes: DSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass