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

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

%struct.spwaterfallcf_s = type { i32, i32, ptr, ptr, i32, i32, float, float, i32, i32, ptr }

@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [52 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @spgramcf_push(ptr noundef, <2 x float> noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @spwaterfallcf_push(ptr noundef %0, <2 x float> noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca { float, float }, align 4
  %5 = alloca ptr, align 8
  %6 = alloca { float, float }, align 4
  store <2 x float> %1, ptr %4, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %7, i32 0, i32 2
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 0
  %11 = load float, ptr %10, align 4
  %12 = getelementptr inbounds { float, float }, ptr %4, i32 0, i32 1
  %13 = load float, ptr %12, align 4
  %14 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %15 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  store float %11, ptr %14, align 4
  store float %13, ptr %15, align 4
  %16 = load <2 x float>, ptr %6, align 4
  %17 = call i32 @spgramcf_push(ptr noundef %9, <2 x float> noundef %16)
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %21

19:                                               ; preds = %2
  %20 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str.40, i32 noundef 307, ptr noundef @.str.53, ptr noundef @.str.2)
  store i32 %20, ptr %3, align 4
  br label %28

21:                                               ; preds = %2
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call i32 @spwaterfallcf_step(ptr noundef %22)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %21
  %26 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str.40, i32 noundef 309, ptr noundef @.str.54, ptr noundef @.str.2)
  store i32 %26, ptr %3, align 4
  br label %28

27:                                               ; preds = %21
  store i32 0, ptr %3, align 4
  br label %28

28:                                               ; preds = %27, %25, %19
  %29 = load i32, ptr %3, align 4
  ret i32 %29
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @spwaterfallcf_step(ptr noundef) #2

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

!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, !6, i64 8}
!10 = !{!"spwaterfallcf_s", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !12, i64 32, !12, i64 36, !11, i64 40, !11, i64 44, !6, i64 48}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}


; 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.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [52 x i8], align 1

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @spgramcf_push(ptr noundef, <2 x float> noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @spwaterfallcf_push(ptr noundef %0, <2 x float> noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call i32 @spgramcf_push(ptr noundef %4, <2 x float> noundef %1)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %8, label %6

6:                                                ; preds = %2
  %7 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str.40, i32 noundef 307, ptr noundef nonnull @.str.53, ptr noundef nonnull @.str.2) #3
  br label %12

8:                                                ; preds = %2
  %9 = tail call i32 @spwaterfallcf_step(ptr noundef nonnull %0)
  %.not4 = icmp eq i32 %9, 0
  br i1 %.not4, label %12, label %10

10:                                               ; preds = %8
  %11 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str.40, i32 noundef 309, ptr noundef nonnull @.str.54, ptr noundef nonnull @.str.2) #3
  br label %12

12:                                               ; preds = %8, %10, %6
  %.0 = phi i32 [ %7, %6 ], [ %11, %10 ], [ 0, %8 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @spwaterfallcf_step(ptr noundef) local_unnamed_addr #2

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

!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, !10, i64 8}
!6 = !{!"spwaterfallcf_s", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !7, i64 44, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass