; 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::Colour" = type { %"class.juce::PixelARGB" }
%"class.juce::PixelARGB" = type { %union.anon.77 }
%union.anon.77 = type { i32 }

@_ZTIN4juce9ComponentE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN4juce8DrawableE = external dso_local constant { ptr, ptr, ptr }, align 8

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 @_ZNK4juce9Component21getNumChildComponentsEv(ptr noundef nonnull align 8 dereferenceable(197)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce9Component17getChildComponentEi(ptr noundef nonnull align 8 dereferenceable(197), i32 noundef) #1 align 2

; Function Attrs: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #2

; Function Attrs: nounwind
declare void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce8Drawable13replaceColourENS_6ColourES1_(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %"class.juce::Colour", align 1
  %11 = alloca %"class.juce::Colour", align 1
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 0, ptr %7, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %15 = call noundef i32 @_ZNK4juce9Component21getNumChildComponentsEv(ptr noundef nonnull align 8 dereferenceable(197) %14) #5
  store i32 %15, ptr %8, align 4, !tbaa !11
  br label %16

16:                                               ; preds = %49, %3
  %17 = load i32, ptr %8, align 4, !tbaa !11
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr %8, align 4, !tbaa !11
  %19 = icmp sge i32 %18, 0
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %50

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %22 = load i32, ptr %8, align 4, !tbaa !11
  %23 = call noundef ptr @_ZNK4juce9Component17getChildComponentEi(ptr noundef nonnull align 8 dereferenceable(197) %14, i32 noundef %22) #5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %27, label %25

25:                                               ; preds = %21
  %26 = call ptr @__dynamic_cast(ptr %23, ptr @_ZTIN4juce9ComponentE, ptr @_ZTIN4juce8DrawableE, i64 0) #5
  br label %28

27:                                               ; preds = %21
  br label %28

28:                                               ; preds = %27, %25
  %29 = phi ptr [ %26, %25 ], [ null, %27 ]
  store ptr %29, ptr %9, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %49

32:                                               ; preds = %28
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4) %10, ptr noundef nonnull align 1 dereferenceable(4) %1) #5
  call void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4) %11, ptr noundef nonnull align 1 dereferenceable(4) %2) #5
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  %35 = getelementptr inbounds ptr, ptr %34, i64 48
  %36 = load ptr, ptr %35, align 8
  %37 = invoke noundef zeroext i1 %36(ptr noundef nonnull align 8 dereferenceable(208) %33, ptr noundef %10, ptr noundef %11)
          to label %38 unwind label %45

38:                                               ; preds = %32
  br i1 %37, label %42, label %39

39:                                               ; preds = %38
  %40 = load i8, ptr %7, align 1, !tbaa !9, !range !15, !noundef !16
  %41 = trunc i8 %40 to i1
  br label %42

42:                                               ; preds = %39, %38
  %43 = phi i1 [ true, %38 ], [ %41, %39 ]
  %44 = zext i1 %43 to i8
  store i8 %44, ptr %7, align 1, !tbaa !9
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %11) #5
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %10) #5
  br label %49

45:                                               ; preds = %32
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %12, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %13, align 4
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %11) #5
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %53

49:                                               ; preds = %42, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %16, !llvm.loop !17

50:                                               ; preds = %20
  %51 = load i8, ptr %7, align 1, !tbaa !9, !range !15, !noundef !16
  %52 = trunc i8 %51 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  ret i1 %52

53:                                               ; preds = %45
  %54 = load ptr, ptr %12, align 8
  %55 = load i32, ptr %13, align 4
  %56 = insertvalue { ptr, i32 } poison, ptr %54, 0
  %57 = insertvalue { ptr, i32 } %56, i32 %55, 1
  resume { ptr, i32 } %57
}

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 willreturn memory(read) }
attributes #3 = { 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 #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 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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::Colour" = type { %"class.juce::PixelARGB" }
%"class.juce::PixelARGB" = type { %union.anon.77 }
%union.anon.77 = type { i32 }

@_ZTIN4juce9ComponentE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN4juce8DrawableE = external dso_local constant { ptr, ptr, ptr }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK4juce9Component21getNumChildComponentsEv(ptr noundef nonnull align 8 dereferenceable(197)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK4juce9Component17getChildComponentEi(ptr noundef nonnull align 8 dereferenceable(197), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4)) unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4juce8Drawable13replaceColourENS_6ColourES1_(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.juce::Colour", align 1
  %5 = alloca %"class.juce::Colour", align 1
  %6 = tail call noundef i32 @_ZNK4juce9Component21getNumChildComponentsEv(ptr noundef nonnull align 8 dereferenceable(197) %0) #4
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.thread, %3
  %.0.lcssa = phi i1 [ false, %3 ], [ %.1, %.thread ]
  ret i1 %.0.lcssa

.lr.ph:                                           ; preds = %3, %.thread
  %.in = phi i32 [ %8, %.thread ], [ %6, %3 ]
  %.014 = phi i1 [ %.1, %.thread ], [ false, %3 ]
  %8 = add nsw i32 %.in, -1
  %9 = call noundef ptr @_ZNK4juce9Component17getChildComponentEi(ptr noundef nonnull align 8 dereferenceable(197) %0, i32 noundef %8) #4
  %10 = icmp eq ptr %9, null
  br i1 %10, label %.thread, label %11

11:                                               ; preds = %.lr.ph
  %12 = call ptr @__dynamic_cast(ptr nonnull %9, ptr nonnull @_ZTIN4juce9ComponentE, ptr nonnull @_ZTIN4juce8DrawableE, i64 0) #4
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %.thread, label %13

13:                                               ; preds = %11
  call void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4) %4, ptr noundef nonnull align 1 dereferenceable(4) %1) #4
  call void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4) %5, ptr noundef nonnull align 1 dereferenceable(4) %2) #4
  %14 = load ptr, ptr %12, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 384
  %16 = load ptr, ptr %15, align 8
  %17 = invoke noundef zeroext i1 %16(ptr noundef nonnull align 8 dereferenceable(208) %12, ptr noundef nonnull %4, ptr noundef nonnull %5)
          to label %18 unwind label %20

18:                                               ; preds = %13
  %19 = select i1 %17, i1 true, i1 %.014
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %5) #4
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %4) #4
  br label %.thread

20:                                               ; preds = %13
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %5) #4
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %4) #4
  resume { ptr, i32 } %21

.thread:                                          ; preds = %.lr.ph, %18, %11
  %.1 = phi i1 [ %19, %18 ], [ %.014, %11 ], [ %.014, %.lr.ph ]
  %22 = icmp ugt i32 %.in, 1
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !8
}

attributes #0 = { 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 nofree nounwind willreturn memory(read) }
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 = { 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass