; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_gui_basics)

; 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.juce::Font" = type { %"class.juce::ReferenceCountedObjectPtr.158" }
%"class.juce::ReferenceCountedObjectPtr.158" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef) #1

; Function Attrs: nounwind
declare void @_ZN4juce4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

declare noundef i32 @_ZNK4juce4Font14getStringWidthERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: nounwind
declare noundef float @_ZNK4juce4Font9getHeightEv(ptr noundef nonnull align 8 dereferenceable(8)) #2

declare void @_ZN4juce4Font9setHeightEf(ptr noundef nonnull align 8 dereferenceable(8), float noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce14LookAndFeel_V225getIdealPopupMenuItemSizeERKNS_6StringEbiRiS4_(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, i1 noundef zeroext %2, i32 noundef %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.juce::Font", align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  %16 = zext i1 %2 to i8
  store i8 %16, ptr %9, align 1, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8
  %18 = load i8, ptr %9, align 1, !tbaa !9, !range !13, !noundef !14
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %31

20:                                               ; preds = %6
  %21 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 50, ptr %21, align 4, !tbaa !11
  %22 = load i32, ptr %10, align 4, !tbaa !11
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %24, label %27

24:                                               ; preds = %20
  %25 = load i32, ptr %10, align 4, !tbaa !11
  %26 = sdiv i32 %25, 2
  br label %28

27:                                               ; preds = %20
  br label %28

28:                                               ; preds = %27, %24
  %29 = phi i32 [ %26, %24 ], [ 10, %27 ]
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 %29, ptr %30, align 4, !tbaa !11
  br label %72

31:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %32 = load ptr, ptr %17, align 8, !tbaa !15
  %33 = getelementptr inbounds ptr, ptr %32, i64 51
  %34 = load ptr, ptr %33, align 8
  call void %34(ptr dead_on_unwind writable sret(%"class.juce::Font") align 8 %13, ptr noundef nonnull align 8 dereferenceable(304) %17)
  %35 = load i32, ptr %10, align 4, !tbaa !11
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %37, label %52

37:                                               ; preds = %31
  %38 = call noundef float @_ZNK4juce4Font9getHeightEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  %39 = load i32, ptr %10, align 4, !tbaa !11
  %40 = sitofp i32 %39 to float
  %41 = fdiv float %40, 0x3FF4CCCCC0000000
  %42 = fcmp ogt float %38, %41
  br i1 %42, label %43, label %52

43:                                               ; preds = %37
  %44 = load i32, ptr %10, align 4, !tbaa !11
  %45 = sitofp i32 %44 to float
  %46 = fdiv float %45, 0x3FF4CCCCC0000000
  invoke void @_ZN4juce4Font9setHeightEf(ptr noundef nonnull align 8 dereferenceable(8) %13, float noundef %46)
          to label %47 unwind label %48

47:                                               ; preds = %43
  br label %52

48:                                               ; preds = %61, %43
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %14, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %15, align 4
  call void @_ZN4juce4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %73

52:                                               ; preds = %47, %37, %31
  %53 = load i32, ptr %10, align 4, !tbaa !11
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = load i32, ptr %10, align 4, !tbaa !11
  br label %61

57:                                               ; preds = %52
  %58 = call noundef float @_ZNK4juce4Font9getHeightEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  %59 = fmul float %58, 0x3FF4CCCCC0000000
  %60 = call noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef %59) #5
  br label %61

61:                                               ; preds = %57, %55
  %62 = phi i32 [ %56, %55 ], [ %60, %57 ]
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 %62, ptr %63, align 4, !tbaa !11
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = invoke noundef i32 @_ZNK4juce4Font14getStringWidthERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %64)
          to label %66 unwind label %48

66:                                               ; preds = %61
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = load i32, ptr %67, align 4, !tbaa !11
  %69 = mul nsw i32 %68, 2
  %70 = add nsw i32 %65, %69
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %70, ptr %71, align 4, !tbaa !11
  call void @_ZN4juce4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %72

72:                                               ; preds = %66, %28
  ret void

73:                                               ; preds = %48
  %74 = load ptr, ptr %14, align 8
  %75 = load i32, ptr %15, align 4
  %76 = insertvalue { ptr, i32 } poison, ptr %74, 0
  %77 = insertvalue { ptr, i32 } %76, i32 %75, 1
  resume { ptr, i32 } %77
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, 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"

%"class.juce::Font" = type { %"class.juce::ReferenceCountedObjectPtr.158" }
%"class.juce::ReferenceCountedObjectPtr.158" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN4juce4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2

declare noundef i32 @_ZNK4juce4Font14getStringWidthERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: nounwind
declare noundef float @_ZNK4juce4Font9getHeightEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

declare void @_ZN4juce4Font9setHeightEf(ptr noundef nonnull align 8 dereferenceable(8), float noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce14LookAndFeel_V225getIdealPopupMenuItemSizeERKNS_6StringEbiRiS4_(ptr noundef nonnull align 8 dereferenceable(304) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, i1 noundef zeroext %2, i32 noundef %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %4, ptr nocapture noundef nonnull align 4 dereferenceable(4) %5) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.juce::Font", align 8
  br i1 %2, label %8, label %11

8:                                                ; preds = %6
  store i32 50, ptr %4, align 4, !tbaa !5
  %9 = icmp sgt i32 %3, 0
  %10 = lshr i32 %3, 1
  %spec.select = select i1 %9, i32 %10, i32 10
  store i32 %spec.select, ptr %5, align 4, !tbaa !5
  br label %33

11:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %12 = load ptr, ptr %0, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %12, i64 408
  %14 = load ptr, ptr %13, align 8
  call void %14(ptr dead_on_unwind nonnull writable sret(%"class.juce::Font") align 8 %7, ptr noundef nonnull align 8 dereferenceable(304) %0)
  %15 = icmp sgt i32 %3, 0
  %16 = call noundef float @_ZNK4juce4Font9getHeightEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %15, label %17, label %.critedge

17:                                               ; preds = %11
  %18 = uitofp nneg i32 %3 to float
  %19 = fdiv float %18, 0x3FF4CCCCC0000000
  %20 = fcmp ogt float %16, %19
  br i1 %20, label %21, label %26

21:                                               ; preds = %17
  invoke void @_ZN4juce4Font9setHeightEf(ptr noundef nonnull align 8 dereferenceable(8) %7, float noundef %19)
          to label %26 unwind label %22

22:                                               ; preds = %26, %21
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  resume { ptr, i32 } %23

.critedge:                                        ; preds = %11
  %24 = fmul float %16, 0x3FF4CCCCC0000000
  %25 = call noundef i32 @_ZN4juce10roundToIntIfEEiT_(float noundef %24) #5
  br label %26

26:                                               ; preds = %17, %21, %.critedge
  %27 = phi i32 [ %25, %.critedge ], [ %3, %21 ], [ %3, %17 ]
  store i32 %27, ptr %5, align 4, !tbaa !5
  %28 = invoke noundef i32 @_ZNK4juce4Font14getStringWidthERKNS_6StringE(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %1)
          to label %29 unwind label %22

29:                                               ; preds = %26
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = shl nsw i32 %30, 1
  %32 = add nsw i32 %31, %28
  store i32 %32, ptr %4, align 4, !tbaa !5
  call void @_ZN4juce4FontD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %33

33:                                               ; preds = %29, %8
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass