; LLVM IR from xhub/reshop :: gui/external/imgui/imgui_draw.ll (ZN11ImFontAtlas14AddFontDefaultEPK12ImFontConfig)

; 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.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.ImVec2 = type { float, float }

@.str.28 = external hidden unnamed_addr constant [22 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; 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
define dso_local noundef ptr @_ZN11ImFontAtlas14AddFontDefaultEPK12ImFontConfig(ptr noundef nonnull align 8 dereferenceable(1180) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.ImFontConfig, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 144, ptr %5) #5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %2
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %14, i64 144, i1 false), !tbaa.struct !9
  br label %16

15:                                               ; preds = %2
  call void @_ZN12ImFontConfigC1Ev(ptr noundef nonnull align 8 dereferenceable(144) %5)
  br label %16

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

19:                                               ; preds = %16
  %20 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 6
  store i32 1, ptr %20, align 4, !tbaa !19
  %21 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 5
  store i32 1, ptr %21, align 8, !tbaa !22
  %22 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 7
  store i8 1, ptr %22, align 8, !tbaa !23
  br label %23

23:                                               ; preds = %19, %16
  %24 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 4
  %25 = load float, ptr %24, align 4, !tbaa !24
  %26 = fcmp ole float %25, 0.000000e+00
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  %28 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 4
  store float 1.300000e+01, ptr %28, align 4, !tbaa !24
  br label %29

29:                                               ; preds = %27, %23
  %30 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 18
  %31 = getelementptr inbounds [40 x i8], ptr %30, i64 0, i64 0
  %32 = load i8, ptr %31, align 2, !tbaa !18
  %33 = sext i8 %32 to i32
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %42

35:                                               ; preds = %29
  %36 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 18
  %37 = getelementptr inbounds [40 x i8], ptr %36, i64 0, i64 0
  %38 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 4
  %39 = load float, ptr %38, align 4, !tbaa !24
  %40 = fptosi float %39 to i32
  %41 = call noundef i32 (ptr, i64, ptr, ...) @_Z14ImFormatStringPcmPKcz(ptr noundef %37, i64 noundef 40, ptr noundef @.str.28, i32 noundef %40)
  br label %42

42:                                               ; preds = %35, %29
  %43 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 17
  store i16 133, ptr %43, align 8, !tbaa !25
  %44 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 4
  %45 = load float, ptr %44, align 4, !tbaa !24
  %46 = fdiv float %45, 1.300000e+01
  %47 = fptosi float %46 to i32
  %48 = sitofp i32 %47 to float
  %49 = fmul float 1.000000e+00, %48
  %50 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 9
  %51 = getelementptr inbounds %struct.ImVec2, ptr %50, i32 0, i32 1
  store float %49, ptr %51, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %52 = call noundef ptr @_ZL31GetDefaultCompressedFontDataTTFPi(ptr noundef %6)
  store ptr %52, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %53 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 10
  %54 = load ptr, ptr %53, align 8, !tbaa !27
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %59

56:                                               ; preds = %42
  %57 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !27
  br label %61

59:                                               ; preds = %42
  %60 = call noundef ptr @_ZN11ImFontAtlas21GetGlyphRangesDefaultEv(ptr noundef nonnull align 8 dereferenceable(1180) %10)
  br label %61

61:                                               ; preds = %59, %56
  %62 = phi ptr [ %58, %56 ], [ %60, %59 ]
  store ptr %62, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load i32, ptr %6, align 4, !tbaa !10
  %65 = getelementptr inbounds %struct.ImFontConfig, ptr %5, i32 0, i32 4
  %66 = load float, ptr %65, align 4, !tbaa !24
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = call noundef ptr @_ZN11ImFontAtlas30AddFontFromMemoryCompressedTTFEPKvifPK12ImFontConfigPKt(ptr noundef nonnull align 8 dereferenceable(1180) %10, ptr noundef %63, i32 noundef %64, float noundef %66, ptr noundef %5, ptr noundef %67)
  store ptr %68, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 144, ptr %5) #5
  ret ptr %69
}

declare noundef i32 @_Z14ImFormatStringPcmPKcz(ptr noundef, i64 noundef, ptr noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL31GetDefaultCompressedFontDataTTFPi(ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11ImFontAtlas21GetGlyphRangesDefaultEv(ptr noundef nonnull align 8 dereferenceable(1180)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN11ImFontAtlas30AddFontFromMemoryCompressedTTFEPKvifPK12ImFontConfigPKt(ptr noundef nonnull align 8 dereferenceable(1180), ptr noundef, i32 noundef, float noundef, ptr noundef, ptr noundef) #2 align 2

declare void @_ZN12ImFontConfigC1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { 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 #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 = !{i64 0, i64 8, !5, i64 8, i64 4, !10, i64 12, i64 1, !12, i64 16, i64 4, !10, i64 20, i64 4, !14, i64 24, i64 4, !10, i64 28, i64 4, !10, i64 32, i64 1, !12, i64 36, i64 4, !14, i64 40, i64 4, !14, i64 44, i64 4, !14, i64 48, i64 4, !14, i64 56, i64 8, !5, i64 64, i64 4, !14, i64 68, i64 4, !14, i64 72, i64 1, !12, i64 76, i64 4, !10, i64 80, i64 4, !14, i64 84, i64 4, !14, i64 88, i64 2, !16, i64 90, i64 40, !18, i64 136, i64 8, !5}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !11, i64 28}
!20 = !{!"_ZTS12ImFontConfig", !6, i64 0, !11, i64 8, !13, i64 12, !11, i64 16, !15, i64 20, !11, i64 24, !11, i64 28, !13, i64 32, !21, i64 36, !21, i64 44, !6, i64 56, !15, i64 64, !15, i64 68, !13, i64 72, !11, i64 76, !15, i64 80, !15, i64 84, !17, i64 88, !7, i64 90, !6, i64 136}
!21 = !{!"_ZTS6ImVec2", !15, i64 0, !15, i64 4}
!22 = !{!20, !11, i64 24}
!23 = !{!20, !13, i64 32}
!24 = !{!20, !15, i64 20}
!25 = !{!20, !17, i64 88}
!26 = !{!20, !15, i64 48}
!27 = !{!20, !6, i64 56}


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

%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.ImVec2 = type { float, float }

@.str.28 = external hidden unnamed_addr constant [22 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN11ImFontAtlas14AddFontDefaultEPK12ImFontConfig(ptr noundef nonnull align 8 dereferenceable(1180) %0, ptr noundef readonly %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %struct.ImFontConfig, align 8
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %3) #5
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %6, label %5

5:                                                ; preds = %2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(144) %3, ptr noundef nonnull align 8 dereferenceable(144) %1, i64 144, i1 false), !tbaa.struct !5
  br label %10

6:                                                ; preds = %2
  call void @_ZN12ImFontConfigC1Ev(ptr noundef nonnull align 8 dereferenceable(144) %3)
  %7 = getelementptr inbounds i8, ptr %3, i64 28
  store i32 1, ptr %7, align 4, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %3, i64 24
  store i32 1, ptr %8, align 8, !tbaa !22
  %9 = getelementptr inbounds i8, ptr %3, i64 32
  store i8 1, ptr %9, align 8, !tbaa !23
  br label %10

10:                                               ; preds = %5, %6
  %11 = getelementptr inbounds i8, ptr %3, i64 20
  %12 = load float, ptr %11, align 4, !tbaa !24
  %13 = fcmp ugt float %12, 0.000000e+00
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  store float 1.300000e+01, ptr %11, align 4, !tbaa !24
  br label %15

15:                                               ; preds = %14, %10
  %16 = phi float [ 1.300000e+01, %14 ], [ %12, %10 ]
  %17 = getelementptr inbounds i8, ptr %3, i64 90
  %18 = load i8, ptr %17, align 2, !tbaa !18
  %19 = icmp eq i8 %18, 0
  br i1 %19, label %20, label %23

20:                                               ; preds = %15
  %21 = fptosi float %16 to i32
  %22 = call noundef i32 (ptr, i64, ptr, ...) @_Z14ImFormatStringPcmPKcz(ptr noundef nonnull %17, i64 noundef 40, ptr noundef nonnull @.str.28, i32 noundef %21)
  %.pre = load float, ptr %11, align 4, !tbaa !24
  br label %23

23:                                               ; preds = %20, %15
  %24 = phi float [ %.pre, %20 ], [ %16, %15 ]
  %25 = getelementptr inbounds i8, ptr %3, i64 88
  store i16 133, ptr %25, align 8, !tbaa !25
  %26 = fdiv float %24, 1.300000e+01
  %27 = fptosi float %26 to i32
  %28 = sitofp i32 %27 to float
  %29 = getelementptr inbounds i8, ptr %3, i64 48
  store float %28, ptr %29, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !10
  %30 = call noundef ptr @_ZL31GetDefaultCompressedFontDataTTFPi(ptr noundef nonnull %4)
  %31 = getelementptr inbounds i8, ptr %3, i64 56
  %32 = load ptr, ptr %31, align 8, !tbaa !27
  %.not8 = icmp eq ptr %32, null
  br i1 %.not8, label %33, label %35

33:                                               ; preds = %23
  %34 = call noundef ptr @_ZN11ImFontAtlas21GetGlyphRangesDefaultEv(ptr noundef nonnull align 8 dereferenceable(1180) %0)
  br label %35

35:                                               ; preds = %23, %33
  %36 = phi ptr [ %34, %33 ], [ %32, %23 ]
  %37 = load i32, ptr %4, align 4, !tbaa !10
  %38 = load float, ptr %11, align 4, !tbaa !24
  %39 = call noundef ptr @_ZN11ImFontAtlas30AddFontFromMemoryCompressedTTFEPKvifPK12ImFontConfigPKt(ptr noundef nonnull align 8 dereferenceable(1180) %0, ptr noundef %30, i32 noundef %37, float noundef %38, ptr noundef nonnull %3, ptr noundef %36)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %3) #5
  ret ptr %39
}

declare noundef i32 @_Z14ImFormatStringPcmPKcz(ptr noundef, i64 noundef, ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef ptr @_ZL31GetDefaultCompressedFontDataTTFPi(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11ImFontAtlas21GetGlyphRangesDefaultEv(ptr noundef nonnull align 8 dereferenceable(1180)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN11ImFontAtlas30AddFontFromMemoryCompressedTTFEPKvifPK12ImFontConfigPKt(ptr noundef nonnull align 8 dereferenceable(1180), ptr noundef, i32 noundef, float noundef, ptr noundef, ptr noundef) local_unnamed_addr #2 align 2

declare void @_ZN12ImFontConfigC1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = { 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 #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 = !{i64 0, i64 8, !6, i64 8, i64 4, !10, i64 12, i64 1, !12, i64 16, i64 4, !10, i64 20, i64 4, !14, i64 24, i64 4, !10, i64 28, i64 4, !10, i64 32, i64 1, !12, i64 36, i64 4, !14, i64 40, i64 4, !14, i64 44, i64 4, !14, i64 48, i64 4, !14, i64 56, i64 8, !6, i64 64, i64 4, !14, i64 68, i64 4, !14, i64 72, i64 1, !12, i64 76, i64 4, !10, i64 80, i64 4, !14, i64 84, i64 4, !14, i64 88, i64 2, !16, i64 90, i64 40, !18, i64 136, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !8, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!20, !11, i64 28}
!20 = !{!"_ZTS12ImFontConfig", !7, i64 0, !11, i64 8, !13, i64 12, !11, i64 16, !15, i64 20, !11, i64 24, !11, i64 28, !13, i64 32, !21, i64 36, !21, i64 44, !7, i64 56, !15, i64 64, !15, i64 68, !13, i64 72, !11, i64 76, !15, i64 80, !15, i64 84, !17, i64 88, !8, i64 90, !7, i64 136}
!21 = !{!"_ZTS6ImVec2", !15, i64 0, !15, i64 4}
!22 = !{!20, !11, i64 24}
!23 = !{!20, !13, i64 32}
!24 = !{!20, !15, i64 20}
!25 = !{!20, !17, i64 88}
!26 = !{!20, !15, i64 48}
!27 = !{!20, !7, i64 56}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass