; LLVM IR from jgaeddert/liquid-dsp :: src/fft/tests (spgram_autotest)

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

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [8 x i8], align 1

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

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #1

declare void @liquid_autotest_passed(...) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

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

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

declare i32 @spgramcf_estimate_psd(i32 noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_spgramcf_null() #4 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca float, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 1200, ptr %1, align 4, !tbaa !5
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = zext i32 %6 to i64
  %8 = call ptr @llvm.stacksave.p0()
  store ptr %8, ptr %2, align 8
  %9 = alloca float, i64 %7, align 16
  store i64 %7, ptr %3, align 8
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = call i32 @spgramcf_estimate_psd(i32 noundef %10, ptr noundef null, i32 noundef 0, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %12 = call float @log10f(float noundef 0x3D71979980000000) #5
  %13 = fmul float 1.000000e+01, %12
  store float %13, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %35, %0
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = icmp ult i32 %15, %16
  br i1 %17, label %18, label %38

18:                                               ; preds = %14
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds float, ptr %9, i64 %20
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = load float, ptr %4, align 4, !tbaa !9
  %24 = fcmp une float %22, %23
  br i1 %24, label %25, label %33

25:                                               ; preds = %18
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds float, ptr %9, i64 %27
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = fpext float %29 to double
  %31 = load float, ptr %4, align 4, !tbaa !9
  %32 = fpext float %31 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.1, i32 noundef 373, ptr noundef @.str.48, double noundef %30, ptr noundef @.str.3, ptr noundef @.str.72, double noundef %32)
  br label %34

33:                                               ; preds = %18
  call void (...) @liquid_autotest_passed()
  br label %34

34:                                               ; preds = %33, %25
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = add i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !5
  br label %14, !llvm.loop !11

38:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %39 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %39)
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 willreturn }
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 }

!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 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [8 x i8], align 1

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #0

declare void @liquid_autotest_passed(...) local_unnamed_addr #0

declare i32 @spgramcf_estimate_psd(i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @autotest_spgramcf_null() local_unnamed_addr #1 {
  %1 = alloca [1200 x float], align 16
  %2 = call i32 @spgramcf_estimate_psd(i32 noundef 1200, ptr noundef null, i32 noundef 0, ptr noundef nonnull %1) #2
  br label %3

3:                                                ; preds = %0, %10
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %10 ]
  %4 = getelementptr inbounds float, ptr %1, i64 %indvars.iv
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = fcmp une float %5, -1.200000e+02
  br i1 %6, label %7, label %9

7:                                                ; preds = %3
  %8 = fpext float %5 to double
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.1, i32 noundef 373, ptr noundef nonnull @.str.48, double noundef %8, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.72, double noundef -1.200000e+02) #2
  br label %10

9:                                                ; preds = %3
  call void (...) @liquid_autotest_passed() #2
  br label %10

10:                                               ; preds = %7, %9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1200
  br i1 %exitcond.not, label %11, label %3, !llvm.loop !9

11:                                               ; preds = %10
  ret void
}

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 = { 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 }

!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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass