; LLVM IR from jgaeddert/liquid-dsp :: examples (firfilt_crcf_copy_example)

; 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 [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca { float, float }, align 4
  %6 = alloca { float, float }, align 4
  %7 = alloca { float, float }, align 4
  %8 = alloca { float, float }, align 4
  %9 = alloca ptr, align 8
  %10 = alloca { float, float }, align 4
  %11 = alloca { float, float }, align 4
  %12 = alloca float, align 4
  %13 = alloca { float, float }, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %14 = call ptr @firfilt_crcf_create_kaiser(i32 noundef 21, float noundef 0x3FD6147AE0000000, float noundef 6.000000e+01, float noundef 0.000000e+00)
  store ptr %14, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call i32 @firfilt_crcf_set_scale(ptr noundef %15, float noundef 2.000000e+00)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = call i32 @firfilt_crcf_print(ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %52, %0
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = icmp ult i32 %20, %21
  br i1 %22, label %23, label %55

23:                                               ; preds = %19
  %24 = call float (...) @randnf()
  %25 = call float (...) @randnf()
  %26 = fmul float 0.000000e+00, %25
  %27 = fmul float 1.000000e+00, %25
  %28 = fadd float %24, %26
  %29 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %30 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %28, ptr %29, align 4
  store float %27, ptr %30, align 4
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %33 = load float, ptr %32, align 4
  %34 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %35 = load float, ptr %34, align 4
  %36 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 0
  %37 = getelementptr inbounds { float, float }, ptr %8, i32 0, i32 1
  store float %33, ptr %36, align 4
  store float %35, ptr %37, align 4
  %38 = load <2 x float>, ptr %8, align 4
  %39 = call i32 @firfilt_crcf_execute_one(ptr noundef %31, <2 x float> noundef %38, ptr noundef %6)
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %42 = load float, ptr %41, align 4
  %43 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %44 = load float, ptr %43, align 4
  %45 = fpext float %42 to double
  %46 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %47 = load float, ptr %46, align 4
  %48 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %49 = load float, ptr %48, align 4
  %50 = fpext float %49 to double
  %51 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %40, double noundef %45, double noundef %50)
  br label %52

52:                                               ; preds = %23
  %53 = load i32, ptr %4, align 4, !tbaa !9
  %54 = add i32 %53, 1
  store i32 %54, ptr %4, align 4, !tbaa !9
  br label %19, !llvm.loop !11

55:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = call ptr @firfilt_crcf_copy(ptr noundef %56)
  store ptr %57, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %128, %55
  %59 = load i32, ptr %4, align 4, !tbaa !9
  %60 = load i32, ptr %3, align 4, !tbaa !9
  %61 = icmp ult i32 %59, %60
  br i1 %61, label %62, label %131

62:                                               ; preds = %58
  %63 = call float (...) @randnf()
  %64 = call float (...) @randnf()
  %65 = fmul float 0.000000e+00, %64
  %66 = fmul float 1.000000e+00, %64
  %67 = fadd float %63, %65
  %68 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %69 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  store float %67, ptr %68, align 4
  store float %66, ptr %69, align 4
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %72 = load float, ptr %71, align 4
  %73 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %74 = load float, ptr %73, align 4
  %75 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 0
  %76 = getelementptr inbounds { float, float }, ptr %10, i32 0, i32 1
  store float %72, ptr %75, align 4
  store float %74, ptr %76, align 4
  %77 = load <2 x float>, ptr %10, align 4
  %78 = call i32 @firfilt_crcf_execute_one(ptr noundef %70, <2 x float> noundef %77, ptr noundef %6)
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 0
  %81 = load float, ptr %80, align 4
  %82 = getelementptr inbounds { float, float }, ptr %5, i32 0, i32 1
  %83 = load float, ptr %82, align 4
  %84 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 0
  %85 = getelementptr inbounds { float, float }, ptr %11, i32 0, i32 1
  store float %81, ptr %84, align 4
  store float %83, ptr %85, align 4
  %86 = load <2 x float>, ptr %11, align 4
  %87 = call i32 @firfilt_crcf_execute_one(ptr noundef %79, <2 x float> noundef %86, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %88 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %89 = load float, ptr %88, align 4
  %90 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %91 = load float, ptr %90, align 4
  %92 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %93 = load float, ptr %92, align 4
  %94 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %95 = load float, ptr %94, align 4
  %96 = fsub float %89, %93
  %97 = fsub float %91, %95
  %98 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 0
  %99 = getelementptr inbounds { float, float }, ptr %13, i32 0, i32 1
  store float %96, ptr %98, align 4
  store float %97, ptr %99, align 4
  %100 = load <2 x float>, ptr %13, align 4
  %101 = call float @cabsf(<2 x float> noundef %100) #4
  store float %101, ptr %12, align 4, !tbaa !13
  %102 = load i32, ptr %4, align 4, !tbaa !9
  %103 = load i32, ptr %3, align 4, !tbaa !9
  %104 = add i32 %102, %103
  %105 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %106 = load float, ptr %105, align 4
  %107 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %108 = load float, ptr %107, align 4
  %109 = fpext float %106 to double
  %110 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 0
  %111 = load float, ptr %110, align 4
  %112 = getelementptr inbounds { float, float }, ptr %6, i32 0, i32 1
  %113 = load float, ptr %112, align 4
  %114 = fpext float %113 to double
  %115 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %116 = load float, ptr %115, align 4
  %117 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %118 = load float, ptr %117, align 4
  %119 = fpext float %116 to double
  %120 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 0
  %121 = load float, ptr %120, align 4
  %122 = getelementptr inbounds { float, float }, ptr %7, i32 0, i32 1
  %123 = load float, ptr %122, align 4
  %124 = fpext float %123 to double
  %125 = load float, ptr %12, align 4, !tbaa !13
  %126 = fpext float %125 to double
  %127 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %104, double noundef %109, double noundef %114, double noundef %119, double noundef %124, double noundef %126)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %128

128:                                              ; preds = %62
  %129 = load i32, ptr %4, align 4, !tbaa !9
  %130 = add i32 %129, 1
  store i32 %130, ptr %4, align 4, !tbaa !9
  br label %58, !llvm.loop !15

131:                                              ; preds = %58
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = call i32 @firfilt_crcf_destroy(ptr noundef %132)
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = call i32 @firfilt_crcf_destroy(ptr noundef %134)
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

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

declare ptr @firfilt_crcf_create_kaiser(i32 noundef, float noundef, float noundef, float noundef) #2

declare i32 @firfilt_crcf_set_scale(ptr noundef, float noundef) #2

declare i32 @firfilt_crcf_print(ptr noundef) #2

declare float @randnf(...) #2

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

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

declare ptr @firfilt_crcf_copy(ptr noundef) #2

; Function Attrs: nounwind
declare float @cabsf(<2 x float> noundef) #3

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

declare i32 @firfilt_crcf_destroy(ptr noundef) #2

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

!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"}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !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"

@.str = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca { float, float }, align 8
  %2 = alloca { float, float }, align 8
  %3 = tail call ptr @firfilt_crcf_create_kaiser(i32 noundef 21, float noundef 0x3FD6147AE0000000, float noundef 6.000000e+01, float noundef 0.000000e+00) #5
  %4 = tail call i32 @firfilt_crcf_set_scale(ptr noundef %3, float noundef 2.000000e+00) #5
  %5 = tail call i32 @firfilt_crcf_print(ptr noundef %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  br label %7

7:                                                ; preds = %0, %7
  %.029 = phi i32 [ 0, %0 ], [ %18, %7 ]
  %8 = call float (...) @randnf() #5
  %9 = call float (...) @randnf() #5
  %10 = fmul float %9, 0.000000e+00
  %11 = fadd float %8, %10
  %.sroa.08.0.vec.insert = insertelement <2 x float> poison, float %11, i64 0
  %.sroa.08.4.vec.insert = insertelement <2 x float> %.sroa.08.0.vec.insert, float %9, i64 1
  %12 = call i32 @firfilt_crcf_execute_one(ptr noundef %3, <2 x float> noundef %.sroa.08.4.vec.insert, ptr noundef nonnull %1) #5
  %13 = load float, ptr %1, align 8
  %14 = fpext float %13 to double
  %15 = load float, ptr %6, align 4
  %16 = fpext float %15 to double
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.029, double noundef %14, double noundef %16)
  %18 = add nuw nsw i32 %.029, 1
  %exitcond.not = icmp eq i32 %18, 32
  br i1 %exitcond.not, label %19, label %7, !llvm.loop !5

19:                                               ; preds = %7
  %20 = call ptr @firfilt_crcf_copy(ptr noundef %3) #5
  %21 = getelementptr inbounds i8, ptr %2, i64 4
  br label %22

22:                                               ; preds = %19, %22
  %.130 = phi i32 [ 0, %19 ], [ %44, %22 ]
  %23 = call float (...) @randnf() #5
  %24 = call float (...) @randnf() #5
  %25 = fmul float %24, 0.000000e+00
  %26 = fadd float %23, %25
  %.sroa.04.0.vec.insert = insertelement <2 x float> poison, float %26, i64 0
  %.sroa.04.4.vec.insert = insertelement <2 x float> %.sroa.04.0.vec.insert, float %24, i64 1
  %27 = call i32 @firfilt_crcf_execute_one(ptr noundef %3, <2 x float> noundef %.sroa.04.4.vec.insert, ptr noundef nonnull %1) #5
  %28 = call i32 @firfilt_crcf_execute_one(ptr noundef %20, <2 x float> noundef %.sroa.04.4.vec.insert, ptr noundef nonnull %2) #5
  %29 = load <2 x float>, ptr %1, align 8
  %30 = load <2 x float>, ptr %2, align 8
  %31 = fsub <2 x float> %29, %30
  %32 = call float @cabsf(<2 x float> noundef %31) #5
  %33 = or disjoint i32 %.130, 32
  %34 = load float, ptr %1, align 8
  %35 = fpext float %34 to double
  %36 = load float, ptr %6, align 4
  %37 = fpext float %36 to double
  %38 = load float, ptr %2, align 8
  %39 = fpext float %38 to double
  %40 = load float, ptr %21, align 4
  %41 = fpext float %40 to double
  %42 = fpext float %32 to double
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %33, double noundef %35, double noundef %37, double noundef %39, double noundef %41, double noundef %42)
  %44 = add nuw nsw i32 %.130, 1
  %exitcond31.not = icmp eq i32 %44, 32
  br i1 %exitcond31.not, label %45, label %22, !llvm.loop !7

45:                                               ; preds = %22
  %46 = call i32 @firfilt_crcf_destroy(ptr noundef %3) #5
  %47 = call i32 @firfilt_crcf_destroy(ptr noundef %20) #5
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 0
}

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

declare ptr @firfilt_crcf_create_kaiser(i32 noundef, float noundef, float noundef, float noundef) local_unnamed_addr #2

declare i32 @firfilt_crcf_set_scale(ptr noundef, float noundef) local_unnamed_addr #2

declare i32 @firfilt_crcf_print(ptr noundef) local_unnamed_addr #2

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

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

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

declare ptr @firfilt_crcf_copy(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare float @cabsf(<2 x float> noundef) local_unnamed_addr #4

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

declare i32 @firfilt_crcf_destroy(ptr noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 #4 = { 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass