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

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef) #1

; 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) #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) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19ae_matrix_init_copyEPNS_9ae_matrixES1_PNS_8ae_stateEb(ptr noundef %0, ptr noundef %1, ptr noundef %2, i1 noundef zeroext %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = 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
  %10 = zext i1 %3 to i8
  store i8 %10, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %12, i32 0, i32 0
  %14 = load i64, ptr %13, align 8, !tbaa !11
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %15, i32 0, i32 1
  %17 = load i64, ptr %16, align 8, !tbaa !15
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %18, i32 0, i32 3
  %20 = load i64, ptr %19, align 8, !tbaa !16
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load i8, ptr %8, align 1, !tbaa !9, !range !17, !noundef !18
  %23 = trunc i8 %22 to i1
  call void @_ZN11alglib_impl14ae_matrix_initEPNS_9ae_matrixElllPNS_8ae_stateEb(ptr noundef %11, i64 noundef %14, i64 noundef %17, i64 noundef %20, ptr noundef %21, i1 noundef zeroext %23)
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %97

28:                                               ; preds = %4
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %29, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !15
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %33, label %97

33:                                               ; preds = %28
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %34, i32 0, i32 2
  %36 = load i64, ptr %35, align 8, !tbaa !19
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %37, i32 0, i32 2
  %39 = load i64, ptr %38, align 8, !tbaa !19
  %40 = icmp eq i64 %36, %39
  br i1 %40, label %41, label %64

41:                                               ; preds = %33
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  %45 = getelementptr inbounds ptr, ptr %44, i64 0
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %47, i32 0, i32 6
  %49 = load ptr, ptr %48, align 8, !tbaa !20
  %50 = getelementptr inbounds ptr, ptr %49, i64 0
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %52, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !11
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %55, i32 0, i32 2
  %57 = load i64, ptr %56, align 8, !tbaa !19
  %58 = mul nsw i64 %54, %57
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %59, i32 0, i32 3
  %61 = load i64, ptr %60, align 8, !tbaa !16
  %62 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %61)
  %63 = mul nsw i64 %58, %62
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %46, ptr align 1 %51, i64 %63, i1 false)
  br label %96

64:                                               ; preds = %33
  store i64 0, ptr %9, align 8, !tbaa !21
  br label %65

65:                                               ; preds = %92, %64
  %66 = load i64, ptr %9, align 8, !tbaa !21
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %67, i32 0, i32 0
  %69 = load i64, ptr %68, align 8, !tbaa !11
  %70 = icmp slt i64 %66, %69
  br i1 %70, label %71, label %95

71:                                               ; preds = %65
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %72, i32 0, i32 6
  %74 = load ptr, ptr %73, align 8, !tbaa !20
  %75 = load i64, ptr %9, align 8, !tbaa !21
  %76 = getelementptr inbounds ptr, ptr %74, i64 %75
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %78, i32 0, i32 6
  %80 = load ptr, ptr %79, align 8, !tbaa !20
  %81 = load i64, ptr %9, align 8, !tbaa !21
  %82 = getelementptr inbounds ptr, ptr %80, i64 %81
  %83 = load ptr, ptr %82, align 8, !tbaa !5
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %84, i32 0, i32 1
  %86 = load i64, ptr %85, align 8, !tbaa !15
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %87, i32 0, i32 3
  %89 = load i64, ptr %88, align 8, !tbaa !16
  %90 = call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %89)
  %91 = mul nsw i64 %86, %90
  call void @llvm.memmove.p0.p0.i64(ptr align 1 %77, ptr align 1 %83, i64 %91, i1 false)
  br label %92

92:                                               ; preds = %71
  %93 = load i64, ptr %9, align 8, !tbaa !21
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %9, align 8, !tbaa !21
  br label %65, !llvm.loop !22

95:                                               ; preds = %65
  br label %96

96:                                               ; preds = %95, %41
  br label %97

97:                                               ; preds = %96, %28, %4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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_impl9ae_matrixE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !10, i64 32, !14, i64 40, !7, i64 72}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!12, !13, i64 8}
!16 = !{!12, !13, i64 24}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!12, !13, i64 16}
!20 = !{!7, !7, i64 0}
!21 = !{!13, !13, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef) local_unnamed_addr #0

; 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) #1

; 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 #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19ae_matrix_init_copyEPNS_9ae_matrixES1_PNS_8ae_stateEb(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, i1 noundef zeroext %3) local_unnamed_addr #2 {
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = load i64, ptr %8, align 8, !tbaa !14
  tail call void @_ZN11alglib_impl14ae_matrix_initEPNS_9ae_matrixElllPNS_8ae_stateEb(ptr noundef %0, i64 noundef %5, i64 noundef %7, i64 noundef %9, ptr noundef %2, i1 noundef zeroext %3)
  %10 = load i64, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %10, 0
  br i1 %.not, label %.loopexit, label %11

11:                                               ; preds = %4
  %12 = load i64, ptr %6, align 8, !tbaa !13
  %.not25 = icmp eq i64 %12, 0
  br i1 %.not25, label %.loopexit, label %13

13:                                               ; preds = %11
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load i64, ptr %14, align 8, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load i64, ptr %16, align 8, !tbaa !15
  %18 = icmp eq i64 %15, %17
  br i1 %18, label %25, label %.preheader

.preheader:                                       ; preds = %13
  %19 = load i64, ptr %0, align 8, !tbaa !5
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %21 = getelementptr inbounds i8, ptr %0, i64 72
  %22 = getelementptr inbounds i8, ptr %1, i64 72
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = getelementptr inbounds i8, ptr %0, i64 24
  br label %36

25:                                               ; preds = %13
  %26 = getelementptr inbounds i8, ptr %0, i64 72
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %1, i64 72
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = load ptr, ptr %30, align 8, !tbaa !17
  %32 = mul nsw i64 %15, %10
  %33 = load i64, ptr %8, align 8, !tbaa !14
  %34 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %33)
  %35 = mul nsw i64 %32, %34
  tail call void @llvm.memmove.p0.p0.i64(ptr align 1 %28, ptr align 1 %31, i64 %35, i1 false)
  br label %.loopexit

36:                                               ; preds = %.lr.ph, %36
  %.026 = phi i64 [ 0, %.lr.ph ], [ %47, %36 ]
  %37 = load ptr, ptr %21, align 8, !tbaa !16
  %38 = getelementptr inbounds ptr, ptr %37, i64 %.026
  %39 = load ptr, ptr %38, align 8, !tbaa !17
  %40 = load ptr, ptr %22, align 8, !tbaa !16
  %41 = getelementptr inbounds ptr, ptr %40, i64 %.026
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  %43 = load i64, ptr %23, align 8, !tbaa !13
  %44 = load i64, ptr %24, align 8, !tbaa !14
  %45 = tail call noundef i64 @_ZN11alglib_impl9ae_sizeofEl(i64 noundef %44)
  %46 = mul nsw i64 %45, %43
  tail call void @llvm.memmove.p0.p0.i64(ptr align 1 %39, ptr align 1 %42, i64 %46, i1 false)
  %47 = add nuw nsw i64 %.026, 1
  %48 = load i64, ptr %0, align 8, !tbaa !5
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %36, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %36, %.preheader, %25, %11, %4
  ret void
}

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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" }

!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 24}
!15 = !{!6, !7, i64 16}
!16 = !{!8, !8, i64 0}
!17 = !{!12, !12, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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