; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode (juce_audio_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"

; 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
define dso_local void @_ZN4juce19AudioDataConverters23convertFloatToFloat32LEEPKfPvii(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %4
  br label %12

12:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %13, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %30, %12
  %15 = load i32, ptr %10, align 4, !tbaa !9
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  br label %33

19:                                               ; preds = %14
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i32, ptr %10, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds float, ptr %20, i64 %22
  %24 = load float, ptr %23, align 4, !tbaa !11
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  store float %24, ptr %25, align 4, !tbaa !11
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = sext i32 %26 to i64
  %29 = getelementptr inbounds i8, ptr %27, i64 %28
  store ptr %29, ptr %9, align 8, !tbaa !5
  br label %30

30:                                               ; preds = %19
  %31 = load i32, ptr %10, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %10, align 4, !tbaa !9
  br label %14, !llvm.loop !13

33:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  ret void
}

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 }

!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 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN4juce19AudioDataConverters23convertFloatToFloat32LEEPKfPvii(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 align 2 {
  %5 = icmp sgt i32 %2, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %4
  %6 = sext i32 %3 to i64
  %wide.trip.count = zext nneg i32 %2 to i64
  %xtraiter = and i64 %wide.trip.count, 7
  %7 = icmp ult i32 %2, 8
  br i1 %7, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 2147483640
  br label %11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %11, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.7, %11 ]
  %.089.unr = phi ptr [ %1, %.lr.ph ], [ %35, %11 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.089.epil = phi ptr [ %10, %.epil.preheader ], [ %.089.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %8 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.epil
  %9 = load float, ptr %8, align 4, !tbaa !5
  store float %9, ptr %.089.epil, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %.089.epil, i64 %6
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !9

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.epil.preheader, %4
  ret void

11:                                               ; preds = %11, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.7, %11 ]
  %.089 = phi ptr [ %1, %.lr.ph.new ], [ %35, %11 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.7, %11 ]
  %12 = getelementptr inbounds float, ptr %0, i64 %indvars.iv
  %13 = load float, ptr %12, align 4, !tbaa !5
  store float %13, ptr %.089, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %.089, i64 %6
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %15 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next
  %16 = load float, ptr %15, align 4, !tbaa !5
  store float %16, ptr %14, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %14, i64 %6
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %18 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.1
  %19 = load float, ptr %18, align 4, !tbaa !5
  store float %19, ptr %17, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %17, i64 %6
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %21 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.2
  %22 = load float, ptr %21, align 4, !tbaa !5
  store float %22, ptr %20, align 4, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %20, i64 %6
  %indvars.iv.next.3 = or disjoint i64 %indvars.iv, 4
  %24 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.3
  %25 = load float, ptr %24, align 4, !tbaa !5
  store float %25, ptr %23, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %23, i64 %6
  %indvars.iv.next.4 = or disjoint i64 %indvars.iv, 5
  %27 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.4
  %28 = load float, ptr %27, align 4, !tbaa !5
  store float %28, ptr %26, align 4, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %26, i64 %6
  %indvars.iv.next.5 = or disjoint i64 %indvars.iv, 6
  %30 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.5
  %31 = load float, ptr %30, align 4, !tbaa !5
  store float %31, ptr %29, align 4, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %29, i64 %6
  %indvars.iv.next.6 = or disjoint i64 %indvars.iv, 7
  %33 = getelementptr inbounds float, ptr %0, i64 %indvars.iv.next.6
  %34 = load float, ptr %33, align 4, !tbaa !5
  store float %34, ptr %32, align 4, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %32, i64 %6
  %indvars.iv.next.7 = add nuw nsw i64 %indvars.iv, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.loopexit.unr-lcssa, label %11, !llvm.loop !11
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass