; LLVM IR from glaretechnologies/substrata :: resonance-audio/third_party/pffft (pffft)

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

@cffti1_ps.ntryh = external hidden constant [5 x i32], align 16

; 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 @cffti1_ps(i32 noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca float, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca float, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !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 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !9
  %25 = call i32 @decompose(i32 noundef %23, ptr noundef %24, ptr noundef @cffti1_ps.ntryh)
  store i32 %25, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sitofp i32 %26 to float
  %28 = fpext float %27 to double
  %29 = fdiv double 0x401921FB54442D18, %28
  %30 = fptrunc double %29 to float
  store float %30, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 1, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 1, ptr %13, align 4, !tbaa !5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %141, %3
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = load i32, ptr %10, align 4, !tbaa !5
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %35, label %144

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %36 = load ptr, ptr %6, align 8, !tbaa !9
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %36, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  store i32 %41, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %42 = load i32, ptr %13, align 4, !tbaa !5
  %43 = load i32, ptr %14, align 4, !tbaa !5
  %44 = mul nsw i32 %42, %43
  store i32 %44, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = load i32, ptr %16, align 4, !tbaa !5
  %47 = sdiv i32 %45, %46
  store i32 %47, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %48 = load i32, ptr %17, align 4, !tbaa !5
  %49 = load i32, ptr %17, align 4, !tbaa !5
  %50 = add nsw i32 %48, %49
  %51 = add nsw i32 %50, 2
  store i32 %51, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %52 = load i32, ptr %14, align 4, !tbaa !5
  %53 = sub nsw i32 %52, 1
  store i32 %53, ptr %19, align 4, !tbaa !5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %136, %35
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = load i32, ptr %19, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %58, label %139

58:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %59 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %59, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  store i32 0, ptr %22, align 4, !tbaa !5
  %60 = load ptr, ptr %5, align 8, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds float, ptr %60, i64 %63
  store float 1.000000e+00, ptr %64, align 4, !tbaa !11
  %65 = load ptr, ptr %5, align 8, !tbaa !9
  %66 = load i32, ptr %12, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds float, ptr %65, i64 %67
  store float 0.000000e+00, ptr %68, align 4, !tbaa !11
  %69 = load i32, ptr %13, align 4, !tbaa !5
  %70 = load i32, ptr %15, align 4, !tbaa !5
  %71 = add nsw i32 %70, %69
  store i32 %71, ptr %15, align 4, !tbaa !5
  %72 = load i32, ptr %15, align 4, !tbaa !5
  %73 = sitofp i32 %72 to float
  %74 = load float, ptr %11, align 4, !tbaa !11
  %75 = fmul float %73, %74
  store float %75, ptr %20, align 4, !tbaa !11
  store i32 4, ptr %9, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %108, %58
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %18, align 4, !tbaa !5
  %79 = icmp sle i32 %77, %78
  br i1 %79, label %80, label %111

80:                                               ; preds = %76
  %81 = load i32, ptr %12, align 4, !tbaa !5
  %82 = add nsw i32 %81, 2
  store i32 %82, ptr %12, align 4, !tbaa !5
  %83 = load i32, ptr %22, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %22, align 4, !tbaa !5
  %85 = load i32, ptr %22, align 4, !tbaa !5
  %86 = sitofp i32 %85 to float
  %87 = load float, ptr %20, align 4, !tbaa !11
  %88 = fmul float %86, %87
  %89 = fpext float %88 to double
  %90 = call double @cos(double noundef %89) #3
  %91 = fptrunc double %90 to float
  %92 = load ptr, ptr %5, align 8, !tbaa !9
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = sub nsw i32 %93, 1
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds float, ptr %92, i64 %95
  store float %91, ptr %96, align 4, !tbaa !11
  %97 = load i32, ptr %22, align 4, !tbaa !5
  %98 = sitofp i32 %97 to float
  %99 = load float, ptr %20, align 4, !tbaa !11
  %100 = fmul float %98, %99
  %101 = fpext float %100 to double
  %102 = call double @sin(double noundef %101) #3
  %103 = fptrunc double %102 to float
  %104 = load ptr, ptr %5, align 8, !tbaa !9
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds float, ptr %104, i64 %106
  store float %103, ptr %107, align 4, !tbaa !11
  br label %108

108:                                              ; preds = %80
  %109 = load i32, ptr %9, align 4, !tbaa !5
  %110 = add nsw i32 %109, 2
  store i32 %110, ptr %9, align 4, !tbaa !5
  br label %76, !llvm.loop !13

111:                                              ; preds = %76
  %112 = load i32, ptr %14, align 4, !tbaa !5
  %113 = icmp sgt i32 %112, 5
  br i1 %113, label %114, label %135

114:                                              ; preds = %111
  %115 = load ptr, ptr %5, align 8, !tbaa !9
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = sub nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds float, ptr %115, i64 %118
  %120 = load float, ptr %119, align 4, !tbaa !11
  %121 = load ptr, ptr %5, align 8, !tbaa !9
  %122 = load i32, ptr %21, align 4, !tbaa !5
  %123 = sub nsw i32 %122, 1
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds float, ptr %121, i64 %124
  store float %120, ptr %125, align 4, !tbaa !11
  %126 = load ptr, ptr %5, align 8, !tbaa !9
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds float, ptr %126, i64 %128
  %130 = load float, ptr %129, align 4, !tbaa !11
  %131 = load ptr, ptr %5, align 8, !tbaa !9
  %132 = load i32, ptr %21, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds float, ptr %131, i64 %133
  store float %130, ptr %134, align 4, !tbaa !11
  br label %135

135:                                              ; preds = %114, %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %8, align 4, !tbaa !5
  br label %54, !llvm.loop !15

139:                                              ; preds = %54
  %140 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %140, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %141

141:                                              ; preds = %139
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %7, align 4, !tbaa !5
  br label %31, !llvm.loop !16

144:                                              ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, 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 void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @decompose(i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare double @cos(double noundef) #2

; Function Attrs: nounwind
declare double @sin(double noundef) #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 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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}
!16 = distinct !{!16, !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"

@cffti1_ps.ntryh = external hidden constant [5 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local void @cffti1_ps(i32 noundef %0, ptr nocapture noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call i32 @decompose(i32 noundef %0, ptr noundef %2, ptr noundef nonnull @cffti1_ps.ntryh)
  %5 = sitofp i32 %0 to float
  %6 = fpext float %5 to double
  %7 = fdiv double 0x401921FB54442D18, %6
  %8 = fptrunc double %7 to float
  %.not72 = icmp slt i32 %4, 1
  br i1 %.not72, label %._crit_edge78, label %.lr.ph77

.lr.ph77:                                         ; preds = %3
  %invariant.gep = getelementptr i8, ptr %1, i64 4
  %9 = add nuw i32 %4, 1
  %wide.trip.count = zext i32 %9 to i64
  %invariant.gep85 = getelementptr i8, ptr %1, i64 -4
  br label %10

.loopexit:                                        ; preds = %42, %.lr.ph66.split.us, %10
  %.1.lcssa = phi i32 [ %.05274, %10 ], [ %.05274, %.lr.ph66.split.us ], [ %35, %42 ]
  %exitcond84.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count
  br i1 %exitcond84.not, label %._crit_edge78, label %10, !llvm.loop !5

10:                                               ; preds = %.lr.ph77, %.loopexit
  %indvars.iv81 = phi i64 [ 1, %.lr.ph77 ], [ %indvars.iv.next82, %.loopexit ]
  %.05274 = phi i32 [ 1, %.lr.ph77 ], [ %.1.lcssa, %.loopexit ]
  %.05373 = phi i32 [ 1, %.lr.ph77 ], [ %13, %.loopexit ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %11 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv.next82
  %12 = load i32, ptr %11, align 4, !tbaa !7
  %13 = mul nsw i32 %12, %.05373
  %14 = sdiv i32 %0, %13
  %15 = shl nsw i32 %14, 1
  %.not55.not61 = icmp sgt i32 %12, 1
  br i1 %.not55.not61, label %.lr.ph66, label %.loopexit

.lr.ph66:                                         ; preds = %10
  %.not5657 = icmp slt i32 %14, 1
  %16 = icmp ugt i32 %12, 5
  br i1 %.not5657, label %.lr.ph66.split.us, label %.lr.ph

.lr.ph66.split.us:                                ; preds = %.lr.ph66
  %17 = sext i32 %.05274 to i64
  %gep86 = getelementptr float, ptr %invariant.gep85, i64 %17
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %gep86, align 4, !tbaa !11
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph66, %42
  %.05064 = phi i32 [ %43, %42 ], [ 1, %.lr.ph66 ]
  %.163 = phi i32 [ %35, %42 ], [ %.05274, %.lr.ph66 ]
  %.05462 = phi i32 [ %21, %42 ], [ 0, %.lr.ph66 ]
  %18 = sext i32 %.163 to i64
  %19 = getelementptr float, ptr %1, i64 %18
  %20 = getelementptr i8, ptr %19, i64 -4
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %20, align 4, !tbaa !11
  %21 = add nsw i32 %.05462, %.05373
  %22 = sitofp i32 %21 to float
  %23 = fmul float %8, %22
  br label %24

24:                                               ; preds = %.lr.ph, %24
  %indvars.iv = phi i64 [ %18, %.lr.ph ], [ %indvars.iv.next, %24 ]
  %.060 = phi i32 [ 0, %.lr.ph ], [ %25, %24 ]
  %.05159 = phi i32 [ 4, %.lr.ph ], [ %34, %24 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 2
  %25 = add nuw nsw i32 %.060, 1
  %26 = uitofp nneg i32 %25 to float
  %27 = fmul float %23, %26
  %28 = fpext float %27 to double
  %29 = tail call double @cos(double noundef %28) #2
  %30 = fptrunc double %29 to float
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  store float %30, ptr %gep, align 4, !tbaa !11
  %31 = tail call double @sin(double noundef %28) #2
  %32 = fptrunc double %31 to float
  %33 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next
  store float %32, ptr %33, align 4, !tbaa !11
  %34 = add nuw nsw i32 %.05159, 2
  %.not56 = icmp sgt i32 %.05159, %15
  br i1 %.not56, label %._crit_edge, label %24, !llvm.loop !13

._crit_edge:                                      ; preds = %24
  %35 = trunc nsw i64 %indvars.iv.next to i32
  br i1 %16, label %36, label %42

36:                                               ; preds = %._crit_edge
  %sext = shl i64 %indvars.iv.next, 32
  %37 = ashr exact i64 %sext, 30
  %38 = getelementptr i8, ptr %1, i64 %37
  %39 = getelementptr i8, ptr %38, i64 -4
  %40 = load float, ptr %39, align 4, !tbaa !11
  store float %40, ptr %20, align 4, !tbaa !11
  %41 = load float, ptr %38, align 4, !tbaa !11
  store float %41, ptr %19, align 4, !tbaa !11
  br label %42

42:                                               ; preds = %36, %._crit_edge
  %43 = add nuw nsw i32 %.05064, 1
  %exitcond.not = icmp eq i32 %43, %12
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !14

._crit_edge78:                                    ; preds = %.loopexit, %3
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @decompose(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #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 = { mustprogress nofree nounwind willreturn memory(write) "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !9, i64 0}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}


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