; LLVM IR from jgaeddert/liquid-dsp :: src/matrix/tests (matrixf_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 [90 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
@matrixf_data_aug_x = external global [0 x float], align 4
@matrixf_data_aug_y = external global [0 x float], align 4
@liquid_autotest_verbose = external global i32, align 4
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@matrixf_data_aug_z = external global [0 x float], align 4
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 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: nounwind
declare double @sqrt(double noundef) #1

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

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

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) #0

; Function Attrs: nounwind uwtable
define dso_local void @autotest_matrixf_aug() #4 {
  %1 = alloca float, align 4
  %2 = alloca [35 x float], align 16
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store float 0x3EB0C6F7A0000000, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 140, ptr %2) #5
  %4 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 0
  %5 = call i32 @matrixf_aug(ptr noundef @matrixf_data_aug_x, i32 noundef 5, i32 noundef 4, ptr noundef @matrixf_data_aug_y, i32 noundef 5, i32 noundef 3, ptr noundef %4, i32 noundef 5, i32 noundef 7)
  %6 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !9
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %8, label %19

8:                                                ; preds = %0
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %11 = call i32 @matrixf_print(ptr noundef @matrixf_data_aug_x, i32 noundef 5, i32 noundef 4)
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %13 = call i32 @matrixf_print(ptr noundef @matrixf_data_aug_y, i32 noundef 5, i32 noundef 3)
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %15 = call i32 @matrixf_print(ptr noundef @matrixf_data_aug_z, i32 noundef 5, i32 noundef 7)
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %17 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 0
  %18 = call i32 @matrixf_print(ptr noundef %17, i32 noundef 5, i32 noundef 3)
  br label %19

19:                                               ; preds = %8, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %20

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

23:                                               ; preds = %20
  %24 = load i32, ptr %3, align 4, !tbaa !9
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %25
  %27 = load float, ptr %26, align 4, !tbaa !5
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %29
  %31 = load float, ptr %30, align 4, !tbaa !5
  %32 = fsub float %27, %31
  %33 = fpext float %32 to double
  %34 = load i32, ptr %3, align 4, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %35
  %37 = load float, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %3, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %39
  %41 = load float, ptr %40, align 4, !tbaa !5
  %42 = fsub float %37, %41
  %43 = fpext float %42 to double
  %44 = load i32, ptr %3, align 4, !tbaa !9
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %49
  %51 = load float, ptr %50, align 4, !tbaa !5
  %52 = fsub float %47, %51
  %53 = fpext float %52 to double
  %54 = load i32, ptr %3, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %55
  %57 = load float, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %59
  %61 = load float, ptr %60, align 4, !tbaa !5
  %62 = fsub float %57, %61
  %63 = fpext float %62 to double
  %64 = call double @llvm.fmuladd.f64(double %33, double %43, double 0.000000e+00)
  %65 = call double @sqrt(double noundef %64) #5
  %66 = load float, ptr %1, align 4, !tbaa !5
  %67 = fpext float %66 to double
  %68 = fcmp ogt double %65, %67
  br i1 %68, label %93, label %69

69:                                               ; preds = %23
  %70 = load i32, ptr %3, align 4, !tbaa !9
  %71 = zext i32 %70 to i64
  %72 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %71
  %73 = load float, ptr %72, align 4, !tbaa !5
  %74 = call i1 @llvm.is.fpclass.f32(float %73, i32 3)
  br i1 %74, label %93, label %75

75:                                               ; preds = %69
  %76 = load i32, ptr %3, align 4, !tbaa !9
  %77 = zext i32 %76 to i64
  %78 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %77
  %79 = load float, ptr %78, align 4, !tbaa !5
  %80 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %80, label %93, label %81

81:                                               ; preds = %75
  %82 = load i32, ptr %3, align 4, !tbaa !9
  %83 = zext i32 %82 to i64
  %84 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %83
  %85 = load float, ptr %84, align 4, !tbaa !5
  %86 = call i1 @llvm.is.fpclass.f32(float %85, i32 3)
  br i1 %86, label %93, label %87

87:                                               ; preds = %81
  %88 = load i32, ptr %3, align 4, !tbaa !9
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %89
  %91 = load float, ptr %90, align 4, !tbaa !5
  %92 = call i1 @llvm.is.fpclass.f32(float 0.000000e+00, i32 3)
  br i1 %92, label %93, label %138

93:                                               ; preds = %87, %81, %75, %69, %23
  %94 = load i32, ptr %3, align 4, !tbaa !9
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %95
  %97 = load float, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr %3, align 4, !tbaa !9
  %99 = zext i32 %98 to i64
  %100 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %99
  %101 = load float, ptr %100, align 4, !tbaa !5
  %102 = fsub float %97, %101
  %103 = fpext float %102 to double
  %104 = load i32, ptr %3, align 4, !tbaa !9
  %105 = zext i32 %104 to i64
  %106 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %105
  %107 = load float, ptr %106, align 4, !tbaa !5
  %108 = load i32, ptr %3, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %109
  %111 = load float, ptr %110, align 4, !tbaa !5
  %112 = fsub float %107, %111
  %113 = fpext float %112 to double
  %114 = load i32, ptr %3, align 4, !tbaa !9
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %115
  %117 = load float, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %3, align 4, !tbaa !9
  %119 = zext i32 %118 to i64
  %120 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %119
  %121 = load float, ptr %120, align 4, !tbaa !5
  %122 = fsub float %117, %121
  %123 = fpext float %122 to double
  %124 = load i32, ptr %3, align 4, !tbaa !9
  %125 = zext i32 %124 to i64
  %126 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %125
  %127 = load float, ptr %126, align 4, !tbaa !5
  %128 = load i32, ptr %3, align 4, !tbaa !9
  %129 = zext i32 %128 to i64
  %130 = getelementptr inbounds [35 x float], ptr %2, i64 0, i64 %129
  %131 = load float, ptr %130, align 4, !tbaa !5
  %132 = fsub float %127, %131
  %133 = fpext float %132 to double
  %134 = call double @llvm.fmuladd.f64(double %103, double %113, double 0.000000e+00)
  %135 = call double @sqrt(double noundef %134) #5
  %136 = load float, ptr %1, align 4, !tbaa !5
  %137 = fpext float %136 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 74, ptr noundef @.str.9, double noundef %135, ptr noundef @.str.2, ptr noundef @.str.3, double noundef %137)
  br label %139

138:                                              ; preds = %87
  call void (...) @liquid_autotest_passed()
  br label %139

139:                                              ; preds = %138, %93
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %3, align 4, !tbaa !9
  %142 = add i32 %141, 1
  store i32 %142, ptr %3, align 4, !tbaa !9
  br label %20, !llvm.loop !11

143:                                              ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 140, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

declare i32 @matrixf_aug(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #3

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

declare i32 @matrixf_print(ptr noundef, i32 noundef, i32 noundef) #3

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

@.str = external hidden unnamed_addr constant [90 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
@matrixf_data_aug_x = external global [0 x float], align 4
@matrixf_data_aug_y = external global [0 x float], align 4
@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@matrixf_data_aug_z = external global [0 x float], align 4
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 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 nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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) #0

; Function Attrs: nounwind uwtable
define dso_local void @autotest_matrixf_aug() local_unnamed_addr #3 {
  %1 = alloca [35 x float], align 16
  call void @llvm.lifetime.start.p0(i64 140, ptr nonnull %1) #6
  %2 = call i32 @matrixf_aug(ptr noundef nonnull @matrixf_data_aug_x, i32 noundef 5, i32 noundef 4, ptr noundef nonnull @matrixf_data_aug_y, i32 noundef 5, i32 noundef 3, ptr noundef nonnull %1, i32 noundef 5, i32 noundef 7) #6
  %3 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %.preheader, label %4

4:                                                ; preds = %0
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %7 = call i32 @matrixf_print(ptr noundef nonnull @matrixf_data_aug_x, i32 noundef 5, i32 noundef 4) #6
  %8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %9 = call i32 @matrixf_print(ptr noundef nonnull @matrixf_data_aug_y, i32 noundef 5, i32 noundef 3) #6
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %11 = call i32 @matrixf_print(ptr noundef nonnull @matrixf_data_aug_z, i32 noundef 5, i32 noundef 7) #6
  %12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %13 = call i32 @matrixf_print(ptr noundef nonnull %1, i32 noundef 5, i32 noundef 3) #6
  br label %.preheader

.preheader:                                       ; preds = %4, %0
  br label %14

14:                                               ; preds = %.preheader, %27
  %indvars.iv = phi i64 [ %indvars.iv.next, %27 ], [ 0, %.preheader ]
  %15 = getelementptr inbounds [0 x float], ptr @matrixf_data_aug_z, i64 0, i64 %indvars.iv
  %16 = load float, ptr %15, align 4, !tbaa !9
  %17 = getelementptr inbounds [35 x float], ptr %1, i64 0, i64 %indvars.iv
  %18 = load float, ptr %17, align 4, !tbaa !9
  %19 = fsub float %16, %18
  %20 = fpext float %19 to double
  %21 = call double @llvm.fmuladd.f64(double %20, double %20, double 0.000000e+00)
  %sqrt = call double @llvm.sqrt.f64(double %21)
  %22 = fcmp ogt double %sqrt, 0x3EB0C6F7A0000000
  %23 = fcmp uno float %16, 0.000000e+00
  %or.cond = select i1 %22, i1 true, i1 %23
  %24 = fcmp uno float %18, 0.000000e+00
  %or.cond26 = select i1 %or.cond, i1 true, i1 %24
  br i1 %or.cond26, label %25, label %26

25:                                               ; preds = %14
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 74, ptr noundef nonnull @.str.9, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3EB0C6F7A0000000) #6
  br label %27

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

27:                                               ; preds = %25, %26
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 35
  br i1 %exitcond.not, label %28, label %14, !llvm.loop !11

28:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 140, ptr nonnull %1) #6
  ret void
}

declare i32 @matrixf_aug(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @matrixf_print(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; 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 nosync nounwind speculatable willreturn memory(none) }
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 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 #4 = { 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 #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"}


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