; LLVM IR from jgaeddert/liquid-dsp :: sandbox (fft_recursive_plan_test)

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

@stderr = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [14 x i8], align 1

declare i32 @printf(ptr noundef, ...) #0

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
define dso_local void @liquid_fft_plan(i32 noundef %0, i32 noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca [40 x i32], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [40 x i32], align 16
  %11 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %17

14:                                               ; preds = %2
  %15 = load ptr, ptr @stderr, align 8, !tbaa !9
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str.7) #5
  call void @exit(i32 noundef 1) #6
  unreachable

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %24, %17
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp ult i32 %19, %20
  br i1 %21, label %22, label %27

22:                                               ; preds = %18
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %24

24:                                               ; preds = %22
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = add i32 %25, 1
  store i32 %26, ptr %5, align 4, !tbaa !5
  br label %18, !llvm.loop !11

27:                                               ; preds = %18
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %28)
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = icmp ult i32 %30, 8
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  store i32 1, ptr %6, align 4
  br label %93

34:                                               ; preds = %27
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = call i32 @fft_is_radix2(i32 noundef %35)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %34
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  store i32 1, ptr %6, align 4
  br label %93

40:                                               ; preds = %34
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = call i32 @liquid_is_prime(i32 noundef %41)
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %71

44:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 160, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sub i32 %45, 1
  %47 = getelementptr inbounds [40 x i32], ptr %7, i64 0, i64 0
  %48 = call i32 @liquid_factor(i32 noundef %46, ptr noundef %47, ptr noundef %8)
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = icmp ugt i32 %49, 2
  br i1 %50, label %51, label %59

51:                                               ; preds = %44
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sub i32 %52, 1
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %53)
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sub i32 %55, 1
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = add i32 %57, 1
  call void @liquid_fft_plan(i32 noundef %56, i32 noundef %58)
  store i32 1, ptr %6, align 4
  br label %70

59:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = mul i32 2, %60
  %62 = sub i32 %61, 4
  %63 = call i32 @liquid_nextpow2(i32 noundef %62)
  %64 = shl i32 1, %63
  store i32 %64, ptr %9, align 4, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, i32 noundef %65)
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = add i32 %68, 1
  call void @liquid_fft_plan(i32 noundef %67, i32 noundef %69)
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %70

70:                                               ; preds = %59, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr %7) #5
  br label %93

71:                                               ; preds = %40
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  call void @llvm.lifetime.start.p0(i64 160, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = getelementptr inbounds [40 x i32], ptr %10, i64 0, i64 0
  %77 = call i32 @liquid_factor(i32 noundef %75, ptr noundef %76, ptr noundef %11)
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %89, %73
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = load i32, ptr %11, align 4, !tbaa !5
  %81 = icmp ult i32 %79, %80
  br i1 %81, label %82, label %92

82:                                               ; preds = %78
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = zext i32 %83 to i64
  %85 = getelementptr inbounds [40 x i32], ptr %10, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = add i32 %87, 1
  call void @liquid_fft_plan(i32 noundef %86, i32 noundef %88)
  br label %89

89:                                               ; preds = %82
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = add i32 %90, 1
  store i32 %91, ptr %5, align 4, !tbaa !5
  br label %78, !llvm.loop !13

92:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr %10) #5
  store i32 0, ptr %6, align 4
  br label %93

93:                                               ; preds = %92, %70, %38, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %94 = load i32, ptr %6, align 4
  switch i32 %94, label %96 [
    i32 0, label %95
    i32 1, label %95
  ]

95:                                               ; preds = %93, %93
  ret void

96:                                               ; preds = %93
  unreachable
}

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

declare i32 @fft_is_radix2(i32 noundef) #0

declare i32 @liquid_is_prime(i32 noundef) #0

declare i32 @liquid_factor(i32 noundef, ptr noundef, ptr noundef) #0

declare i32 @liquid_nextpow2(i32 noundef) #0

attributes #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 = { noreturn 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 "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 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 #5 = { nounwind }
attributes #6 = { noreturn 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @liquid_fft_plan(i32 noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = alloca [40 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca [40 x i32], align 16
  %6 = alloca i32, align 4
  %7 = icmp eq i32 %0, 0
  br i1 %7, label %8, label %.preheader

.preheader:                                       ; preds = %2
  %.not29 = icmp eq i32 %1, 0
  br i1 %.not29, label %._crit_edge, label %.lr.ph

8:                                                ; preds = %2
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.7) #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.024 = phi i32 [ %12, %.lr.ph ], [ 0, %.preheader ]
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %12 = add nuw i32 %.024, 1
  %exitcond.not = icmp eq i32 %12, %1
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %0)
  %14 = icmp ult i32 %0, 8
  br i1 %14, label %15, label %17

15:                                               ; preds = %._crit_edge
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %49

17:                                               ; preds = %._crit_edge
  %18 = tail call i32 @fft_is_radix2(i32 noundef %0) #7
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %21, label %19

19:                                               ; preds = %17
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  br label %49

21:                                               ; preds = %17
  %22 = tail call i32 @liquid_is_prime(i32 noundef %0) #7
  %.not23 = icmp eq i32 %22, 0
  br i1 %.not23, label %38, label %23

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !11
  %24 = add i32 %0, -1
  %25 = call i32 @liquid_factor(i32 noundef %24, ptr noundef nonnull %3, ptr noundef nonnull %4) #7
  %26 = load i32, ptr %4, align 4, !tbaa !11
  %27 = icmp ugt i32 %26, 2
  br i1 %27, label %28, label %30

28:                                               ; preds = %23
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %24)
  br label %36

30:                                               ; preds = %23
  %31 = shl i32 %0, 1
  %32 = add i32 %31, -4
  %33 = call i32 @liquid_nextpow2(i32 noundef %32) #7
  %34 = shl nuw i32 1, %33
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, i32 noundef %34)
  br label %36

36:                                               ; preds = %30, %28
  %.sink = phi i32 [ %34, %30 ], [ %24, %28 ]
  %37 = add i32 %1, 1
  call void @liquid_fft_plan(i32 noundef %.sink, i32 noundef %37)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %3) #7
  br label %49

38:                                               ; preds = %21
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 0, ptr %6, align 4, !tbaa !11
  %40 = call i32 @liquid_factor(i32 noundef %0, ptr noundef nonnull %5, ptr noundef nonnull %6) #7
  %41 = load i32, ptr %6, align 4, !tbaa !11
  %.not30 = icmp eq i32 %41, 0
  br i1 %.not30, label %._crit_edge28, label %.lr.ph27

.lr.ph27:                                         ; preds = %38
  %42 = add i32 %1, 1
  br label %43

43:                                               ; preds = %.lr.ph27, %43
  %indvars.iv = phi i64 [ 0, %.lr.ph27 ], [ %indvars.iv.next, %43 ]
  %44 = getelementptr inbounds [40 x i32], ptr %5, i64 0, i64 %indvars.iv
  %45 = load i32, ptr %44, align 4, !tbaa !11
  call void @liquid_fft_plan(i32 noundef %45, i32 noundef %42)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = load i32, ptr %6, align 4, !tbaa !11
  %47 = zext i32 %46 to i64
  %48 = icmp ult i64 %indvars.iv.next, %47
  br i1 %48, label %43, label %._crit_edge28, !llvm.loop !13

._crit_edge28:                                    ; preds = %43, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %5) #7
  br label %49

49:                                               ; preds = %._crit_edge28, %36, %19, %15
  ret void
}

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

declare i32 @fft_is_radix2(i32 noundef) local_unnamed_addr #4

declare i32 @liquid_is_prime(i32 noundef) local_unnamed_addr #4

declare i32 @liquid_factor(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @liquid_nextpow2(i32 noundef) local_unnamed_addr #4

attributes #0 = { nofree 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { noreturn 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 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 #4 = { "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 #5 = { cold nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10}


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