; LLVM IR from glaretechnologies/substrata :: opus/opus-1.3.1/silk/float (schur_FLP)

; 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: nounwind uwtable
define dso_local float @silk_schur_FLP(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca [25 x [2 x double]], align 16
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 400, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %28, %3
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds float, ptr %14, i64 %16
  %18 = load float, ptr %17, align 4, !tbaa !11
  %19 = fpext float %18 to double
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %21
  %23 = getelementptr inbounds [2 x double], ptr %22, i64 0, i64 1
  store double %19, ptr %23, align 8, !tbaa !13
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %25
  %27 = getelementptr inbounds [2 x double], ptr %26, i64 0, i64 0
  store double %19, ptr %27, align 16, !tbaa !13
  br label %28

28:                                               ; preds = %13
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %7, align 4, !tbaa !9
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %13, label %33, !llvm.loop !15

33:                                               ; preds = %28
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %107, %33
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %38, label %110

38:                                               ; preds = %34
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %41
  %43 = getelementptr inbounds [2 x double], ptr %42, i64 0, i64 0
  %44 = load double, ptr %43, align 16, !tbaa !13
  %45 = fneg double %44
  %46 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 0
  %47 = getelementptr inbounds [2 x double], ptr %46, i64 0, i64 1
  %48 = load double, ptr %47, align 8, !tbaa !13
  %49 = fcmp ogt double %48, 0x3E112E0BE0000000
  br i1 %49, label %50, label %54

50:                                               ; preds = %38
  %51 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 0
  %52 = getelementptr inbounds [2 x double], ptr %51, i64 0, i64 1
  %53 = load double, ptr %52, align 8, !tbaa !13
  br label %55

54:                                               ; preds = %38
  br label %55

55:                                               ; preds = %54, %50
  %56 = phi double [ %53, %50 ], [ 0x3E112E0BE0000000, %54 ]
  %57 = fdiv double %45, %56
  store double %57, ptr %12, align 8, !tbaa !13
  %58 = load double, ptr %12, align 8, !tbaa !13
  %59 = fptrunc double %58 to float
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds float, ptr %60, i64 %62
  store float %59, ptr %63, align 4, !tbaa !11
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %103, %55
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = sub nsw i32 %66, %67
  %69 = icmp slt i32 %65, %68
  br i1 %69, label %70, label %106

70:                                               ; preds = %64
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = load i32, ptr %7, align 4, !tbaa !9
  %73 = add nsw i32 %71, %72
  %74 = add nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %75
  %77 = getelementptr inbounds [2 x double], ptr %76, i64 0, i64 0
  %78 = load double, ptr %77, align 16, !tbaa !13
  store double %78, ptr %10, align 8, !tbaa !13
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %80
  %82 = getelementptr inbounds [2 x double], ptr %81, i64 0, i64 1
  %83 = load double, ptr %82, align 8, !tbaa !13
  store double %83, ptr %11, align 8, !tbaa !13
  %84 = load double, ptr %10, align 8, !tbaa !13
  %85 = load double, ptr %11, align 8, !tbaa !13
  %86 = load double, ptr %12, align 8, !tbaa !13
  %87 = call double @llvm.fmuladd.f64(double %85, double %86, double %84)
  %88 = load i32, ptr %8, align 4, !tbaa !9
  %89 = load i32, ptr %7, align 4, !tbaa !9
  %90 = add nsw i32 %88, %89
  %91 = add nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %92
  %94 = getelementptr inbounds [2 x double], ptr %93, i64 0, i64 0
  store double %87, ptr %94, align 16, !tbaa !13
  %95 = load double, ptr %11, align 8, !tbaa !13
  %96 = load double, ptr %10, align 8, !tbaa !13
  %97 = load double, ptr %12, align 8, !tbaa !13
  %98 = call double @llvm.fmuladd.f64(double %96, double %97, double %95)
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 %100
  %102 = getelementptr inbounds [2 x double], ptr %101, i64 0, i64 1
  store double %98, ptr %102, align 8, !tbaa !13
  br label %103

103:                                              ; preds = %70
  %104 = load i32, ptr %8, align 4, !tbaa !9
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %8, align 4, !tbaa !9
  br label %64, !llvm.loop !17

106:                                              ; preds = %64
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !9
  br label %34, !llvm.loop !18

110:                                              ; preds = %34
  %111 = getelementptr inbounds [25 x [2 x double]], ptr %9, i64 0, i64 0
  %112 = getelementptr inbounds [2 x double], ptr %111, i64 0, i64 1
  %113 = load double, ptr %112, align 8, !tbaa !13
  %114 = fptrunc double %113 to float
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 400, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  ret float %114
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !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 float @silk_schur_FLP(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca [25 x [2 x double]], align 16
  call void @llvm.lifetime.start.p0(i64 400, ptr nonnull %4) #4
  %smax = tail call i32 @llvm.smax.i32(i32 %2, i32 0)
  %5 = add nuw i32 %smax, 1
  %wide.trip.count = zext i32 %5 to i64
  %min.iters.check = icmp slt i32 %2, 3
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %3
  %n.vec = and i64 %wide.trip.count, 4294967292
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %6 = or disjoint i64 %index, 2
  %7 = getelementptr inbounds float, ptr %1, i64 %index
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %wide.load = load <2 x float>, ptr %7, align 4, !tbaa !5
  %wide.load46 = load <2 x float>, ptr %8, align 4, !tbaa !5
  %9 = fpext <2 x float> %wide.load to <2 x double>
  %10 = fpext <2 x float> %wide.load46 to <2 x double>
  %11 = getelementptr inbounds [25 x [2 x double]], ptr %4, i64 0, i64 %index
  %12 = getelementptr inbounds [25 x [2 x double]], ptr %4, i64 0, i64 %6
  %13 = shufflevector <2 x double> %9, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %interleaved.vec = shufflevector <4 x double> %13, <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x double> %interleaved.vec, ptr %11, align 16, !tbaa !9
  %14 = shufflevector <2 x double> %10, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %interleaved.vec47 = shufflevector <4 x double> %14, <4 x double> poison, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x double> %interleaved.vec47, ptr %12, align 16, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %15 = icmp eq i64 %index.next, %n.vec
  br i1 %15, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %3
  %indvars.iv.ph = phi i64 [ 0, %3 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %16 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  %17 = load float, ptr %16, align 4, !tbaa !5
  %18 = fpext float %17 to double
  %19 = getelementptr inbounds [25 x [2 x double]], ptr %4, i64 0, i64 %indvars.iv
  %20 = getelementptr inbounds i8, ptr %19, i64 8
  store double %18, ptr %20, align 8, !tbaa !9
  store double %18, ptr %19, align 16, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %scalar.ph, !llvm.loop !15

.preheader:                                       ; preds = %scalar.ph, %middle.block
  %21 = icmp sgt i32 %2, 0
  br i1 %21, label %.lr.ph32, label %._crit_edge

.lr.ph32:                                         ; preds = %.preheader
  %22 = getelementptr inbounds i8, ptr %4, i64 8
  %23 = zext nneg i32 %2 to i64
  %wide.trip.count44 = zext nneg i32 %2 to i64
  br label %24

.loopexit:                                        ; preds = %35, %24
  %indvars.iv.next38 = add i32 %indvars.iv37, -1
  %exitcond45.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count44
  br i1 %exitcond45.not, label %._crit_edge, label %24, !llvm.loop !16

24:                                               ; preds = %.lr.ph32, %.loopexit
  %indvars.iv41 = phi i64 [ 0, %.lr.ph32 ], [ %indvars.iv.next42, %.loopexit ]
  %indvars.iv37 = phi i32 [ %2, %.lr.ph32 ], [ %indvars.iv.next38, %.loopexit ]
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %25 = getelementptr inbounds [25 x [2 x double]], ptr %4, i64 0, i64 %indvars.iv.next42
  %26 = load double, ptr %25, align 16, !tbaa !9
  %27 = fneg double %26
  %28 = load double, ptr %22, align 8
  %29 = fcmp ogt double %28, 0x3E112E0BE0000000
  %30 = select i1 %29, double %28, double 0x3E112E0BE0000000
  %31 = fdiv double %27, %30
  %32 = fptrunc double %31 to float
  %33 = getelementptr inbounds float, ptr %0, i64 %indvars.iv41
  store float %32, ptr %33, align 4, !tbaa !5
  %34 = icmp ult i64 %indvars.iv41, %23
  br i1 %34, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %24
  %wide.trip.count39 = zext i32 %indvars.iv37 to i64
  br label %35

35:                                               ; preds = %.lr.ph, %35
  %indvars.iv34 = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next35, %35 ]
  %36 = add nuw nsw i64 %indvars.iv.next42, %indvars.iv34
  %37 = getelementptr inbounds [25 x [2 x double]], ptr %4, i64 0, i64 %36
  %38 = load double, ptr %37, align 16, !tbaa !9
  %39 = getelementptr inbounds [25 x [2 x double]], ptr %4, i64 0, i64 %indvars.iv34, i64 1
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = tail call double @llvm.fmuladd.f64(double %40, double %31, double %38)
  store double %41, ptr %37, align 16, !tbaa !9
  %42 = tail call double @llvm.fmuladd.f64(double %38, double %31, double %40)
  store double %42, ptr %39, align 8, !tbaa !9
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %exitcond40.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count39
  br i1 %exitcond40.not, label %.loopexit, label %35, !llvm.loop !17

._crit_edge:                                      ; preds = %.loopexit, %.preheader
  %43 = getelementptr inbounds i8, ptr %4, i64 8
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = fptrunc double %44 to float
  call void @llvm.lifetime.end.p0(i64 400, ptr nonnull %4) #4
  ret float %45
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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 willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass