; LLVM IR from jgaeddert/liquid-dsp :: src/dotprod/tests (sumsqcf_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.1 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @sumsqcf_runtest(ptr noundef %0, i32 noundef %1, float noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store float 0x3EB0C6F7A0000000, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = load i32, ptr %5, align 4, !tbaa !9
  %11 = call float @liquid_sumsqcf(ptr noundef %9, i32 noundef %10)
  store float %11, ptr %8, align 4, !tbaa !11
  %12 = load float, ptr %8, align 4, !tbaa !11
  %13 = load float, ptr %6, align 4, !tbaa !11
  %14 = fsub float %12, %13
  %15 = fpext float %14 to double
  %16 = load float, ptr %8, align 4, !tbaa !11
  %17 = load float, ptr %6, align 4, !tbaa !11
  %18 = fsub float %16, %17
  %19 = fpext float %18 to double
  %20 = load float, ptr %8, align 4, !tbaa !11
  %21 = load float, ptr %6, align 4, !tbaa !11
  %22 = fsub float %20, %21
  %23 = fpext float %22 to double
  %24 = load float, ptr %8, align 4, !tbaa !11
  %25 = load float, ptr %6, align 4, !tbaa !11
  %26 = fsub float %24, %25
  %27 = fpext float %26 to double
  %28 = call double @llvm.fmuladd.f64(double %15, double %19, double 0.000000e+00)
  %29 = call double @sqrt(double noundef %28) #5
  %30 = load float, ptr %7, align 4, !tbaa !11
  %31 = fpext float %30 to double
  %32 = fcmp ogt double %29, %31
  br i1 %32, label %45, label %33

33:                                               ; preds = %3
  %34 = load float, ptr %8, align 4, !tbaa !11
  %35 = call i1 @llvm.is.fpclass.f32(float %34, i32 3)
  br i1 %35, label %45, label %36

36:                                               ; preds = %33
  %37 = load float, ptr %8, align 4, !tbaa !11
  %38 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %38, label %45, label %39

39:                                               ; preds = %36
  %40 = load float, ptr %6, align 4, !tbaa !11
  %41 = call i1 @llvm.is.fpclass.f32(float %40, i32 3)
  br i1 %41, label %45, label %42

42:                                               ; preds = %39
  %43 = load float, ptr %6, align 4, !tbaa !11
  %44 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %44, label %45, label %66

45:                                               ; preds = %42, %39, %36, %33, %3
  %46 = load float, ptr %8, align 4, !tbaa !11
  %47 = load float, ptr %6, align 4, !tbaa !11
  %48 = fsub float %46, %47
  %49 = fpext float %48 to double
  %50 = load float, ptr %8, align 4, !tbaa !11
  %51 = load float, ptr %6, align 4, !tbaa !11
  %52 = fsub float %50, %51
  %53 = fpext float %52 to double
  %54 = load float, ptr %8, align 4, !tbaa !11
  %55 = load float, ptr %6, align 4, !tbaa !11
  %56 = fsub float %54, %55
  %57 = fpext float %56 to double
  %58 = load float, ptr %8, align 4, !tbaa !11
  %59 = load float, ptr %6, align 4, !tbaa !11
  %60 = fsub float %58, %59
  %61 = fpext float %60 to double
  %62 = call double @llvm.fmuladd.f64(double %49, double %53, double 0.000000e+00)
  %63 = call double @sqrt(double noundef %62) #5
  %64 = load float, ptr %7, align 4, !tbaa !11
  %65 = fpext float %64 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 44, ptr noundef @.str.1, double noundef %63, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %65)
  br label %67

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

67:                                               ; preds = %66, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void
}

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

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

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

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

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

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

declare void @liquid_autotest_passed(...) #2

; 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 = { "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 = { 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 = !{!"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 = !{!12, !12, 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 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @sumsqcf_runtest(ptr noundef %0, i32 noundef %1, float noundef %2) local_unnamed_addr #0 {
  %4 = tail call float @liquid_sumsqcf(ptr noundef %0, i32 noundef %1) #4
  %5 = fsub float %4, %2
  %6 = fpext float %5 to double
  %7 = tail call double @llvm.fmuladd.f64(double %6, double %6, double 0.000000e+00)
  %sqrt = tail call double @llvm.sqrt.f64(double %7)
  %8 = fcmp ogt double %sqrt, 0x3EB0C6F7A0000000
  %9 = fcmp uno float %4, 0.000000e+00
  %or.cond = select i1 %8, i1 true, i1 %9
  %10 = fcmp uno float %2, 0.000000e+00
  %or.cond23 = or i1 %10, %or.cond
  br i1 %or.cond23, label %11, label %12

11:                                               ; preds = %3
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 44, ptr noundef nonnull @.str.1, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3EB0C6F7A0000000) #4
  br label %13

12:                                               ; preds = %3
  tail call void (...) @liquid_autotest_passed() #4
  br label %13

13:                                               ; preds = %12, %11
  ret void
}

declare float @liquid_sumsqcf(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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

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 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass