; 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.spgramcf_s = type { i32, i32, i32, i32, float, float, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i64, i64, i64, i64, float, float }

; Function Attrs: nounwind uwtable
define dso_local i32 @spgramcf_push(ptr noundef %0, <2 x float> noundef %1) #0 {
  %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.spgramcf_s, ptr %7, i32 0, i32 7
  %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 @windowcf_push(ptr noundef %9, <2 x float> noundef %16)
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.spgramcf_s, ptr %18, i32 0, i32 14
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = add i64 %20, 1
  store i64 %21, ptr %19, align 8, !tbaa !14
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.spgramcf_s, ptr %22, i32 0, i32 15
  %24 = load i64, ptr %23, align 8, !tbaa !15
  %25 = add i64 %24, 1
  store i64 %25, ptr %23, align 8, !tbaa !15
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.spgramcf_s, ptr %26, i32 0, i32 13
  %28 = load i32, ptr %27, align 8, !tbaa !16
  %29 = add i32 %28, -1
  store i32 %29, ptr %27, align 8, !tbaa !16
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.spgramcf_s, ptr %30, i32 0, i32 13
  %32 = load i32, ptr %31, align 8, !tbaa !16
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %43

35:                                               ; preds = %2
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.spgramcf_s, ptr %36, i32 0, i32 3
  %38 = load i32, ptr %37, align 4, !tbaa !17
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.spgramcf_s, ptr %39, i32 0, i32 13
  store i32 %38, ptr %40, align 8, !tbaa !16
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call i32 @spgramcf_step(ptr noundef %41)
  store i32 %42, ptr %3, align 4
  br label %43

43:                                               ; preds = %35, %34
  %44 = load i32, ptr %3, align 4
  ret i32 %44
}

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @spgramcf_step(ptr noundef) #0

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

!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 32}
!10 = !{!"spgramcf_s", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 20, !11, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !11, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !12, i64 120, !12, i64 124}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!10, !13, i64 88}
!15 = !{!10, !13, i64 96}
!16 = !{!10, !11, i64 80}
!17 = !{!10, !11, i64 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"

; Function Attrs: nounwind uwtable
define dso_local i32 @spgramcf_push(ptr noundef %0, <2 x float> noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call i32 @windowcf_push(ptr noundef %4, <2 x float> noundef %1) #2
  %6 = getelementptr inbounds i8, ptr %0, i64 88
  %7 = load <2 x i64>, ptr %6, align 8, !tbaa !13
  %8 = add <2 x i64> %7, <i64 1, i64 1>
  store <2 x i64> %8, ptr %6, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 80
  %10 = load i32, ptr %9, align 8, !tbaa !14
  %11 = add i32 %10, -1
  store i32 %11, ptr %9, align 8, !tbaa !14
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %16

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !15
  store i32 %14, ptr %9, align 8, !tbaa !14
  %15 = tail call i32 @spgramcf_step(ptr noundef nonnull %0)
  br label %16

16:                                               ; preds = %2, %12
  %.0 = phi i32 [ %15, %12 ], [ 0, %2 ]
  ret i32 %.0
}

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

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

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

!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, !11, i64 32}
!6 = !{!"spgramcf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 20, !7, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !7, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !10, i64 120, !10, i64 124}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!6, !7, i64 80}
!15 = !{!6, !7, i64 12}


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