; 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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z19doc_test_int_matrixRKN6alglib16integer_2d_arrayES2_(ptr noundef nonnull align 8 dereferenceable(97) %0, ptr noundef nonnull align 8 dereferenceable(97) %1) #2 {
  %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 %56

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 %56

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

23:                                               ; preds = %52, %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 %55

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

29:                                               ; preds = %48, %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 %51

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 8 dereferenceable(8) ptr @_ZNK6alglib16integer_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %35, i64 noundef %36, i64 noundef %37)
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i64, ptr %6, align 8, !tbaa !9
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib16integer_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %40, i64 noundef %41, i64 noundef %42)
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = icmp ne i64 %39, %44
  br i1 %45, label %46, label %47

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

47:                                               ; preds = %34
  br label %48

48:                                               ; preds = %47
  %49 = load i64, ptr %7, align 8, !tbaa !9
  %50 = add nsw i64 %49, 1
  store i64 %50, ptr %7, align 8, !tbaa !9
  br label %29, !llvm.loop !11

51:                                               ; preds = %29
  br label %52

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

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

56:                                               ; preds = %55, %46, %21, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %57 = load i1, ptr %3, align 1
  ret i1 %57
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z19doc_test_int_matrixRKN6alglib16integer_2d_arrayES2_(ptr noundef nonnull align 8 dereferenceable(97) %0, ptr noundef nonnull align 8 dereferenceable(97) %1) local_unnamed_addr #1 {
  %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 8 dereferenceable(8) ptr @_ZNK6alglib16integer_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %0, i64 noundef %.01623, i64 noundef %.022)
  %17 = load i64, ptr %16, align 8, !tbaa !7
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib16integer_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.01623, i64 noundef %.022)
  %19 = load i64, ptr %18, align 8, !tbaa !7
  %.not19 = icmp eq i64 %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 !11

.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 nonnull align 8 dereferenceable(8) ptr @_ZNK6alglib16integer_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97), i64 noundef, i64 noundef) local_unnamed_addr #0

attributes #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 = { 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 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}


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