; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui/imgui_draw.ll (ZN6ImFont9GrowIndexEi)

; 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.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 }

@.str.1 = external hidden unnamed_addr constant [122 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__._ZN6ImFont9GrowIndexEi = external hidden unnamed_addr constant [28 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ImFont9GrowIndexEi(ptr noundef nonnull align 8 dereferenceable(118) %0, i32 noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca float, align 4
  %6 = alloca i16, align 2
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %struct.ImFont, ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds %struct.ImVector.6, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = getelementptr inbounds %struct.ImFont, ptr %7, i32 0, i32 3
  %12 = getelementptr inbounds %struct.ImVector.1, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 8, !tbaa !19
  %14 = icmp eq i32 %10, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  br label %18

16:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.34, ptr noundef @.str.1, i32 noundef 3266, ptr noundef @__PRETTY_FUNCTION__._ZN6ImFont9GrowIndexEi) #4
  unreachable

17:                                               ; No predecessors!
  br label %18

18:                                               ; preds = %17, %15
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = getelementptr inbounds %struct.ImFont, ptr %7, i32 0, i32 3
  %21 = getelementptr inbounds %struct.ImVector.1, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %21, align 8, !tbaa !19
  %23 = icmp sle i32 %19, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %18
  br label %30

25:                                               ; preds = %18
  %26 = getelementptr inbounds %struct.ImFont, ptr %7, i32 0, i32 0
  %27 = load i32, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store float -1.000000e+00, ptr %5, align 4, !tbaa !20
  call void @_ZN8ImVectorIfE6resizeEiRKf(ptr noundef nonnull align 8 dereferenceable(16) %26, i32 noundef %27, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %28 = getelementptr inbounds %struct.ImFont, ptr %7, i32 0, i32 3
  %29 = load i32, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #5
  store i16 -1, ptr %6, align 2, !tbaa !21
  call void @_ZN8ImVectorItE6resizeEiRKt(ptr noundef nonnull align 8 dereferenceable(16) %28, i32 noundef %29, ptr noundef nonnull align 2 dereferenceable(2) %6)
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #5
  br label %30

30:                                               ; preds = %25, %24
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorIfE6resizeEiRKf(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorItE6resizeEiRKt(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, ptr noundef nonnull align 2 dereferenceable(2)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #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 = { inlinehint 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 #4 = { noreturn nounwind }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS6ImFont", !13, i64 0, !14, i64 16, !14, i64 20, !15, i64 24, !16, i64 40, !6, i64 56, !6, i64 64, !6, i64 72, !17, i64 80, !17, i64 82, !17, i64 84, !17, i64 86, !14, i64 88, !14, i64 92, !18, i64 96, !14, i64 100, !14, i64 104, !14, i64 108, !10, i64 112, !7, i64 116}
!13 = !{!"_ZTS8ImVectorIfE", !10, i64 0, !10, i64 4, !6, i64 8}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS8ImVectorItE", !10, i64 0, !10, i64 4, !6, i64 8}
!16 = !{!"_ZTS8ImVectorI11ImFontGlyphE", !10, i64 0, !10, i64 4, !6, i64 8}
!17 = !{!"short", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!12, !10, i64 24}
!20 = !{!14, !14, i64 0}
!21 = !{!17, !17, 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.1 = external hidden unnamed_addr constant [122 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [39 x i8], align 1
@__PRETTY_FUNCTION__._ZN6ImFont9GrowIndexEi = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ImFont9GrowIndexEi(ptr noundef nonnull align 8 dereferenceable(118) %0, i32 noundef %1) local_unnamed_addr #2 align 2 {
  %3 = alloca float, align 4
  %4 = alloca i16, align 2
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load i32, ptr %6, align 8, !tbaa !17
  %8 = icmp eq i32 %5, %7
  br i1 %8, label %10, label %9

9:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.34, ptr noundef nonnull @.str.1, i32 noundef 3266, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6ImFont9GrowIndexEi) #4
  unreachable

10:                                               ; preds = %2
  %.not = icmp slt i32 %5, %1
  br i1 %.not, label %11, label %12

11:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store float -1.000000e+00, ptr %3, align 4, !tbaa !18
  call void @_ZN8ImVectorIfE6resizeEiRKf(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #5
  store i16 -1, ptr %4, align 2, !tbaa !19
  call void @_ZN8ImVectorItE6resizeEiRKt(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %1, ptr noundef nonnull align 2 dereferenceable(2) %4)
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #5
  br label %12

12:                                               ; preds = %10, %11
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorIfE6resizeEiRKf(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorItE6resizeEiRKt(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, ptr noundef nonnull align 2 dereferenceable(2)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #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 = { inlinehint 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 #4 = { noreturn nounwind }
attributes #5 = { 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, !8, i64 0}
!6 = !{!"_ZTS6ImFont", !7, i64 0, !12, i64 16, !12, i64 20, !13, i64 24, !14, i64 40, !11, i64 56, !11, i64 64, !11, i64 72, !15, i64 80, !15, i64 82, !15, i64 84, !15, i64 86, !12, i64 88, !12, i64 92, !16, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !8, i64 112, !9, i64 116}
!7 = !{!"_ZTS8ImVectorIfE", !8, i64 0, !8, i64 4, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"float", !9, i64 0}
!13 = !{!"_ZTS8ImVectorItE", !8, i64 0, !8, i64 4, !11, i64 8}
!14 = !{!"_ZTS8ImVectorI11ImFontGlyphE", !8, i64 0, !8, i64 4, !11, i64 8}
!15 = !{!"short", !9, i64 0}
!16 = !{!"bool", !9, i64 0}
!17 = !{!6, !8, i64 24}
!18 = !{!12, !12, i64 0}
!19 = !{!15, !15, i64 0}


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