; LLVM IR from jgaeddert/liquid-dsp :: src/dotprod/tests (dotprod_rrrf_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 [96 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
@__const.autotest_dotprod_rrrf_struct_align.h = external hidden unnamed_addr constant [16 x float], align 16
@__const.autotest_dotprod_rrrf_struct_align.x = external hidden unnamed_addr constant [16 x float], align 16
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1

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

; 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) #1

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

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

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

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

declare void @liquid_autotest_passed(...) #4

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

declare ptr @dotprod_rrrf_create(ptr noundef, i32 noundef) #4

declare i32 @dotprod_rrrf_execute(ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @dotprod_rrrf_destroy(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @autotest_dotprod_rrrf_struct_align() #5 {
  %1 = alloca [16 x float], align 16
  %2 = alloca [16 x float], align 16
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca ptr, align 8
  %7 = alloca [20 x float], align 16
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 64, ptr %1) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const.autotest_dotprod_rrrf_struct_align.h, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 64, ptr %2) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.autotest_dotprod_rrrf_struct_align.x, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store float 0x400D501BA0000000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store float 0x3F50624DE0000000, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %10 = getelementptr inbounds [16 x float], ptr %1, i64 0, i64 0
  %11 = call ptr @dotprod_rrrf_create(ptr noundef %10, i32 noundef 16)
  store ptr %11, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 80, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %80, %0
  %13 = load i32, ptr %9, align 4, !tbaa !11
  %14 = icmp ult i32 %13, 4
  br i1 %14, label %15, label %83

15:                                               ; preds = %12
  %16 = load i32, ptr %9, align 4, !tbaa !11
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds [20 x float], ptr %7, i64 0, i64 %17
  store ptr %18, ptr %8, align 8, !tbaa !9
  %19 = load ptr, ptr %8, align 8, !tbaa !9
  %20 = getelementptr inbounds [16 x float], ptr %2, i64 0, i64 0
  call void @llvm.memmove.p0.p0.i64(ptr align 4 %19, ptr align 16 %20, i64 64, i1 false)
  %21 = load ptr, ptr %6, align 8, !tbaa !9
  %22 = load ptr, ptr %8, align 8, !tbaa !9
  %23 = call i32 @dotprod_rrrf_execute(ptr noundef %21, ptr noundef %22, ptr noundef %5)
  %24 = load float, ptr %5, align 4, !tbaa !5
  %25 = load float, ptr %3, align 4, !tbaa !5
  %26 = fsub float %24, %25
  %27 = fpext float %26 to double
  %28 = load float, ptr %5, align 4, !tbaa !5
  %29 = load float, ptr %3, align 4, !tbaa !5
  %30 = fsub float %28, %29
  %31 = fpext float %30 to double
  %32 = load float, ptr %5, align 4, !tbaa !5
  %33 = load float, ptr %3, align 4, !tbaa !5
  %34 = fsub float %32, %33
  %35 = fpext float %34 to double
  %36 = load float, ptr %5, align 4, !tbaa !5
  %37 = load float, ptr %3, align 4, !tbaa !5
  %38 = fsub float %36, %37
  %39 = fpext float %38 to double
  %40 = call double @llvm.fmuladd.f64(double %27, double %31, double 0.000000e+00)
  %41 = call double @sqrt(double noundef %40) #6
  %42 = load float, ptr %4, align 4, !tbaa !5
  %43 = fpext float %42 to double
  %44 = fcmp ogt double %41, %43
  br i1 %44, label %57, label %45

45:                                               ; preds = %15
  %46 = load float, ptr %5, align 4, !tbaa !5
  %47 = call i1 @llvm.is.fpclass.f32(float %46, i32 3)
  br i1 %47, label %57, label %48

48:                                               ; preds = %45
  %49 = load float, ptr %5, align 4, !tbaa !5
  %50 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %50, label %57, label %51

51:                                               ; preds = %48
  %52 = load float, ptr %3, align 4, !tbaa !5
  %53 = call i1 @llvm.is.fpclass.f32(float %52, i32 3)
  br i1 %53, label %57, label %54

54:                                               ; preds = %51
  %55 = load float, ptr %3, align 4, !tbaa !5
  %56 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %56, label %57, label %78

57:                                               ; preds = %54, %51, %48, %45, %15
  %58 = load float, ptr %5, align 4, !tbaa !5
  %59 = load float, ptr %3, align 4, !tbaa !5
  %60 = fsub float %58, %59
  %61 = fpext float %60 to double
  %62 = load float, ptr %5, align 4, !tbaa !5
  %63 = load float, ptr %3, align 4, !tbaa !5
  %64 = fsub float %62, %63
  %65 = fpext float %64 to double
  %66 = load float, ptr %5, align 4, !tbaa !5
  %67 = load float, ptr %3, align 4, !tbaa !5
  %68 = fsub float %66, %67
  %69 = fpext float %68 to double
  %70 = load float, ptr %5, align 4, !tbaa !5
  %71 = load float, ptr %3, align 4, !tbaa !5
  %72 = fsub float %70, %71
  %73 = fpext float %72 to double
  %74 = call double @llvm.fmuladd.f64(double %61, double %65, double 0.000000e+00)
  %75 = call double @sqrt(double noundef %74) #6
  %76 = load float, ptr %4, align 4, !tbaa !5
  %77 = fpext float %76 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 194, ptr noundef @.str.11, double noundef %75, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %77)
  br label %79

78:                                               ; preds = %54
  call void (...) @liquid_autotest_passed()
  br label %79

79:                                               ; preds = %78, %57
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %9, align 4, !tbaa !11
  %82 = add i32 %81, 1
  store i32 %82, ptr %9, align 4, !tbaa !11
  br label %12, !llvm.loop !13

83:                                               ; preds = %12
  %84 = load ptr, ptr %6, align 8, !tbaa !9
  %85 = call i32 @dotprod_rrrf_destroy(ptr noundef %84)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, 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 64, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr %1) #6
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 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 #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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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"

@.str = external hidden unnamed_addr constant [96 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
@__const.autotest_dotprod_rrrf_struct_align.h = external hidden unnamed_addr constant [16 x float], align 16
@__const.autotest_dotprod_rrrf_struct_align.x = external hidden unnamed_addr constant [16 x float], align 16
@.str.11 = external hidden unnamed_addr constant [16 x i8], align 1

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

; Function Attrs: mustprogress 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) #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 #3

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

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

declare ptr @dotprod_rrrf_create(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @dotprod_rrrf_execute(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @dotprod_rrrf_destroy(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @autotest_dotprod_rrrf_struct_align() local_unnamed_addr #4 {
  %1 = alloca [16 x float], align 16
  %2 = alloca float, align 4
  %3 = alloca [20 x float], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %1) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %1, ptr noundef nonnull align 16 dereferenceable(64) @__const.autotest_dotprod_rrrf_struct_align.h, i64 64, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %4 = call ptr @dotprod_rrrf_create(ptr noundef nonnull %1, i32 noundef 16) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %3, ptr noundef nonnull align 16 dereferenceable(64) @__const.autotest_dotprod_rrrf_struct_align.x, i64 64, i1 false)
  %5 = call i32 @dotprod_rrrf_execute(ptr noundef %4, ptr noundef nonnull %3, ptr noundef nonnull %2) #6
  %6 = load float, ptr %2, align 4
  %7 = fadd float %6, 0xC00D501BA0000000
  %8 = fpext float %7 to double
  %9 = call double @llvm.fmuladd.f64(double %8, double %8, double 0.000000e+00)
  %sqrt = call double @llvm.sqrt.f64(double %9)
  %10 = fcmp ogt double %sqrt, 0x3F50624DE0000000
  %11 = fcmp uno float %6, 0.000000e+00
  %or.cond = select i1 %10, i1 true, i1 %11
  br i1 %or.cond, label %12, label %13

12:                                               ; preds = %0
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 194, ptr noundef nonnull @.str.11, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3F50624DE0000000) #6
  br label %14

13:                                               ; preds = %0
  call void (...) @liquid_autotest_passed() #6
  br label %14

14:                                               ; preds = %12, %13
  %15 = getelementptr inbounds i8, ptr %3, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %15, ptr noundef nonnull align 16 dereferenceable(64) @__const.autotest_dotprod_rrrf_struct_align.x, i64 64, i1 false)
  %16 = call i32 @dotprod_rrrf_execute(ptr noundef %4, ptr noundef nonnull %15, ptr noundef nonnull %2) #6
  %17 = load float, ptr %2, align 4
  %18 = fadd float %17, 0xC00D501BA0000000
  %19 = fpext float %18 to double
  %20 = call double @llvm.fmuladd.f64(double %19, double %19, double 0.000000e+00)
  %sqrt.1 = call double @llvm.sqrt.f64(double %20)
  %21 = fcmp ogt double %sqrt.1, 0x3F50624DE0000000
  %22 = fcmp uno float %17, 0.000000e+00
  %or.cond.1 = select i1 %21, i1 true, i1 %22
  br i1 %or.cond.1, label %24, label %23

23:                                               ; preds = %14
  call void (...) @liquid_autotest_passed() #6
  br label %25

24:                                               ; preds = %14
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 194, ptr noundef nonnull @.str.11, double noundef %sqrt.1, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3F50624DE0000000) #6
  br label %25

25:                                               ; preds = %24, %23
  %26 = getelementptr inbounds i8, ptr %3, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %26, ptr noundef nonnull align 16 dereferenceable(64) @__const.autotest_dotprod_rrrf_struct_align.x, i64 64, i1 false)
  %27 = call i32 @dotprod_rrrf_execute(ptr noundef %4, ptr noundef nonnull %26, ptr noundef nonnull %2) #6
  %28 = load float, ptr %2, align 4
  %29 = fadd float %28, 0xC00D501BA0000000
  %30 = fpext float %29 to double
  %31 = call double @llvm.fmuladd.f64(double %30, double %30, double 0.000000e+00)
  %sqrt.2 = call double @llvm.sqrt.f64(double %31)
  %32 = fcmp ogt double %sqrt.2, 0x3F50624DE0000000
  %33 = fcmp uno float %28, 0.000000e+00
  %or.cond.2 = select i1 %32, i1 true, i1 %33
  br i1 %or.cond.2, label %35, label %34

34:                                               ; preds = %25
  call void (...) @liquid_autotest_passed() #6
  br label %36

35:                                               ; preds = %25
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 194, ptr noundef nonnull @.str.11, double noundef %sqrt.2, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3F50624DE0000000) #6
  br label %36

36:                                               ; preds = %35, %34
  %37 = getelementptr inbounds i8, ptr %3, i64 12
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %37, ptr noundef nonnull align 16 dereferenceable(64) @__const.autotest_dotprod_rrrf_struct_align.x, i64 64, i1 false)
  %38 = call i32 @dotprod_rrrf_execute(ptr noundef %4, ptr noundef nonnull %37, ptr noundef nonnull %2) #6
  %39 = load float, ptr %2, align 4
  %40 = fadd float %39, 0xC00D501BA0000000
  %41 = fpext float %40 to double
  %42 = call double @llvm.fmuladd.f64(double %41, double %41, double 0.000000e+00)
  %sqrt.3 = call double @llvm.sqrt.f64(double %42)
  %43 = fcmp ogt double %sqrt.3, 0x3F50624DE0000000
  %44 = fcmp uno float %39, 0.000000e+00
  %or.cond.3 = select i1 %43, i1 true, i1 %44
  br i1 %or.cond.3, label %46, label %45

45:                                               ; preds = %36
  call void (...) @liquid_autotest_passed() #6
  br label %47

46:                                               ; preds = %36
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 194, ptr noundef nonnull @.str.11, double noundef %sqrt.3, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3F50624DE0000000) #6
  br label %47

47:                                               ; preds = %46, %45
  %48 = call i32 @dotprod_rrrf_destroy(ptr noundef %4) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %1) #6
  ret void
}

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

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


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass