; LLVM IR from jgaeddert/liquid-dsp :: src/filter/tests (firdes_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"

@__const.autotest_liquid_firdes_rcos.h0 = external hidden unnamed_addr constant [13 x float], align 16
@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_liquid_firdes_rcos() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca [13 x float], align 16
  %6 = alloca [13 x float], align 16
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 2, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 3, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store float 0x3FD3333340000000, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store float 0.000000e+00, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 52, ptr %5) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.autotest_liquid_firdes_rcos.h0, i64 52, i1 false)
  call void @llvm.lifetime.start.p0(i64 52, ptr %6) #6
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = load float, ptr %3, align 4, !tbaa !9
  %11 = load float, ptr %4, align 4, !tbaa !9
  %12 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 0
  %13 = call i32 @liquid_firdes_rcos(i32 noundef %8, i32 noundef %9, float noundef %10, float noundef %11, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %130, %0
  %15 = load i32, ptr %7, align 4, !tbaa !5
  %16 = icmp ult i32 %15, 13
  br i1 %16, label %17, label %133

17:                                               ; preds = %14
  %18 = load i32, ptr %7, align 4, !tbaa !5
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = load i32, ptr %7, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %23
  %25 = load float, ptr %24, align 4, !tbaa !9
  %26 = fsub float %21, %25
  %27 = fpext float %26 to double
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %29
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = zext i32 %32 to i64
  %34 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %33
  %35 = load float, ptr %34, align 4, !tbaa !9
  %36 = fsub float %31, %35
  %37 = fpext float %36 to double
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %39
  %41 = load float, ptr %40, align 4, !tbaa !9
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %43
  %45 = load float, ptr %44, align 4, !tbaa !9
  %46 = fsub float %41, %45
  %47 = fpext float %46 to double
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = zext i32 %52 to i64
  %54 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %53
  %55 = load float, ptr %54, align 4, !tbaa !9
  %56 = fsub float %51, %55
  %57 = fpext float %56 to double
  %58 = call double @llvm.fmuladd.f64(double %27, double %37, double 0.000000e+00)
  %59 = call double @sqrt(double noundef %58) #6
  %60 = fcmp ogt double %59, 0x3EE4F8B580000000
  br i1 %60, label %85, label %61

61:                                               ; preds = %17
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = zext i32 %62 to i64
  %64 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %63
  %65 = load float, ptr %64, align 4, !tbaa !9
  %66 = call i1 @llvm.is.fpclass.f32(float %65, i32 3)
  br i1 %66, label %85, label %67

67:                                               ; preds = %61
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %69
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %72, label %85, label %73

73:                                               ; preds = %67
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = zext i32 %74 to i64
  %76 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %75
  %77 = load float, ptr %76, align 4, !tbaa !9
  %78 = call i1 @llvm.is.fpclass.f32(float %77, i32 3)
  br i1 %78, label %85, label %79

79:                                               ; preds = %73
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %81
  %83 = load float, ptr %82, align 4, !tbaa !9
  %84 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %84, label %85, label %128

85:                                               ; preds = %79, %73, %67, %61, %17
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %87
  %89 = load float, ptr %88, align 4, !tbaa !9
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = zext i32 %90 to i64
  %92 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %91
  %93 = load float, ptr %92, align 4, !tbaa !9
  %94 = fsub float %89, %93
  %95 = fpext float %94 to double
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %97
  %99 = load float, ptr %98, align 4, !tbaa !9
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %101
  %103 = load float, ptr %102, align 4, !tbaa !9
  %104 = fsub float %99, %103
  %105 = fpext float %104 to double
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %107
  %109 = load float, ptr %108, align 4, !tbaa !9
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = zext i32 %110 to i64
  %112 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %111
  %113 = load float, ptr %112, align 4, !tbaa !9
  %114 = fsub float %109, %113
  %115 = fpext float %114 to double
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = zext i32 %116 to i64
  %118 = getelementptr inbounds [13 x float], ptr %6, i64 0, i64 %117
  %119 = load float, ptr %118, align 4, !tbaa !9
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds [13 x float], ptr %5, i64 0, i64 %121
  %123 = load float, ptr %122, align 4, !tbaa !9
  %124 = fsub float %119, %123
  %125 = fpext float %124 to double
  %126 = call double @llvm.fmuladd.f64(double %95, double %105, double 0.000000e+00)
  %127 = call double @sqrt(double noundef %126) #6
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 56, ptr noundef @.str.1, double noundef %127, ptr noundef @.str.2, ptr noundef @.str.3, double noundef 0x3EE4F8B580000000)
  br label %129

128:                                              ; preds = %79
  call void (...) @liquid_autotest_passed()
  br label %129

129:                                              ; preds = %128, %85
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = add i32 %131, 1
  store i32 %132, ptr %7, align 4, !tbaa !5
  br label %14, !llvm.loop !11

133:                                              ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 52, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 52, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare i32 @liquid_firdes_rcos(i32 noundef, i32 noundef, float noundef, float noundef, ptr noundef) #3

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i1 @llvm.is.fpclass.f32(float, i32 immarg) #5

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

declare void @liquid_autotest_passed(...) #3

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

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

@__const.autotest_liquid_firdes_rcos.h0 = external hidden unnamed_addr constant [13 x float], align 16
@.str = external hidden unnamed_addr constant [89 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_liquid_firdes_rcos() local_unnamed_addr #0 {
  %1 = alloca [13 x float], align 16
  call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %1) #5
  %2 = call i32 @liquid_firdes_rcos(i32 noundef 2, i32 noundef 3, float noundef 0x3FD3333340000000, float noundef 0.000000e+00, ptr noundef nonnull %1) #5
  br label %3

3:                                                ; preds = %0, %17
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %17 ]
  %4 = getelementptr inbounds [13 x float], ptr %1, i64 0, i64 %indvars.iv
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds [13 x float], ptr @__const.autotest_liquid_firdes_rcos.h0, i64 0, i64 %indvars.iv
  %7 = load float, ptr %6, align 4, !tbaa !5
  %8 = fsub float %5, %7
  %9 = fpext float %8 to double
  %10 = call double @llvm.fmuladd.f64(double %9, double %9, double 0.000000e+00)
  %sqrt = call double @llvm.sqrt.f64(double %10)
  %11 = fcmp ogt double %sqrt, 0x3EE4F8B580000000
  br i1 %11, label %15, label %12

12:                                               ; preds = %3
  %13 = fcmp uno float %5, 0.000000e+00
  %14 = fcmp uno float %7, 0.000000e+00
  %or.cond = select i1 %13, i1 true, i1 %14
  br i1 %or.cond, label %15, label %16

15:                                               ; preds = %12, %3
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 56, ptr noundef nonnull @.str.1, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3EE4F8B580000000) #5
  br label %17

16:                                               ; preds = %12
  call void (...) @liquid_autotest_passed() #5
  br label %17

17:                                               ; preds = %15, %16
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 13
  br i1 %exitcond.not, label %18, label %3, !llvm.loop !9

18:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %1) #5
  ret void
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #4

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"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: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass