; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

14:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %60

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %16)
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %18)
  %20 = icmp ne i64 %17, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %15
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %60

22:                                               ; preds = %15
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %56, %22
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %25)
  %27 = icmp slt i64 %24, %26
  br i1 %27, label %28, label %59

28:                                               ; preds = %23
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %52, %28
  %30 = load i64, ptr %7, align 8, !tbaa !9
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %31)
  %33 = icmp slt i64 %30, %32
  br i1 %33, label %34, label %55

34:                                               ; preds = %29
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = load i64, ptr %7, align 8, !tbaa !9
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6alglib16boolean_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %35, i64 noundef %36, i64 noundef %37)
  %39 = load i8, ptr %38, align 1, !tbaa !11, !range !13, !noundef !14
  %40 = trunc i8 %39 to i1
  %41 = zext i1 %40 to i32
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load i64, ptr %6, align 8, !tbaa !9
  %44 = load i64, ptr %7, align 8, !tbaa !9
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6alglib16boolean_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %42, i64 noundef %43, i64 noundef %44)
  %46 = load i8, ptr %45, align 1, !tbaa !11, !range !13, !noundef !14
  %47 = trunc i8 %46 to i1
  %48 = zext i1 %47 to i32
  %49 = icmp ne i32 %41, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %34
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %60

51:                                               ; preds = %34
  br label %52

52:                                               ; preds = %51
  %53 = load i64, ptr %7, align 8, !tbaa !9
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %7, align 8, !tbaa !9
  br label %29, !llvm.loop !15

55:                                               ; preds = %29
  br label %56

56:                                               ; preds = %55
  %57 = load i64, ptr %6, align 8, !tbaa !9
  %58 = add nsw i64 %57, 1
  store i64 %58, ptr %6, align 8, !tbaa !9
  br label %23, !llvm.loop !17

59:                                               ; preds = %23
  store i1 true, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %60

60:                                               ; preds = %59, %50, %21, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %61 = load i1, ptr %3, align 1
  ret i1 %61
}

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

declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6alglib16boolean_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 = { 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 #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 }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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 uwtable
define dso_local noundef zeroext i1 @_Z20doc_test_bool_matrixRKN6alglib16boolean_2d_arrayES2_(ptr noundef nonnull align 8 dereferenceable(97) %0, ptr noundef nonnull align 8 dereferenceable(97) %1) local_unnamed_addr #0 {
  %3 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %4 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %1)
  %.not = icmp eq i64 %3, %4
  br i1 %.not, label %5, label %.loopexit

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

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

.preheader:                                       ; preds = %.preheader20, %._crit_edge
  %.01623 = phi i64 [ %20, %._crit_edge ], [ 0, %.preheader20 ]
  %10 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

12:                                               ; preds = %.lr.ph
  %13 = add nuw nsw i64 %.022, 1
  %14 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4colsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %15 = icmp slt i64 %13, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %12
  %.022 = phi i64 [ %13, %12 ], [ 0, %.preheader ]
  %16 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6alglib16boolean_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %0, i64 noundef %.01623, i64 noundef %.022)
  %17 = load i8, ptr %16, align 1, !tbaa !7, !range !11, !noundef !12
  %18 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNK6alglib16boolean_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.01623, i64 noundef %.022)
  %19 = load i8, ptr %18, align 1, !tbaa !7, !range !11, !noundef !12
  %.not19 = icmp eq i8 %17, %19
  br i1 %.not19, label %12, label %.loopexit

._crit_edge:                                      ; preds = %12, %.preheader
  %20 = add nuw nsw i64 %.01623, 1
  %21 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %22 = icmp slt i64 %20, %21
  br i1 %22, label %.preheader, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %._crit_edge, %.lr.ph, %.preheader20, %5, %2
  %.017 = phi i1 [ false, %2 ], [ false, %5 ], [ true, %.preheader20 ], [ false, %.lr.ph ], [ true, %._crit_edge ]
  ret i1 %.017
}

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

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

attributes #0 = { 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 #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" }

!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 = !{!"bool", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !6}


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