; LLVM IR from jgaeddert/liquid-dsp :: src/fft/tests (spwaterfall_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 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [54 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

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

declare i32 @spwaterfallcf_set_rate(ptr noundef, float noundef) #1

declare i32 @spwaterfallcf_destroy(ptr noundef) #1

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

declare i32 @spwaterfallcf_push(ptr noundef, <2 x float> noundef) #1

declare float @randnf(...) #1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_spwaterfall_gnuplot() #2 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca { float, float }, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #3
  %4 = call ptr @spwaterfallcf_create_default(i32 noundef 540, i32 noundef 320)
  store ptr %4, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %5

5:                                                ; preds = %19, %0
  %6 = load i32, ptr %2, align 4, !tbaa !9
  %7 = icmp ult i32 %6, 800000
  br i1 %7, label %8, label %22

8:                                                ; preds = %5
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  %10 = call float (...) @randnf()
  %11 = call float (...) @randnf()
  %12 = fmul float 0.000000e+00, %11
  %13 = fmul float 1.000000e+00, %11
  %14 = fadd float %10, %12
  %15 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 0
  %16 = getelementptr inbounds { float, float }, ptr %3, i32 0, i32 1
  store float %14, ptr %15, align 4
  store float %13, ptr %16, align 4
  %17 = load <2 x float>, ptr %3, align 4
  %18 = call i32 @spwaterfallcf_push(ptr noundef %9, <2 x float> noundef %17)
  br label %19

19:                                               ; preds = %8
  %20 = load i32, ptr %2, align 4, !tbaa !9
  %21 = add i32 %20, 1
  store i32 %21, ptr %2, align 4, !tbaa !9
  br label %5, !llvm.loop !11

22:                                               ; preds = %5
  %23 = load ptr, ptr %1, align 8, !tbaa !5
  %24 = call i32 @spwaterfallcf_export(ptr noundef %23, ptr noundef @.str.46)
  %25 = icmp ne i32 0, %24
  br i1 %25, label %26, label %30

26:                                               ; preds = %22
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = call i32 @spwaterfallcf_export(ptr noundef %27, ptr noundef @.str.46)
  %29 = sitofp i32 %28 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 207, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.47, double noundef %29)
  br label %31

30:                                               ; preds = %22
  call void (...) @liquid_autotest_passed()
  br label %31

31:                                               ; preds = %30, %26
  %32 = load ptr, ptr %1, align 8, !tbaa !5
  %33 = call i32 @spwaterfallcf_set_freq(ptr noundef %32, float noundef 1.000000e+08)
  %34 = icmp ne i32 0, %33
  br i1 %34, label %35, label %39

35:                                               ; preds = %31
  %36 = load ptr, ptr %1, align 8, !tbaa !5
  %37 = call i32 @spwaterfallcf_set_freq(ptr noundef %36, float noundef 1.000000e+08)
  %38 = sitofp i32 %37 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 210, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.48, double noundef %38)
  br label %40

39:                                               ; preds = %31
  call void (...) @liquid_autotest_passed()
  br label %40

40:                                               ; preds = %39, %35
  %41 = load ptr, ptr %1, align 8, !tbaa !5
  %42 = call i32 @spwaterfallcf_set_rate(ptr noundef %41, float noundef 2.000000e+07)
  %43 = icmp ne i32 0, %42
  br i1 %43, label %44, label %48

44:                                               ; preds = %40
  %45 = load ptr, ptr %1, align 8, !tbaa !5
  %46 = call i32 @spwaterfallcf_set_rate(ptr noundef %45, float noundef 2.000000e+07)
  %47 = sitofp i32 %46 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 211, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.49, double noundef %47)
  br label %49

48:                                               ; preds = %40
  call void (...) @liquid_autotest_passed()
  br label %49

49:                                               ; preds = %48, %44
  %50 = load ptr, ptr %1, align 8, !tbaa !5
  %51 = call i32 @spwaterfallcf_set_dims(ptr noundef %50, i32 noundef 640, i32 noundef 480)
  %52 = icmp ne i32 0, %51
  br i1 %52, label %53, label %57

53:                                               ; preds = %49
  %54 = load ptr, ptr %1, align 8, !tbaa !5
  %55 = call i32 @spwaterfallcf_set_dims(ptr noundef %54, i32 noundef 640, i32 noundef 480)
  %56 = sitofp i32 %55 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 212, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.50, double noundef %56)
  br label %58

57:                                               ; preds = %49
  call void (...) @liquid_autotest_passed()
  br label %58

58:                                               ; preds = %57, %53
  %59 = load ptr, ptr %1, align 8, !tbaa !5
  %60 = call i32 @spwaterfallcf_set_commands(ptr noundef %59, ptr noundef null)
  %61 = icmp ne i32 0, %60
  br i1 %61, label %62, label %66

62:                                               ; preds = %58
  %63 = load ptr, ptr %1, align 8, !tbaa !5
  %64 = call i32 @spwaterfallcf_set_commands(ptr noundef %63, ptr noundef null)
  %65 = sitofp i32 %64 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 213, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.51, double noundef %65)
  br label %67

66:                                               ; preds = %58
  call void (...) @liquid_autotest_passed()
  br label %67

67:                                               ; preds = %66, %62
  %68 = load ptr, ptr %1, align 8, !tbaa !5
  %69 = call i32 @spwaterfallcf_set_commands(ptr noundef %68, ptr noundef @.str.52)
  %70 = icmp ne i32 0, %69
  br i1 %70, label %71, label %75

71:                                               ; preds = %67
  %72 = load ptr, ptr %1, align 8, !tbaa !5
  %73 = call i32 @spwaterfallcf_set_commands(ptr noundef %72, ptr noundef @.str.52)
  %74 = sitofp i32 %73 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 214, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.53, double noundef %74)
  br label %76

75:                                               ; preds = %67
  call void (...) @liquid_autotest_passed()
  br label %76

76:                                               ; preds = %75, %71
  %77 = load ptr, ptr %1, align 8, !tbaa !5
  %78 = call i32 @spwaterfallcf_export(ptr noundef %77, ptr noundef @.str.46)
  %79 = icmp ne i32 0, %78
  br i1 %79, label %80, label %84

80:                                               ; preds = %76
  %81 = load ptr, ptr %1, align 8, !tbaa !5
  %82 = call i32 @spwaterfallcf_export(ptr noundef %81, ptr noundef @.str.46)
  %83 = sitofp i32 %82 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 215, ptr noundef @.str.12, double noundef 0.000000e+00, ptr noundef @.str.3, ptr noundef @.str.47, double noundef %83)
  br label %85

84:                                               ; preds = %76
  call void (...) @liquid_autotest_passed()
  br label %85

85:                                               ; preds = %84, %80
  %86 = load ptr, ptr %1, align 8, !tbaa !5
  %87 = call i32 @spwaterfallcf_destroy(ptr noundef %86)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #3
  ret void
}

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

declare i32 @spwaterfallcf_set_freq(ptr noundef, float noundef) #1

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

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

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 = { nounwind uwtable "min-legal-vector-width"="64" "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 = !{!"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 = 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 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [54 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 ptr @spwaterfallcf_create_default(i32 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @spwaterfallcf_set_rate(ptr noundef, float noundef) local_unnamed_addr #0

declare i32 @spwaterfallcf_destroy(ptr noundef) local_unnamed_addr #0

declare i32 @spwaterfallcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #0

declare float @randnf(...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @autotest_spwaterfall_gnuplot() local_unnamed_addr #1 {
  %1 = tail call ptr @spwaterfallcf_create_default(i32 noundef 540, i32 noundef 320) #2
  br label %2

2:                                                ; preds = %0, %2
  %.024 = phi i32 [ 0, %0 ], [ %8, %2 ]
  %3 = tail call float (...) @randnf() #2
  %4 = tail call float (...) @randnf() #2
  %5 = fmul float %4, 0.000000e+00
  %6 = fadd float %3, %5
  %.sroa.0.0.vec.insert = insertelement <2 x float> poison, float %6, i64 0
  %.sroa.0.4.vec.insert = insertelement <2 x float> %.sroa.0.0.vec.insert, float %4, i64 1
  %7 = tail call i32 @spwaterfallcf_push(ptr noundef %1, <2 x float> noundef %.sroa.0.4.vec.insert) #2
  %8 = add nuw nsw i32 %.024, 1
  %exitcond.not = icmp eq i32 %8, 800000
  br i1 %exitcond.not, label %9, label %2, !llvm.loop !5

9:                                                ; preds = %2
  %10 = tail call i32 @spwaterfallcf_export(ptr noundef %1, ptr noundef nonnull @.str.46) #2
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %14, label %11

11:                                               ; preds = %9
  %12 = tail call i32 @spwaterfallcf_export(ptr noundef %1, ptr noundef nonnull @.str.46) #2
  %13 = sitofp i32 %12 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 207, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.47, double noundef %13) #2
  br label %15

14:                                               ; preds = %9
  tail call void (...) @liquid_autotest_passed() #2
  br label %15

15:                                               ; preds = %14, %11
  %16 = tail call i32 @spwaterfallcf_set_freq(ptr noundef %1, float noundef 1.000000e+08) #2
  %.not18 = icmp eq i32 %16, 0
  br i1 %.not18, label %20, label %17

17:                                               ; preds = %15
  %18 = tail call i32 @spwaterfallcf_set_freq(ptr noundef %1, float noundef 1.000000e+08) #2
  %19 = sitofp i32 %18 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 210, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.48, double noundef %19) #2
  br label %21

20:                                               ; preds = %15
  tail call void (...) @liquid_autotest_passed() #2
  br label %21

21:                                               ; preds = %20, %17
  %22 = tail call i32 @spwaterfallcf_set_rate(ptr noundef %1, float noundef 2.000000e+07) #2
  %.not19 = icmp eq i32 %22, 0
  br i1 %.not19, label %26, label %23

23:                                               ; preds = %21
  %24 = tail call i32 @spwaterfallcf_set_rate(ptr noundef %1, float noundef 2.000000e+07) #2
  %25 = sitofp i32 %24 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 211, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.49, double noundef %25) #2
  br label %27

26:                                               ; preds = %21
  tail call void (...) @liquid_autotest_passed() #2
  br label %27

27:                                               ; preds = %26, %23
  %28 = tail call i32 @spwaterfallcf_set_dims(ptr noundef %1, i32 noundef 640, i32 noundef 480) #2
  %.not20 = icmp eq i32 %28, 0
  br i1 %.not20, label %32, label %29

29:                                               ; preds = %27
  %30 = tail call i32 @spwaterfallcf_set_dims(ptr noundef %1, i32 noundef 640, i32 noundef 480) #2
  %31 = sitofp i32 %30 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 212, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.50, double noundef %31) #2
  br label %33

32:                                               ; preds = %27
  tail call void (...) @liquid_autotest_passed() #2
  br label %33

33:                                               ; preds = %32, %29
  %34 = tail call i32 @spwaterfallcf_set_commands(ptr noundef %1, ptr noundef null) #2
  %.not21 = icmp eq i32 %34, 0
  br i1 %.not21, label %38, label %35

35:                                               ; preds = %33
  %36 = tail call i32 @spwaterfallcf_set_commands(ptr noundef %1, ptr noundef null) #2
  %37 = sitofp i32 %36 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 213, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.51, double noundef %37) #2
  br label %39

38:                                               ; preds = %33
  tail call void (...) @liquid_autotest_passed() #2
  br label %39

39:                                               ; preds = %38, %35
  %40 = tail call i32 @spwaterfallcf_set_commands(ptr noundef %1, ptr noundef nonnull @.str.52) #2
  %.not22 = icmp eq i32 %40, 0
  br i1 %.not22, label %44, label %41

41:                                               ; preds = %39
  %42 = tail call i32 @spwaterfallcf_set_commands(ptr noundef %1, ptr noundef nonnull @.str.52) #2
  %43 = sitofp i32 %42 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 214, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.53, double noundef %43) #2
  br label %45

44:                                               ; preds = %39
  tail call void (...) @liquid_autotest_passed() #2
  br label %45

45:                                               ; preds = %44, %41
  %46 = tail call i32 @spwaterfallcf_export(ptr noundef %1, ptr noundef nonnull @.str.46) #2
  %.not23 = icmp eq i32 %46, 0
  br i1 %.not23, label %50, label %47

47:                                               ; preds = %45
  %48 = tail call i32 @spwaterfallcf_export(ptr noundef %1, ptr noundef nonnull @.str.46) #2
  %49 = sitofp i32 %48 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 215, ptr noundef nonnull @.str.12, double noundef 0.000000e+00, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.47, double noundef %49) #2
  br label %51

50:                                               ; preds = %45
  tail call void (...) @liquid_autotest_passed() #2
  br label %51

51:                                               ; preds = %50, %47
  %52 = tail call i32 @spwaterfallcf_destroy(ptr noundef %1) #2
  ret void
}

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

declare i32 @spwaterfallcf_set_freq(ptr noundef, float noundef) local_unnamed_addr #0

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

declare i32 @spwaterfallcf_set_commands(ptr noundef, ptr noundef) local_unnamed_addr #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 = { nounwind uwtable "min-legal-vector-width"="64" "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"}


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