; 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
@liquid_autotest_verbose = external global i32, align 4
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@matrixf_data_chol_A = external global [0 x float], align 4
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@matrixf_data_chol_L = external global [0 x float], align 4
@.str.15 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [37 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

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

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

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

8:                                                ; preds = %0
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %11 = call i32 @matrixf_print(ptr noundef @matrixf_data_chol_A, i32 noundef 4, i32 noundef 4)
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %13 = call i32 @matrixf_print(ptr noundef @matrixf_data_chol_L, i32 noundef 4, i32 noundef 4)
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  %15 = getelementptr inbounds [16 x float], ptr %2, i64 0, i64 0
  %16 = call i32 @matrixf_print(ptr noundef %15, i32 noundef 4, i32 noundef 4)
  br label %17

17:                                               ; 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 %18

18:                                               ; preds = %138, %17
  %19 = load i32, ptr %3, align 4, !tbaa !9
  %20 = icmp ult i32 %19, 16
  br i1 %20, label %21, label %141

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

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

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

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

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

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

136:                                              ; preds = %85
  call void (...) @liquid_autotest_passed()
  br label %137

137:                                              ; preds = %136, %91
  br label %138

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

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

declare i32 @matrixf_chol(ptr noundef, i32 noundef, ptr 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
@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@matrixf_data_chol_A = external global [0 x float], align 4
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@matrixf_data_chol_L = external global [0 x float], align 4
@.str.15 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [37 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_matrixf_chol() local_unnamed_addr #4 {
  %1 = alloca [16 x float], align 16
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %1) #6
  %2 = call i32 @matrixf_chol(ptr noundef nonnull @matrixf_data_chol_A, i32 noundef 4, ptr noundef nonnull %1) #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.14)
  %6 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %7 = call i32 @matrixf_print(ptr noundef nonnull @matrixf_data_chol_A, i32 noundef 4, i32 noundef 4) #6
  %8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %9 = call i32 @matrixf_print(ptr noundef nonnull @matrixf_data_chol_L, i32 noundef 4, i32 noundef 4) #6
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  %11 = call i32 @matrixf_print(ptr noundef nonnull %1, i32 noundef 4, i32 noundef 4) #6
  br label %.preheader

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

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

23:                                               ; preds = %12
  call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 124, ptr noundef nonnull @.str.16, double noundef %sqrt, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, double noundef 0x3F1A36E2E0000000) #6
  br label %25

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

25:                                               ; preds = %23, %24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 16
  br i1 %exitcond.not, label %26, label %12, !llvm.loop !11

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

declare i32 @matrixf_chol(ptr noundef, i32 noundef, ptr 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 = { 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 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)"}
!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