; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/tests (test_i)

; 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"

; 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 nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

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

declare noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97)) #2

declare noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z20doc_test_real_matrixRKN6alglib13real_2d_arrayES2_d(ptr noundef nonnull align 8 dereferenceable(97) %0, ptr noundef nonnull align 8 dereferenceable(97) %1, double noundef %2) #3 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %13)
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %15)
  %17 = icmp ne i64 %14, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %82

19:                                               ; preds = %3
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %20)
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %22)
  %24 = icmp ne i64 %21, %23
  br i1 %24, label %25, label %26

25:                                               ; preds = %19
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %82

26:                                               ; preds = %19
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %27

27:                                               ; preds = %78, %26
  %28 = load i64, ptr %8, align 8, !tbaa !11
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %29)
  %31 = icmp slt i64 %28, %30
  br i1 %31, label %32, label %81

32:                                               ; preds = %27
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %74, %32
  %34 = load i64, ptr %9, align 8, !tbaa !11
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %35)
  %37 = icmp slt i64 %34, %36
  br i1 %37, label %38, label %77

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %39 = load double, ptr %7, align 8, !tbaa !9
  %40 = fcmp oge double %39, 0.000000e+00
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  br label %49

42:                                               ; preds = %38
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load i64, ptr %8, align 8, !tbaa !11
  %45 = load i64, ptr %9, align 8, !tbaa !11
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %43, i64 noundef %44, i64 noundef %45)
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = call double @llvm.fabs.f64(double %47)
  br label %49

49:                                               ; preds = %42, %41
  %50 = phi double [ 1.000000e+00, %41 ], [ %48, %42 ]
  store double %50, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %51 = load double, ptr %7, align 8, !tbaa !9
  %52 = call double @llvm.fabs.f64(double %51)
  store double %52, ptr %12, align 8, !tbaa !9
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load i64, ptr %8, align 8, !tbaa !11
  %55 = load i64, ptr %9, align 8, !tbaa !11
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %53, i64 noundef %54, i64 noundef %55)
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = load i64, ptr %8, align 8, !tbaa !11
  %60 = load i64, ptr %9, align 8, !tbaa !11
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %58, i64 noundef %59, i64 noundef %60)
  %62 = load double, ptr %61, align 8, !tbaa !9
  %63 = fsub double %57, %62
  %64 = call double @llvm.fabs.f64(double %63)
  %65 = load double, ptr %11, align 8, !tbaa !9
  %66 = fdiv double %64, %65
  %67 = load double, ptr %12, align 8, !tbaa !9
  %68 = fcmp ogt double %66, %67
  br i1 %68, label %69, label %70

69:                                               ; preds = %49
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %71

70:                                               ; preds = %49
  store i32 0, ptr %10, align 4
  br label %71

71:                                               ; preds = %70, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  %72 = load i32, ptr %10, align 4
  switch i32 %72, label %82 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %9, align 8, !tbaa !11
  %76 = add nsw i64 %75, 1
  store i64 %76, ptr %9, align 8, !tbaa !11
  br label %33, !llvm.loop !13

77:                                               ; preds = %33
  br label %78

78:                                               ; preds = %77
  %79 = load i64, ptr %8, align 8, !tbaa !11
  %80 = add nsw i64 %79, 1
  store i64 %80, ptr %8, align 8, !tbaa !11
  br label %27, !llvm.loop !15

81:                                               ; preds = %27
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %82

82:                                               ; preds = %81, %71, %25, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %83 = load i1, ptr %4, align 1
  ret i1 %83
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97), i64 noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { mustprogress 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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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"

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

declare noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97)) local_unnamed_addr #1

declare noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z20doc_test_real_matrixRKN6alglib13real_2d_arrayES2_d(ptr noundef nonnull align 8 dereferenceable(97) %0, ptr noundef nonnull align 8 dereferenceable(97) %1, double noundef %2) local_unnamed_addr #2 {
  %4 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %5 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %1)
  %.not = icmp eq i64 %4, %5
  br i1 %.not, label %6, label %.loopexit

6:                                                ; preds = %3
  %7 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %8 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %1)
  %.not27 = icmp eq i64 %7, %8
  br i1 %.not27, label %.preheader28, label %.loopexit

.preheader28:                                     ; preds = %6
  %9 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.preheader.lr.ph, label %.loopexit

.preheader.lr.ph:                                 ; preds = %.preheader28
  %11 = fcmp ult double %2, 0.000000e+00
  %12 = tail call double @llvm.fabs.f64(double %2)
  br i1 %11, label %.preheader.us, label %.preheader

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge.split.us.us
  %.02431.us = phi i64 [ %15, %._crit_edge.split.us.us ], [ 0, %.preheader.lr.ph ]
  %13 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph.us, label %._crit_edge.split.us.us

._crit_edge.split.us.us:                          ; preds = %28, %.preheader.us
  %15 = add nuw nsw i64 %.02431.us, 1
  %16 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %.preheader.us, label %.loopexit, !llvm.loop !5

.lr.ph.us:                                        ; preds = %.preheader.us, %28
  %.02630.us.us = phi i64 [ %29, %28 ], [ 0, %.preheader.us ]
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.02431.us, i64 noundef %.02630.us.us)
  %19 = load double, ptr %18, align 8, !tbaa !7
  %20 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %0, i64 noundef %.02431.us, i64 noundef %.02630.us.us)
  %21 = load double, ptr %20, align 8, !tbaa !7
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.02431.us, i64 noundef %.02630.us.us)
  %23 = load double, ptr %22, align 8, !tbaa !7
  %24 = fsub double %21, %23
  %25 = fdiv double %24, %19
  %26 = tail call double @llvm.fabs.f64(double %25)
  %27 = fcmp ule double %26, %12
  br i1 %27, label %28, label %.loopexit

28:                                               ; preds = %.lr.ph.us
  %29 = add nuw nsw i64 %.02630.us.us, 1
  %30 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %.lr.ph.us, label %._crit_edge.split.us.us, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge.split
  %.02431 = phi i64 [ %45, %._crit_edge.split ], [ 0, %.preheader.lr.ph ]
  %32 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %33 = icmp sgt i64 %32, 0
  br i1 %33, label %.lr.ph, label %._crit_edge.split

34:                                               ; preds = %.lr.ph
  %35 = add nuw nsw i64 %.02630, 1
  %36 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge.split, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader, %34
  %.02630 = phi i64 [ %35, %34 ], [ 0, %.preheader ]
  %38 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %0, i64 noundef %.02431, i64 noundef %.02630)
  %39 = load double, ptr %38, align 8, !tbaa !7
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.02431, i64 noundef %.02630)
  %41 = load double, ptr %40, align 8, !tbaa !7
  %42 = fsub double %39, %41
  %43 = tail call double @llvm.fabs.f64(double %42)
  %44 = fcmp ule double %43, %12
  br i1 %44, label %34, label %.loopexit

._crit_edge.split:                                ; preds = %34, %.preheader
  %45 = add nuw nsw i64 %.02431, 1
  %46 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %47 = icmp slt i64 %45, %46
  br i1 %47, label %.preheader, label %.loopexit, !llvm.loop !5

.loopexit:                                        ; preds = %._crit_edge.split, %.lr.ph, %._crit_edge.split.us.us, %.lr.ph.us, %.preheader28, %6, %3
  %.3 = phi i1 [ false, %3 ], [ false, %6 ], [ true, %.preheader28 ], [ false, %.lr.ph.us ], [ true, %._crit_edge.split.us.us ], [ false, %.lr.ph ], [ true, %._crit_edge.split ]
  ret i1 %.3
}

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib13real_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97), i64 noundef, i64 noundef) local_unnamed_addr #1

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

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass