; 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::x_matrix" = type { i64, i64, i64, i64, i64, i64, %union.anon.2 }
%union.anon.2 = type { ptr }
%"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 }

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl14ae_matrix_initEPNS_9ae_matrixElllPNS_8ae_stateEb(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef, i1 noundef zeroext) #4

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

16:                                               ; preds = %4
  call void @abort() #6
  unreachable

17:                                               ; preds = %4
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %19, i32 0, i32 0
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %22, i32 0, i32 1
  %24 = load i64, ptr %23, align 8, !tbaa !14
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %25, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !15
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load i8, ptr %8, align 1, !tbaa !9, !range !16, !noundef !17
  %30 = trunc i8 %29 to i1
  call void @_ZN11alglib_impl14ae_matrix_initEPNS_9ae_matrixElllPNS_8ae_stateEb(ptr noundef %18, i64 noundef %21, i64 noundef %24, i64 noundef %27, ptr noundef %28, i1 noundef zeroext %30)
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %31, i32 0, i32 0
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = icmp ne i64 %33, 0
  br i1 %34, label %35, label %91

35:                                               ; preds = %17
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %36, i32 0, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !14
  %39 = icmp ne i64 %38, 0
  br i1 %39, label %40, label %91

40:                                               ; preds = %35
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %41, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !18
  store ptr %43, ptr %9, align 8, !tbaa !5
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %44, i32 0, i32 6
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  %47 = getelementptr inbounds ptr, ptr %46, i64 0
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  store ptr %48, ptr %10, align 8, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %49, i32 0, i32 3
  %51 = load i64, ptr %50, align 8, !tbaa !15
  %52 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %51)
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %53, i32 0, i32 1
  %55 = load i64, ptr %54, align 8, !tbaa !14
  %56 = mul nsw i64 %52, %55
  store i64 %56, ptr %11, align 8, !tbaa !19
  store i64 0, ptr %12, align 8, !tbaa !19
  br label %57

57:                                               ; preds = %67, %40
  %58 = load i64, ptr %12, align 8, !tbaa !19
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %59, i32 0, i32 0
  %61 = load i64, ptr %60, align 8, !tbaa !11
  %62 = icmp slt i64 %58, %61
  br i1 %62, label %63, label %90

63:                                               ; preds = %57
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load i64, ptr %11, align 8, !tbaa !19
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %64, ptr align 1 %65, i64 %66, i1 false)
  br label %67

67:                                               ; preds = %63
  %68 = load i64, ptr %12, align 8, !tbaa !19
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %12, align 8, !tbaa !19
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %70, i32 0, i32 2
  %72 = load i64, ptr %71, align 8, !tbaa !21
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %73, i32 0, i32 3
  %75 = load i64, ptr %74, align 8, !tbaa !15
  %76 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %75)
  %77 = mul nsw i64 %72, %76
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 %77
  store ptr %79, ptr %9, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %80, i32 0, i32 2
  %82 = load i64, ptr %81, align 8, !tbaa !22
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %"struct.alglib_impl::x_matrix", ptr %83, i32 0, i32 3
  %85 = load i64, ptr %84, align 8, !tbaa !15
  %86 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %85)
  %87 = mul nsw i64 %82, %86
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i64 %87
  store ptr %89, ptr %10, align 8, !tbaa !5
  br label %57, !llvm.loop !25

90:                                               ; preds = %57
  br label %91

91:                                               ; preds = %90, %35, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN11alglib_impl8x_matrixE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !7, i64 48}
!13 = !{!"long long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 24}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!12, !13, i64 16}
!22 = !{!23, !20, i64 16}
!23 = !{!"_ZTSN11alglib_impl9ae_matrixE", !20, i64 0, !20, i64 8, !20, i64 16, !20, i64 24, !10, i64 32, !24, i64 40, !7, i64 72}
!24 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


; 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: noreturn nounwind
declare void @abort() local_unnamed_addr #0

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl14ae_matrix_initEPNS_9ae_matrixElllPNS_8ae_stateEb(ptr noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

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

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

6:                                                ; preds = %4
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i64, ptr %8, align 8, !tbaa !10
  %10 = getelementptr inbounds i8, ptr %1, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !11
  tail call void @_ZN11alglib_impl14ae_matrix_initEPNS_9ae_matrixElllPNS_8ae_stateEb(ptr noundef %0, i64 noundef %7, i64 noundef %9, i64 noundef %11, ptr noundef nonnull %2, i1 noundef zeroext %3)
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %.not27 = icmp eq i64 %12, 0
  br i1 %.not27, label %.loopexit, label %13

13:                                               ; preds = %6
  %14 = load i64, ptr %8, align 8, !tbaa !10
  %.not28 = icmp eq i64 %14, 0
  br i1 %.not28, label %.loopexit, label %15

15:                                               ; preds = %13
  %16 = getelementptr inbounds i8, ptr %1, i64 48
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %0, i64 72
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = load i64, ptr %10, align 8, !tbaa !11
  %22 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %21)
  %23 = load i64, ptr %8, align 8, !tbaa !10
  %24 = mul nsw i64 %23, %22
  %25 = load i64, ptr %1, align 8, !tbaa !5
  %26 = icmp sgt i64 %25, 0
  br i1 %26, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %15
  %27 = getelementptr inbounds i8, ptr %1, i64 16
  %28 = getelementptr inbounds i8, ptr %0, i64 16
  br label %29

29:                                               ; preds = %.lr.ph, %29
  %.031 = phi i64 [ 0, %.lr.ph ], [ %30, %29 ]
  %.02430 = phi ptr [ %17, %.lr.ph ], [ %35, %29 ]
  %.02529 = phi ptr [ %20, %.lr.ph ], [ %40, %29 ]
  tail call void @llvm.memmove.p0.p0.i64(ptr align 1 %.02529, ptr align 1 %.02430, i64 %24, i1 false)
  %30 = add nuw nsw i64 %.031, 1
  %31 = load i64, ptr %27, align 8, !tbaa !15
  %32 = load i64, ptr %10, align 8, !tbaa !11
  %33 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %32)
  %34 = mul nsw i64 %33, %31
  %35 = getelementptr inbounds i8, ptr %.02430, i64 %34
  %36 = load i64, ptr %28, align 8, !tbaa !16
  %37 = load i64, ptr %10, align 8, !tbaa !11
  %38 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %37)
  %39 = mul nsw i64 %38, %36
  %40 = getelementptr inbounds i8, ptr %.02529, i64 %39
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = icmp slt i64 %30, %41
  br i1 %42, label %29, label %.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %29, %15, %13, %6
  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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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_impl8x_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !8, i64 48}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 24}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!6, !7, i64 16}
!16 = !{!17, !18, i64 16}
!17 = !{!"_ZTSN11alglib_impl9ae_matrixE", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !19, i64 32, !20, i64 40, !8, i64 72}
!18 = !{!"long", !8, i64 0}
!19 = !{!"bool", !8, i64 0}
!20 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass