; LLVM IR from l1mey112/yr11-physics-applied :: cimgui/imgui/imgui_draw.ll (ZN6ImFontC2Ev)

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6ImFontC2Ev(ptr noundef nonnull align 8 dereferenceable(110) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  %6 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 0
  call void @_ZN8ImVectorIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6)
  %7 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 3
  invoke void @_ZN8ImVectorItEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %8 unwind label %27

8:                                                ; preds = %1
  %9 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 4
  invoke void @_ZN8ImVectorI11ImFontGlyphEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9)
          to label %10 unwind label %31

10:                                               ; preds = %8
  %11 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 2
  store float 0.000000e+00, ptr %11, align 4, !tbaa !9
  %12 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 1
  store float 0.000000e+00, ptr %12, align 8, !tbaa !18
  %13 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 9
  store i16 -1, ptr %13, align 2, !tbaa !19
  %14 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 10
  store i16 -1, ptr %14, align 4, !tbaa !20
  %15 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 11
  store i16 -1, ptr %15, align 2, !tbaa !21
  %16 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 5
  store ptr null, ptr %16, align 8, !tbaa !22
  %17 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 6
  store ptr null, ptr %17, align 8, !tbaa !23
  %18 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 7
  store ptr null, ptr %18, align 8, !tbaa !24
  %19 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 8
  store i16 0, ptr %19, align 8, !tbaa !25
  %20 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 12
  store i8 0, ptr %20, align 8, !tbaa !26
  %21 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 14
  store float 1.000000e+00, ptr %21, align 4, !tbaa !27
  %22 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 16
  store float 0.000000e+00, ptr %22, align 4, !tbaa !28
  %23 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 15
  store float 0.000000e+00, ptr %23, align 8, !tbaa !29
  %24 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 17
  store i32 0, ptr %24, align 8, !tbaa !30
  %25 = getelementptr inbounds %struct.ImFont, ptr %5, i32 0, i32 18
  %26 = getelementptr inbounds [2 x i8], ptr %25, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %26, i8 0, i64 2, i1 false)
  ret void

27:                                               ; preds = %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %3, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %4, align 4
  br label %35

31:                                               ; preds = %8
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %3, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %4, align 4
  call void @_ZN8ImVectorItED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #3
  br label %35

35:                                               ; preds = %31, %27
  call void @_ZN8ImVectorIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #3
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr %3, align 8
  %38 = load i32, ptr %4, align 4
  %39 = insertvalue { ptr, i32 } poison, ptr %37, 0
  %40 = insertvalue { ptr, i32 } %39, i32 %38, 1
  resume { ptr, i32 } %40
}

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

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

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

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !13, i64 20}
!10 = !{!"_ZTS6ImFont", !11, i64 0, !13, i64 16, !13, i64 20, !14, i64 24, !15, i64 40, !6, i64 56, !6, i64 64, !6, i64 72, !16, i64 80, !16, i64 82, !16, i64 84, !16, i64 86, !17, i64 88, !13, i64 92, !13, i64 96, !13, i64 100, !12, i64 104, !7, i64 108}
!11 = !{!"_ZTS8ImVectorIfE", !12, i64 0, !12, i64 4, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTS8ImVectorItE", !12, i64 0, !12, i64 4, !6, i64 8}
!15 = !{!"_ZTS8ImVectorI11ImFontGlyphE", !12, i64 0, !12, i64 4, !6, i64 8}
!16 = !{!"short", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!10, !13, i64 16}
!19 = !{!10, !16, i64 82}
!20 = !{!10, !16, i64 84}
!21 = !{!10, !16, i64 86}
!22 = !{!10, !6, i64 56}
!23 = !{!10, !6, i64 64}
!24 = !{!10, !6, i64 72}
!25 = !{!10, !16, i64 80}
!26 = !{!10, !17, i64 88}
!27 = !{!10, !13, i64 92}
!28 = !{!10, !13, i64 100}
!29 = !{!10, !13, i64 96}
!30 = !{!10, !12, i64 104}


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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6ImFontC2Ev(ptr noundef nonnull align 8 dereferenceable(110) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8ImVectorIfEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN8ImVectorItEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @_ZN8ImVectorI11ImFontGlyphEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  store <2 x float> zeroinitializer, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 82
  store i16 -1, ptr %5, align 2, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %0, i64 84
  store i16 -1, ptr %6, align 4, !tbaa !18
  %7 = getelementptr inbounds i8, ptr %0, i64 86
  store i16 -1, ptr %7, align 2, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  store i8 0, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds i8, ptr %0, i64 92
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(26) %8, i8 0, i64 26, i1 false)
  store float 1.000000e+00, ptr %10, align 4, !tbaa !21
  %11 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(14) %11, i8 0, i64 14, i1 false)
  ret void
}

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

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

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

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


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