; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce9ByteOrder15swapIfBigEndianEj(i32 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce19AudioDataConverters21convertInt32LEToFloatEPKvPfii(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #2 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store float 0x3E00000000000000, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %13, ptr %10, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = icmp ne ptr %14, %15
  br i1 %16, label %20, label %17

17:                                               ; preds = %4
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp sge i32 %18, 4
  br i1 %19, label %20, label %44

20:                                               ; preds = %17, %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %40, %20
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %43

26:                                               ; preds = %21
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = call noundef i32 @_ZN4juce9ByteOrder15swapIfBigEndianEj(i32 noundef %28) #3
  %30 = sitofp i32 %29 to float
  %31 = fmul float 0x3E00000000000000, %30
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds float, ptr %32, i64 %34
  store float %31, ptr %35, align 4, !tbaa !11
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = sext i32 %36 to i64
  %39 = getelementptr inbounds i8, ptr %37, i64 %38
  store ptr %39, ptr %10, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %26
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %11, align 4, !tbaa !9
  br label %21, !llvm.loop !13

43:                                               ; preds = %25
  br label %73

44:                                               ; preds = %17
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = mul nsw i32 %45, %46
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = sext i32 %47 to i64
  %50 = getelementptr inbounds i8, ptr %48, i64 %49
  store ptr %50, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %51 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %51, ptr %12, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %57, %44
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %12, align 4, !tbaa !9
  %55 = icmp sge i32 %54, 0
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %72

57:                                               ; preds = %52
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = sext i32 %58 to i64
  %61 = sub i64 0, %60
  %62 = getelementptr inbounds i8, ptr %59, i64 %61
  store ptr %62, ptr %10, align 8, !tbaa !5
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = call noundef i32 @_ZN4juce9ByteOrder15swapIfBigEndianEj(i32 noundef %64) #3
  %66 = sitofp i32 %65 to float
  %67 = fmul float 0x3E00000000000000, %66
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load i32, ptr %12, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds float, ptr %68, i64 %70
  store float %67, ptr %71, align 4, !tbaa !11
  br label %52, !llvm.loop !15

72:                                               ; preds = %56
  br label %73

73:                                               ; preds = %72, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #3 = { 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"}
!15 = distinct !{!15, !14}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4juce9ByteOrder15swapIfBigEndianEj(i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4juce19AudioDataConverters21convertInt32LEToFloatEPKvPfii(ptr noundef readonly %0, ptr noundef writeonly %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #1 align 2 {
  %5 = icmp ne ptr %0, %1
  %6 = icmp sgt i32 %3, 3
  %or.cond = or i1 %5, %6
  %7 = icmp sgt i32 %2, 0
  br i1 %or.cond, label %.preheader, label %16

.preheader:                                       ; preds = %4
  br i1 %7, label %.lr.ph33, label %.loopexit

.lr.ph33:                                         ; preds = %.preheader
  %8 = sext i32 %3 to i64
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %9

9:                                                ; preds = %.lr.ph33, %9
  %indvars.iv36 = phi i64 [ 0, %.lr.ph33 ], [ %indvars.iv.next37, %9 ]
  %.02331 = phi ptr [ %0, %.lr.ph33 ], [ %15, %9 ]
  %10 = load i32, ptr %.02331, align 4, !tbaa !5
  %11 = tail call noundef i32 @_ZN4juce9ByteOrder15swapIfBigEndianEj(i32 noundef %10) #2
  %12 = sitofp i32 %11 to float
  %13 = fmul float %12, 0x3E00000000000000
  %14 = getelementptr inbounds float, ptr %1, i64 %indvars.iv36
  store float %13, ptr %14, align 4, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %.02331, i64 %8
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %9, !llvm.loop !11

16:                                               ; preds = %4
  br i1 %7, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %16
  %17 = mul nsw i32 %3, %2
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i8, ptr %0, i64 %18
  %20 = sext i32 %3 to i64
  %21 = sub nsw i64 0, %20
  %22 = zext nneg i32 %2 to i64
  br label %23

23:                                               ; preds = %.lr.ph, %23
  %indvars.iv = phi i64 [ %22, %.lr.ph ], [ %indvars.iv.next, %23 ]
  %.129 = phi ptr [ %19, %.lr.ph ], [ %24, %23 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %24 = getelementptr inbounds i8, ptr %.129, i64 %21
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = tail call noundef i32 @_ZN4juce9ByteOrder15swapIfBigEndianEj(i32 noundef %25) #2
  %27 = sitofp i32 %26 to float
  %28 = fmul float %27, 0x3E00000000000000
  %29 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next
  store float %28, ptr %29, align 4, !tbaa !9
  %30 = icmp ugt i64 %indvars.iv, 1
  br i1 %30, label %23, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %23, %9, %16, %.preheader
  ret void
}

attributes #0 = { inlinehint 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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass