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

@_ZN4juce7Colours9lightgreyE = external global %"class.juce::Colour", align 1
@_ZN4juce7Colours8darkgreyE = external global %"class.juce::Colour", align 1

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 @_ZN4juce4jminIiEET_S1_S1_(i32 noundef, i32 noundef) #1

declare void @_ZN4juce8Graphics9setColourENS_6ColourE(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef) #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

declare void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17), float noundef, float noundef, float noundef, float noundef, float noundef) #2

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

24:                                               ; preds = %6
  %25 = load i8, ptr %12, align 1, !tbaa !11, !range !13, !noundef !14
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %28

27:                                               ; preds = %24, %6
  br label %29

28:                                               ; preds = %24
  br label %29

29:                                               ; preds = %28, %27
  %30 = phi ptr [ @_ZN4juce7Colours9lightgreyE, %27 ], [ @_ZN4juce7Colours8darkgreyE, %28 ]
  call void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4) %13, ptr noundef nonnull align 1 dereferenceable(4) %30) #5
  invoke void @_ZN4juce8Graphics9setColourENS_6ColourE(ptr noundef nonnull align 8 dereferenceable(17) %21, ptr noundef %13)
          to label %31 unwind label %41

31:                                               ; preds = %29
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = call noundef i32 @_ZN4juce4jminIiEET_S1_S1_(i32 noundef %32, i32 noundef %33)
  %35 = sitofp i32 %34 to float
  %36 = fmul float %35, 0x3FB99999A0000000
  store float %36, ptr %16, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store float 0.000000e+00, ptr %17, align 4, !tbaa !15
  br label %37

37:                                               ; preds = %62, %31
  %38 = load float, ptr %17, align 4, !tbaa !15
  %39 = fcmp olt float %38, 1.000000e+00
  br i1 %39, label %45, label %40

40:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %65

41:                                               ; preds = %29
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %14, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %15, align 4
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %13) #5
  br label %66

45:                                               ; preds = %37
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = sitofp i32 %47 to float
  %49 = load float, ptr %17, align 4, !tbaa !15
  %50 = fmul float %48, %49
  %51 = load i32, ptr %10, align 4, !tbaa !9
  %52 = sitofp i32 %51 to float
  %53 = fadd float %52, 1.000000e+00
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = sitofp i32 %54 to float
  %56 = fadd float %55, 1.000000e+00
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = sitofp i32 %57 to float
  %59 = load float, ptr %17, align 4, !tbaa !15
  %60 = fmul float %58, %59
  %61 = load float, ptr %16, align 4, !tbaa !15
  call void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17) %46, float noundef %50, float noundef %53, float noundef %56, float noundef %60, float noundef %61)
  br label %62

62:                                               ; preds = %45
  %63 = load float, ptr %17, align 4, !tbaa !15
  %64 = fadd float %63, 0x3FD3333340000000
  store float %64, ptr %17, align 4, !tbaa !15
  br label %37, !llvm.loop !17

65:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  ret void

66:                                               ; preds = %41
  %67 = load ptr, ptr %14, align 8
  %68 = load i32, ptr %15, align 4
  %69 = insertvalue { ptr, i32 } poison, ptr %67, 0
  %70 = insertvalue { ptr, i32 } %69, i32 %68, 1
  resume { ptr, i32 } %70
}

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 = { "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 "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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!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 }

@_ZN4juce7Colours9lightgreyE = external global %"class.juce::Colour", align 1
@_ZN4juce7Colours8darkgreyE = external global %"class.juce::Colour", align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce4jminIiEET_S1_S1_(i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @_ZN4juce8Graphics9setColourENS_6ColourE(ptr noundef nonnull align 8 dereferenceable(17), ptr noundef) 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

declare void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17), float noundef, float noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4juce14LookAndFeel_V117drawCornerResizerERNS_8GraphicsEiibb(ptr nocapture noundef nonnull readnone align 8 dereferenceable(328) %0, ptr noundef nonnull align 8 dereferenceable(17) %1, i32 noundef %2, i32 noundef %3, i1 noundef zeroext %4, i1 noundef zeroext %5) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.juce::Colour", align 1
  %8 = or i1 %4, %5
  %9 = select i1 %8, ptr @_ZN4juce7Colours9lightgreyE, ptr @_ZN4juce7Colours8darkgreyE
  call void @_ZN4juce6ColourC1ERKS0_(ptr noundef nonnull align 1 dereferenceable(4) %7, ptr noundef nonnull align 1 dereferenceable(4) %9) #5
  invoke void @_ZN4juce8Graphics9setColourENS_6ColourE(ptr noundef nonnull align 8 dereferenceable(17) %1, ptr noundef nonnull %7)
          to label %10 unwind label %26

10:                                               ; preds = %6
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %7) #5
  %11 = call noundef i32 @_ZN4juce4jminIiEET_S1_S1_(i32 noundef %2, i32 noundef %3)
  %12 = sitofp i32 %11 to float
  %13 = fmul float %12, 0x3FB99999A0000000
  %14 = sitofp i32 %2 to float
  %15 = sitofp i32 %3 to float
  %16 = fadd float %15, 1.000000e+00
  %17 = fadd float %14, 1.000000e+00
  %18 = call float @llvm.copysign.f32(float 0.000000e+00, float %14)
  %19 = call float @llvm.copysign.f32(float 0.000000e+00, float %15)
  call void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17) %1, float noundef %18, float noundef %16, float noundef %17, float noundef %19, float noundef %13)
  %20 = fmul float %14, 0x3FD3333340000000
  %21 = fmul float %15, 0x3FD3333340000000
  call void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17) %1, float noundef %20, float noundef %16, float noundef %17, float noundef %21, float noundef %13)
  %22 = fmul float %14, 0x3FE3333340000000
  %23 = fmul float %15, 0x3FE3333340000000
  call void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17) %1, float noundef %22, float noundef %16, float noundef %17, float noundef %23, float noundef %13)
  %24 = fmul float %14, 0x3FECCCCCE0000000
  %25 = fmul float %15, 0x3FECCCCCE0000000
  call void @_ZNK4juce8Graphics8drawLineEfffff(ptr noundef nonnull align 8 dereferenceable(17) %1, float noundef %24, float noundef %16, float noundef %17, float noundef %25, float noundef %13)
  ret void

26:                                               ; preds = %6
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4juce6ColourD1Ev(ptr noundef nonnull align 1 dereferenceable(4) %7) #5
  resume { ptr, i32 } %27
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.copysign.f32(float, float) #4

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 = { "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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass