; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/src (ap)

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

%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon = type { ptr }

@.str.13 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @abort() #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11alglib_impl8ae_alignEPvm(ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl29ae_matrix_update_row_pointersEPNS_9ae_matrixEPv(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl13ae_db_reallocEPNS_12ae_dyn_blockElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl20ae_matrix_set_lengthEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %12, label %11

11:                                               ; preds = %4
  call void @abort() #3
  unreachable

12:                                               ; preds = %4
  %13 = load i64, ptr %6, align 8, !tbaa !9
  %14 = icmp sge i64 %13, 0
  br i1 %14, label %15, label %18

15:                                               ; preds = %12
  %16 = load i64, ptr %7, align 8, !tbaa !9
  %17 = icmp sge i64 %16, 0
  br label %18

18:                                               ; preds = %15, %12
  %19 = phi i1 [ false, %12 ], [ %17, %15 ]
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %19, ptr noundef @.str.13, ptr noundef %20)
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %21, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !11
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = icmp eq i64 %23, %24
  br i1 %25, label %26, label %33

26:                                               ; preds = %18
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !15
  %30 = load i64, ptr %7, align 8, !tbaa !9
  %31 = icmp eq i64 %29, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %26
  br label %93

33:                                               ; preds = %26, %18
  %34 = load i64, ptr %7, align 8, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %35, i32 0, i32 2
  store i64 %34, ptr %36, align 8, !tbaa !16
  br label %37

37:                                               ; preds = %48, %33
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %38, i32 0, i32 2
  %40 = load i64, ptr %39, align 8, !tbaa !16
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %41, i32 0, i32 3
  %43 = load i64, ptr %42, align 8, !tbaa !17
  %44 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %43)
  %45 = mul nsw i64 %40, %44
  %46 = srem i64 %45, 64
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %48, label %53

48:                                               ; preds = %37
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %49, i32 0, i32 2
  %51 = load i64, ptr %50, align 8, !tbaa !16
  %52 = add nsw i64 %51, 1
  store i64 %52, ptr %50, align 8, !tbaa !16
  br label %37, !llvm.loop !18

53:                                               ; preds = %37
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %54, i32 0, i32 0
  store i64 0, ptr %55, align 8, !tbaa !11
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %56, i32 0, i32 1
  store i64 0, ptr %57, align 8, !tbaa !15
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %58, i32 0, i32 6
  store ptr null, ptr %59, align 8, !tbaa !20
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %60, i32 0, i32 5
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %63, i32 0, i32 2
  %65 = load i64, ptr %64, align 8, !tbaa !16
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %66, i32 0, i32 3
  %68 = load i64, ptr %67, align 8, !tbaa !17
  %69 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %68)
  %70 = mul nsw i64 %65, %69
  %71 = add nsw i64 8, %70
  %72 = mul nsw i64 %62, %71
  %73 = add nsw i64 %72, 64
  %74 = sub nsw i64 %73, 1
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl13ae_db_reallocEPNS_12ae_dyn_blockElPNS_8ae_stateE(ptr noundef %61, i64 noundef %74, ptr noundef %75)
  %76 = load i64, ptr %6, align 8, !tbaa !9
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %77, i32 0, i32 0
  store i64 %76, ptr %78, align 8, !tbaa !11
  %79 = load i64, ptr %7, align 8, !tbaa !9
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %80, i32 0, i32 1
  store i64 %79, ptr %81, align 8, !tbaa !15
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %83, i32 0, i32 5
  %85 = getelementptr inbounds %"struct.alglib_impl::ae_dyn_block", ptr %84, i32 0, i32 2
  %86 = load volatile ptr, ptr %85, align 8, !tbaa !21
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %87, i32 0, i32 0
  %89 = load i64, ptr %88, align 8, !tbaa !11
  %90 = mul i64 %89, 8
  %91 = getelementptr inbounds i8, ptr %86, i64 %90
  %92 = call noundef ptr @_ZN11alglib_impl8ae_alignEPvm(ptr noundef %91, i64 noundef 64)
  call void @_ZN11alglib_impl29ae_matrix_update_row_pointersEPNS_9ae_matrixEPv(ptr noundef %82, ptr noundef %92)
  br label %93

93:                                               ; preds = %53, %32
  ret void
}

attributes #0 = { noreturn 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 #1 = { mustprogress 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 #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 = { noreturn 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, !10, i64 0}
!12 = !{!"_ZTSN11alglib_impl9ae_matrixE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !13, i64 32, !14, i64 40, !7, i64 72}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !10, i64 16}
!17 = !{!12, !10, i64 24}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!7, !7, i64 0}
!21 = !{!12, !6, i64 56}


; 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.13 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN11alglib_impl8ae_alignEPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl29ae_matrix_update_row_pointersEPNS_9ae_matrixEPv(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl13ae_db_reallocEPNS_12ae_dyn_blockElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl20ae_matrix_set_lengthEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %4
  tail call void @abort() #4
  unreachable

6:                                                ; preds = %4
  %7 = or i64 %2, %1
  %8 = icmp sgt i64 %7, -1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.13, ptr noundef nonnull %3)
  %9 = load i64, ptr %0, align 8, !tbaa !5
  %10 = icmp eq i64 %9, %1
  br i1 %10, label %11, label %15

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !13
  %14 = icmp eq i64 %13, %2
  br i1 %14, label %43, label %15

15:                                               ; preds = %11, %6
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %2, ptr %16, align 8, !tbaa !14
  %18 = load i64, ptr %17, align 8, !tbaa !15
  %19 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %18)
  %20 = mul nsw i64 %19, %2
  %21 = and i64 %20, 63
  %.not2728 = icmp eq i64 %21, 0
  br i1 %.not2728, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %15, %.lr.ph
  %22 = load i64, ptr %16, align 8, !tbaa !14
  %23 = add nsw i64 %22, 1
  store i64 %23, ptr %16, align 8, !tbaa !14
  %24 = load i64, ptr %17, align 8, !tbaa !15
  %25 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %24)
  %26 = mul nsw i64 %25, %23
  %27 = and i64 %26, 63
  %.not27 = icmp eq i64 %27, 0
  br i1 %.not27, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %15
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = getelementptr inbounds i8, ptr %0, i64 72
  store ptr null, ptr %29, align 8, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %0, i8 0, i64 16, i1 false)
  %31 = load i64, ptr %16, align 8, !tbaa !14
  %32 = load i64, ptr %17, align 8, !tbaa !15
  %33 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %32)
  %34 = mul nsw i64 %33, %31
  %35 = add nsw i64 %34, 8
  %36 = mul nsw i64 %35, %1
  %37 = add nsw i64 %36, 63
  tail call void @_ZN11alglib_impl13ae_db_reallocEPNS_12ae_dyn_blockElPNS_8ae_stateE(ptr noundef nonnull %30, i64 noundef %37, ptr noundef nonnull %3)
  store i64 %1, ptr %0, align 8, !tbaa !5
  store i64 %2, ptr %28, align 8, !tbaa !13
  %38 = getelementptr inbounds i8, ptr %0, i64 56
  %39 = load volatile ptr, ptr %38, align 8, !tbaa !19
  %40 = shl i64 %1, 3
  %41 = getelementptr inbounds i8, ptr %39, i64 %40
  %42 = tail call noundef ptr @_ZN11alglib_impl8ae_alignEPvm(ptr noundef %41, i64 noundef 64)
  tail call void @_ZN11alglib_impl29ae_matrix_update_row_pointersEPNS_9ae_matrixEPv(ptr noundef nonnull %0, ptr noundef %42)
  br label %43

43:                                               ; preds = %11, %._crit_edge
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { noreturn 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 #1 = { mustprogress 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { noreturn 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, !7, i64 0}
!6 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !8, i64 72}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !7, i64 24}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!8, !8, i64 0}
!19 = !{!6, !12, i64 56}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass