; LLVM IR from modlfo/AudioEngine :: AudioEngine/JuceLibraryCode/modules/juce_audio_formats/codecs/oggvorbis (predict)

; 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: nounwind uwtable
define dso_local void @vorbis_lpc_predict(ptr noundef %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i64 noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca float, align 4
  %16 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i64 %4, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = load i64, ptr %10, align 8, !tbaa !11
  %20 = add nsw i64 %18, %19
  %21 = mul i64 4, %20
  %22 = alloca i8, i64 %21, align 16
  store ptr %22, ptr %16, align 8, !tbaa !5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %39, label %25

25:                                               ; preds = %5
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %26

26:                                               ; preds = %35, %25
  %27 = load i64, ptr %11, align 8, !tbaa !11
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %27, %29
  br i1 %30, label %31, label %38

31:                                               ; preds = %26
  %32 = load ptr, ptr %16, align 8, !tbaa !5
  %33 = load i64, ptr %11, align 8, !tbaa !11
  %34 = getelementptr inbounds float, ptr %32, i64 %33
  store float 0.000000e+00, ptr %34, align 4, !tbaa !13
  br label %35

35:                                               ; preds = %31
  %36 = load i64, ptr %11, align 8, !tbaa !11
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %11, align 8, !tbaa !11
  br label %26, !llvm.loop !15

38:                                               ; preds = %26
  br label %57

39:                                               ; preds = %5
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %40

40:                                               ; preds = %53, %39
  %41 = load i64, ptr %11, align 8, !tbaa !11
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = icmp slt i64 %41, %43
  br i1 %44, label %45, label %56

45:                                               ; preds = %40
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = load i64, ptr %11, align 8, !tbaa !11
  %48 = getelementptr inbounds float, ptr %46, i64 %47
  %49 = load float, ptr %48, align 4, !tbaa !13
  %50 = load ptr, ptr %16, align 8, !tbaa !5
  %51 = load i64, ptr %11, align 8, !tbaa !11
  %52 = getelementptr inbounds float, ptr %50, i64 %51
  store float %49, ptr %52, align 4, !tbaa !13
  br label %53

53:                                               ; preds = %45
  %54 = load i64, ptr %11, align 8, !tbaa !11
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %11, align 8, !tbaa !11
  br label %40, !llvm.loop !17

56:                                               ; preds = %40
  br label %57

57:                                               ; preds = %56, %38
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %58

58:                                               ; preds = %96, %57
  %59 = load i64, ptr %11, align 8, !tbaa !11
  %60 = load i64, ptr %10, align 8, !tbaa !11
  %61 = icmp slt i64 %59, %60
  br i1 %61, label %62, label %99

62:                                               ; preds = %58
  store float 0.000000e+00, ptr %15, align 4, !tbaa !13
  %63 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %63, ptr %13, align 8, !tbaa !11
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  store i64 %65, ptr %14, align 8, !tbaa !11
  store i64 0, ptr %12, align 8, !tbaa !11
  br label %66

66:                                               ; preds = %85, %62
  %67 = load i64, ptr %12, align 8, !tbaa !11
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = icmp slt i64 %67, %69
  br i1 %70, label %71, label %88

71:                                               ; preds = %66
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = load i64, ptr %13, align 8, !tbaa !11
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %13, align 8, !tbaa !11
  %75 = getelementptr inbounds float, ptr %72, i64 %73
  %76 = load float, ptr %75, align 4, !tbaa !13
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = load i64, ptr %14, align 8, !tbaa !11
  %79 = add nsw i64 %78, -1
  store i64 %79, ptr %14, align 8, !tbaa !11
  %80 = getelementptr inbounds float, ptr %77, i64 %79
  %81 = load float, ptr %80, align 4, !tbaa !13
  %82 = load float, ptr %15, align 4, !tbaa !13
  %83 = fneg float %76
  %84 = call float @llvm.fmuladd.f32(float %83, float %81, float %82)
  store float %84, ptr %15, align 4, !tbaa !13
  br label %85

85:                                               ; preds = %71
  %86 = load i64, ptr %12, align 8, !tbaa !11
  %87 = add nsw i64 %86, 1
  store i64 %87, ptr %12, align 8, !tbaa !11
  br label %66, !llvm.loop !18

88:                                               ; preds = %66
  %89 = load float, ptr %15, align 4, !tbaa !13
  %90 = load ptr, ptr %16, align 8, !tbaa !5
  %91 = load i64, ptr %13, align 8, !tbaa !11
  %92 = getelementptr inbounds float, ptr %90, i64 %91
  store float %89, ptr %92, align 4, !tbaa !13
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  %94 = load i64, ptr %11, align 8, !tbaa !11
  %95 = getelementptr inbounds float, ptr %93, i64 %94
  store float %89, ptr %95, align 4, !tbaa !13
  br label %96

96:                                               ; preds = %88
  %97 = load i64, ptr %11, align 8, !tbaa !11
  %98 = add nsw i64 %97, 1
  store i64 %98, ptr %11, align 8, !tbaa !11
  br label %58, !llvm.loop !19

99:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; 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: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @vorbis_lpc_predict(ptr nocapture noundef readonly %0, ptr noundef readonly %1, i32 noundef %2, ptr nocapture noundef writeonly %3, i64 noundef %4) local_unnamed_addr #0 {
  %6 = sext i32 %2 to i64
  %7 = add nsw i64 %6, %4
  %8 = shl i64 %7, 2
  %9 = alloca i8, i64 %8, align 16
  %.not = icmp eq ptr %1, null
  %10 = icmp sgt i32 %2, 0
  br i1 %.not, label %.preheader37, label %.preheader38

.preheader38:                                     ; preds = %5
  br i1 %10, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader38
  %11 = shl nuw nsw i64 %6, 2
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %9, ptr nonnull align 4 %1, i64 %11, i1 false), !tbaa !5
  br label %.loopexit

.preheader37:                                     ; preds = %5
  br i1 %10, label %.lr.ph42.preheader, label %.loopexit

.lr.ph42.preheader:                               ; preds = %.preheader37
  %12 = shl nuw nsw i64 %6, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %9, i8 0, i64 %12, i1 false), !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.preheader, %.lr.ph42.preheader, %.preheader38, %.preheader37
  %13 = icmp sgt i64 %4, 0
  br i1 %13, label %.preheader.lr.ph, label %._crit_edge50

.preheader.lr.ph:                                 ; preds = %.loopexit
  %14 = icmp sgt i32 %2, 0
  br i1 %14, label %.preheader.us.preheader, label %.preheader.preheader

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %xtraiter = and i64 %6, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %15 = add nsw i64 %6, -1
  %16 = getelementptr inbounds float, ptr %0, i64 %15
  %17 = icmp eq i32 %2, 1
  %invariant.gep = getelementptr i8, ptr %0, i64 -4
  %invariant.gep56 = getelementptr i8, ptr %9, i64 4
  br label %.preheader.us

.preheader.preheader:                             ; preds = %.preheader.lr.ph
  %18 = shl nuw i64 %4, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %3, i8 0, i64 %18, i1 false), !tbaa !5
  br label %._crit_edge50

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge.us ], [ %6, %.preheader.us.preheader ]
  %.249.us = phi i64 [ %39, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %.preheader.us
  %19 = add nuw i64 %.249.us, 1
  %20 = getelementptr inbounds float, ptr %9, i64 %.249.us
  %21 = load float, ptr %20, align 4, !tbaa !5
  %22 = load float, ptr %16, align 4, !tbaa !5
  %23 = fneg float %21
  %24 = tail call float @llvm.fmuladd.f32(float %23, float %22, float 0.000000e+00)
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.preheader.us
  %.lcssa.unr = phi float [ poison, %.preheader.us ], [ %24, %.prol.loopexit.unr-lcssa ]
  %.03246.us.unr = phi float [ 0.000000e+00, %.preheader.us ], [ %24, %.prol.loopexit.unr-lcssa ]
  %.03345.us.unr = phi i64 [ %6, %.preheader.us ], [ %15, %.prol.loopexit.unr-lcssa ]
  %.03444.us.unr = phi i64 [ %.249.us, %.preheader.us ], [ %19, %.prol.loopexit.unr-lcssa ]
  br i1 %17, label %._crit_edge.us, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.prol.loopexit, %.preheader.us.new
  %.03246.us = phi float [ %36, %.preheader.us.new ], [ %.03246.us.unr, %.prol.loopexit ]
  %.03345.us = phi i64 [ %32, %.preheader.us.new ], [ %.03345.us.unr, %.prol.loopexit ]
  %.03444.us = phi i64 [ %30, %.preheader.us.new ], [ %.03444.us.unr, %.prol.loopexit ]
  %25 = getelementptr inbounds float, ptr %9, i64 %.03444.us
  %26 = load float, ptr %25, align 4, !tbaa !5
  %gep = getelementptr float, ptr %invariant.gep, i64 %.03345.us
  %27 = load float, ptr %gep, align 4, !tbaa !5
  %28 = fneg float %26
  %29 = tail call float @llvm.fmuladd.f32(float %28, float %27, float %.03246.us)
  %30 = add nuw i64 %.03444.us, 2
  %gep57 = getelementptr float, ptr %invariant.gep56, i64 %.03444.us
  %31 = load float, ptr %gep57, align 4, !tbaa !5
  %32 = add nsw i64 %.03345.us, -2
  %33 = getelementptr inbounds float, ptr %0, i64 %32
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = fneg float %31
  %36 = tail call float @llvm.fmuladd.f32(float %35, float %34, float %29)
  %exitcond.not.1 = icmp eq i64 %30, %indvars.iv
  br i1 %exitcond.not.1, label %._crit_edge.us, label %.preheader.us.new, !llvm.loop !9

._crit_edge.us:                                   ; preds = %.preheader.us.new, %.prol.loopexit
  %.lcssa = phi float [ %.lcssa.unr, %.prol.loopexit ], [ %36, %.preheader.us.new ]
  %37 = getelementptr inbounds float, ptr %9, i64 %indvars.iv
  store float %.lcssa, ptr %37, align 4, !tbaa !5
  %38 = getelementptr inbounds float, ptr %3, i64 %.249.us
  store float %.lcssa, ptr %38, align 4, !tbaa !5
  %39 = add nuw nsw i64 %.249.us, 1
  %indvars.iv.next = add i64 %indvars.iv, 1
  %exitcond54.not = icmp eq i64 %39, %4
  br i1 %exitcond54.not, label %._crit_edge50, label %.preheader.us, !llvm.loop !11

._crit_edge50:                                    ; preds = %._crit_edge.us, %.preheader.preheader, %.loopexit
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { nofree norecurse nosync nounwind memory(argmem: readwrite) 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass