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

%"class.alglib::complex" = type { double, double }

; 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 double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16)) #2

declare void @_ZN6alglibmiERKNS_7complexES2_(ptr dead_on_unwind writable sret(%"class.alglib::complex") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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 @_Z23doc_test_complex_matrixRKN6alglib16complex_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
  %13 = alloca %"class.alglib::complex", 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
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %14)
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %16)
  %18 = icmp ne i64 %15, %17
  br i1 %18, label %19, label %20

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

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

26:                                               ; preds = %20
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %79

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

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

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

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

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

42:                                               ; preds = %39
  br label %49

43:                                               ; preds = %39
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load i64, ptr %8, align 8, !tbaa !11
  %46 = load i64, ptr %9, align 8, !tbaa !11
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %44, i64 noundef %45, i64 noundef %46)
  %48 = call noundef double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16) %47)
  br label %49

49:                                               ; preds = %43, %42
  %50 = phi double [ 1.000000e+00, %42 ], [ %48, %43 ]
  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
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #4
  %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(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %53, i64 noundef %54, i64 noundef %55)
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load i64, ptr %8, align 8, !tbaa !11
  %59 = load i64, ptr %9, align 8, !tbaa !11
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %57, i64 noundef %58, i64 noundef %59)
  call void @_ZN6alglibmiERKNS_7complexES2_(ptr dead_on_unwind writable sret(%"class.alglib::complex") align 8 %13, ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 8 dereferenceable(16) %60)
  %61 = call noundef double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16) %13)
  %62 = load double, ptr %11, align 8, !tbaa !9
  %63 = fdiv double %61, %62
  %64 = load double, ptr %12, align 8, !tbaa !9
  %65 = fcmp ogt double %63, %64
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #4
  br i1 %65, label %66, label %67

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

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

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

70:                                               ; preds = %68
  br label %71

71:                                               ; preds = %70
  %72 = load i64, ptr %9, align 8, !tbaa !11
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %9, align 8, !tbaa !11
  br label %34, !llvm.loop !13

74:                                               ; preds = %34
  br label %75

75:                                               ; preds = %74
  %76 = load i64, ptr %8, align 8, !tbaa !11
  %77 = add nsw i64 %76, 1
  store i64 %77, ptr %8, align 8, !tbaa !11
  br label %28, !llvm.loop !15

78:                                               ; preds = %28
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %79

79:                                               ; preds = %78, %68, %26, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %80 = load i1, ptr %4, align 1
  ret i1 %80
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_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"

%"class.alglib::complex" = type { double, double }

; 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.fabs.f64(double) #1

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

declare noundef double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

declare void @_ZN6alglibmiERKNS_7complexES2_(ptr dead_on_unwind writable sret(%"class.alglib::complex") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z23doc_test_complex_matrixRKN6alglib16complex_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 #3 {
  %4 = alloca %"class.alglib::complex", align 8
  %5 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %0)
  %6 = tail call noundef i64 @_ZNK6alglib17ae_matrix_wrapper4rowsEv(ptr noundef nonnull align 8 dereferenceable(97) %1)
  %.not = icmp eq i64 %5, %6
  br i1 %.not, label %7, label %.loopexit

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

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

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

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

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

.lr.ph.us:                                        ; preds = %.preheader.us, %26
  %.02630.us.us = phi i64 [ %27, %26 ], [ 0, %.preheader.us ]
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.02431.us, i64 noundef %.02630.us.us)
  %20 = call noundef double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16) %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %0, i64 noundef %.02431.us, i64 noundef %.02630.us.us)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.02431.us, i64 noundef %.02630.us.us)
  call void @_ZN6alglibmiERKNS_7complexES2_(ptr dead_on_unwind nonnull writable sret(%"class.alglib::complex") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(16) %22)
  %23 = call noundef double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %24 = fdiv double %23, %20
  %25 = fcmp ule double %24, %13
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br i1 %25, label %26, label %.loopexit

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

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

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

.lr.ph:                                           ; preds = %.preheader, %32
  %.02630 = phi i64 [ %33, %32 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %0, i64 noundef %.02431, i64 noundef %.02630)
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97) %1, i64 noundef %.02431, i64 noundef %.02630)
  call void @_ZN6alglibmiERKNS_7complexES2_(ptr dead_on_unwind nonnull writable sret(%"class.alglib::complex") align 8 %4, ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(16) %37)
  %38 = call noundef double @_ZN6alglib10abscomplexERKNS_7complexE(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %39 = fcmp ule double %38, %13
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br i1 %39, label %32, label %.loopexit

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

.loopexit:                                        ; preds = %._crit_edge.split, %.lr.ph, %._crit_edge.split.us.us, %.lr.ph.us, %.preheader28, %7, %3
  %.3 = phi i1 [ false, %3 ], [ false, %7 ], [ 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(16) ptr @_ZNK6alglib16complex_2d_arrayclEll(ptr noundef nonnull align 8 dereferenceable(97), i64 noundef, i64 noundef) local_unnamed_addr #2

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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


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