; LLVM IR from vertver/Fresponze-old :: modules/r8brain-free-src/pffft.ll (Z9cffti1_psiPfPi)

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

@_ZZ9cffti1_psiPfPiE5ntryh = 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: mustprogress uwtable
define dso_local void @_Z9cffti1_psiPfPi(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) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !9
  %25 = call noundef i32 @_ZL9decomposeiPiPKi(i32 noundef %23, ptr noundef %24, ptr noundef @_ZZ9cffti1_psiPfPiE5ntryh)
  store i32 %25, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sitofp i32 %26 to float
  %28 = fdiv float 0x401921FB60000000, %27
  store float %28, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %135, %3
  %30 = load i32, ptr %7, align 4, !tbaa !5
  %31 = load i32, ptr %10, align 4, !tbaa !5
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %33, label %138

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

52:                                               ; preds = %130, %33
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = load i32, ptr %19, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %56, label %133

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

74:                                               ; preds = %102, %56
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = load i32, ptr %18, align 4, !tbaa !5
  %77 = icmp sle i32 %75, %76
  br i1 %77, label %78, label %105

78:                                               ; preds = %74
  %79 = load i32, ptr %12, align 4, !tbaa !5
  %80 = add nsw i32 %79, 2
  store i32 %80, ptr %12, align 4, !tbaa !5
  %81 = load i32, ptr %22, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %22, align 4, !tbaa !5
  %83 = load i32, ptr %22, align 4, !tbaa !5
  %84 = sitofp i32 %83 to float
  %85 = load float, ptr %20, align 4, !tbaa !11
  %86 = fmul float %84, %85
  %87 = call float @cosf(float noundef %86) #4
  %88 = load ptr, ptr %5, align 8, !tbaa !9
  %89 = load i32, ptr %12, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds float, ptr %88, i64 %91
  store float %87, ptr %92, align 4, !tbaa !11
  %93 = load i32, ptr %22, align 4, !tbaa !5
  %94 = sitofp i32 %93 to float
  %95 = load float, ptr %20, align 4, !tbaa !11
  %96 = fmul float %94, %95
  %97 = call float @sinf(float noundef %96) #4
  %98 = load ptr, ptr %5, align 8, !tbaa !9
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds float, ptr %98, i64 %100
  store float %97, ptr %101, align 4, !tbaa !11
  br label %102

102:                                              ; preds = %78
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = add nsw i32 %103, 2
  store i32 %104, ptr %9, align 4, !tbaa !5
  br label %74, !llvm.loop !13

105:                                              ; preds = %74
  %106 = load i32, ptr %14, align 4, !tbaa !5
  %107 = icmp sgt i32 %106, 5
  br i1 %107, label %108, label %129

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

129:                                              ; preds = %108, %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %8, align 4, !tbaa !5
  br label %52, !llvm.loop !15

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

135:                                              ; preds = %133
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %7, align 4, !tbaa !5
  br label %29, !llvm.loop !16

138:                                              ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL9decomposeiPiPKi(i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare float @cosf(float noundef) #3

; Function Attrs: nounwind
declare float @sinf(float noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 "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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple 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"

@_ZZ9cffti1_psiPfPiE5ntryh = external hidden constant [5 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z9cffti1_psiPfPi(i32 noundef %0, ptr nocapture noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call noundef i32 @_ZL9decomposeiPiPKi(i32 noundef %0, ptr noundef %2, ptr noundef nonnull @_ZZ9cffti1_psiPfPiE5ntryh)
  %5 = sitofp i32 %0 to float
  %6 = fdiv float 0x401921FB60000000, %5
  %.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
  %7 = add nuw i32 %4, 1
  %wide.trip.count = zext i32 %7 to i64
  %invariant.gep85 = getelementptr i8, ptr %1, i64 -4
  br label %8

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

8:                                                ; 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 ], [ %11, %.loopexit ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %9 = getelementptr inbounds i32, ptr %2, i64 %indvars.iv.next82
  %10 = load i32, ptr %9, align 4, !tbaa !7
  %11 = mul nsw i32 %10, %.05373
  %12 = sdiv i32 %0, %11
  %13 = shl nsw i32 %12, 1
  %.not55.not61 = icmp sgt i32 %10, 1
  br i1 %.not55.not61, label %.lr.ph66, label %.loopexit

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

.lr.ph66.split.us:                                ; preds = %.lr.ph66
  %15 = sext i32 %.05274 to i64
  %gep86 = getelementptr float, ptr %invariant.gep85, i64 %15
  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, %37
  %.05064 = phi i32 [ %38, %37 ], [ 1, %.lr.ph66 ]
  %.163 = phi i32 [ %30, %37 ], [ %.05274, %.lr.ph66 ]
  %.05462 = phi i32 [ %19, %37 ], [ 0, %.lr.ph66 ]
  %16 = sext i32 %.163 to i64
  %17 = getelementptr float, ptr %1, i64 %16
  %18 = getelementptr i8, ptr %17, i64 -4
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %18, align 4, !tbaa !11
  %19 = add nsw i32 %.05462, %.05373
  %20 = sitofp i32 %19 to float
  %21 = fmul float %6, %20
  br label %22

22:                                               ; preds = %.lr.ph, %22
  %indvars.iv = phi i64 [ %16, %.lr.ph ], [ %indvars.iv.next, %22 ]
  %.060 = phi i32 [ 0, %.lr.ph ], [ %23, %22 ]
  %.05159 = phi i32 [ 4, %.lr.ph ], [ %29, %22 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 2
  %23 = add nuw nsw i32 %.060, 1
  %24 = uitofp nneg i32 %23 to float
  %25 = fmul float %21, %24
  %26 = tail call float @cosf(float noundef %25) #2
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  store float %26, ptr %gep, align 4, !tbaa !11
  %27 = tail call float @sinf(float noundef %25) #2
  %28 = getelementptr inbounds float, ptr %1, i64 %indvars.iv.next
  store float %27, ptr %28, align 4, !tbaa !11
  %29 = add nuw nsw i32 %.05159, 2
  %.not56 = icmp sgt i32 %.05159, %13
  br i1 %.not56, label %._crit_edge, label %22, !llvm.loop !13

._crit_edge:                                      ; preds = %22
  %30 = trunc nsw i64 %indvars.iv.next to i32
  br i1 %14, label %31, label %37

31:                                               ; preds = %._crit_edge
  %sext = shl i64 %indvars.iv.next, 32
  %32 = ashr exact i64 %sext, 30
  %33 = getelementptr i8, ptr %1, i64 %32
  %34 = getelementptr i8, ptr %33, i64 -4
  %35 = load float, ptr %34, align 4, !tbaa !11
  store float %35, ptr %18, align 4, !tbaa !11
  %36 = load float, ptr %33, align 4, !tbaa !11
  store float %36, ptr %17, align 4, !tbaa !11
  br label %37

37:                                               ; preds = %31, %._crit_edge
  %38 = add nuw nsw i32 %.05064, 1
  %exitcond.not = icmp eq i32 %38, %10
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !14

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

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

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

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

attributes #0 = { 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 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++ 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