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

; 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::convexquadraticmodel" = type { i64, i64, double, double, double, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", double, double, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, i64, %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", double, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", i8, i8, i8, i8 }
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon.0 = type { ptr }
%"struct.alglib_impl::ae_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = type { ptr }

@.str.120 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [25 x i8], align 1

; 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 void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef, double noundef) #1

declare noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN11alglib_impl9cqmxtadx2EPNS_20convexquadraticmodelEPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca double, 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
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %12, i32 0, i32 0
  %14 = load i64, ptr %13, align 8, !tbaa !9
  store i64 %14, ptr %9, align 8, !tbaa !17
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = load i64, ptr %9, align 8, !tbaa !17
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = call noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %15, i64 noundef %16, ptr noundef %17)
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %18, ptr noundef @.str.120, ptr noundef %19)
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %20, i32 0, i32 0
  %22 = load i64, ptr %21, align 8, !tbaa !18
  %23 = load i64, ptr %9, align 8, !tbaa !17
  %24 = icmp sge i64 %22, %23
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %24, ptr noundef @.str.121, ptr noundef %25)
  store double 0.000000e+00, ptr %11, align 8, !tbaa !19
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %26, i32 0, i32 2
  %28 = load double, ptr %27, align 8, !tbaa !20
  %29 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %28, double noundef 0.000000e+00)
  br i1 %29, label %30, label %44

30:                                               ; preds = %4
  %31 = load double, ptr %11, align 8, !tbaa !19
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %32, i32 0, i32 2
  %34 = load double, ptr %33, align 8, !tbaa !20
  %35 = fmul double %34, 5.000000e-01
  %36 = load i64, ptr %9, align 8, !tbaa !17
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %37, i32 0, i32 5
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = call noundef double @_ZN11alglib_impl12rmatrixsyvmvElPNS_9ae_matrixEllbPNS_9ae_vectorElS3_PNS_8ae_stateE(i64 noundef %36, ptr noundef %38, i64 noundef 0, i64 noundef 0, i1 noundef zeroext true, ptr noundef %39, i64 noundef 0, ptr noundef %40, ptr noundef %41)
  %43 = call double @llvm.fmuladd.f64(double %35, double %42, double %31)
  store double %43, ptr %11, align 8, !tbaa !19
  br label %44

44:                                               ; preds = %30, %4
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %45, i32 0, i32 3
  %47 = load double, ptr %46, align 8, !tbaa !21
  %48 = call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %47, double noundef 0.000000e+00)
  br i1 %48, label %49, label %82

49:                                               ; preds = %44
  store i64 0, ptr %10, align 8, !tbaa !17
  br label %50

50:                                               ; preds = %78, %49
  %51 = load i64, ptr %10, align 8, !tbaa !17
  %52 = load i64, ptr %9, align 8, !tbaa !17
  %53 = sub nsw i64 %52, 1
  %54 = icmp sle i64 %51, %53
  br i1 %54, label %55, label %81

55:                                               ; preds = %50
  %56 = load double, ptr %11, align 8, !tbaa !19
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %57, i32 0, i32 4
  %59 = load ptr, ptr %58, align 8, !tbaa !22
  %60 = load i64, ptr %10, align 8, !tbaa !17
  %61 = getelementptr inbounds double, ptr %59, i64 %60
  %62 = load double, ptr %61, align 8, !tbaa !19
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %62, ptr noundef %63)
  %65 = fmul double 5.000000e-01, %64
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %66, i32 0, i32 3
  %68 = load double, ptr %67, align 8, !tbaa !21
  %69 = fmul double %65, %68
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.alglib_impl::convexquadraticmodel", ptr %70, i32 0, i32 10
  %72 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %71, i32 0, i32 4
  %73 = load ptr, ptr %72, align 8, !tbaa !22
  %74 = load i64, ptr %10, align 8, !tbaa !17
  %75 = getelementptr inbounds double, ptr %73, i64 %74
  %76 = load double, ptr %75, align 8, !tbaa !19
  %77 = call double @llvm.fmuladd.f64(double %69, double %76, double %56)
  store double %77, ptr %11, align 8, !tbaa !19
  br label %78

78:                                               ; preds = %55
  %79 = load i64, ptr %10, align 8, !tbaa !17
  %80 = add nsw i64 %79, 1
  store i64 %80, ptr %10, align 8, !tbaa !17
  br label %50, !llvm.loop !23

81:                                               ; preds = %50
  br label %82

82:                                               ; preds = %81, %44
  %83 = load double, ptr %11, align 8, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret double %83
}

declare noundef double @_ZN11alglib_impl12rmatrixsyvmvElPNS_9ae_matrixEllbPNS_9ae_vectorElS3_PNS_8ae_stateE(i64 noundef, ptr noundef, i64 noundef, i64 noundef, i1 noundef zeroext, ptr noundef, i64 noundef, ptr noundef, ptr 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !11, i64 0}
!10 = !{!"_ZTSN11alglib_impl20convexquadraticmodelE", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 120, !16, i64 200, !16, i64 264, !16, i64 328, !16, i64 392, !16, i64 456, !13, i64 520, !13, i64 600, !16, i64 680, !16, i64 744, !16, i64 808, !12, i64 872, !12, i64 880, !16, i64 888, !16, i64 952, !11, i64 1016, !11, i64 1024, !13, i64 1032, !13, i64 1112, !13, i64 1192, !16, i64 1272, !16, i64 1336, !12, i64 1400, !16, i64 1408, !16, i64 1472, !16, i64 1536, !13, i64 1600, !14, i64 1680, !14, i64 1681, !14, i64 1682, !14, i64 1683}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTSN11alglib_impl9ae_matrixE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !14, i64 32, !15, i64 40, !7, i64 72}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !14, i64 16, !15, i64 24, !7, i64 56}
!17 = !{!11, !11, i64 0}
!18 = !{!16, !11, i64 0}
!19 = !{!12, !12, i64 0}
!20 = !{!10, !12, i64 16}
!21 = !{!10, !12, i64 24}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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"

@.str.120 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [25 x i8], align 1

declare void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #0

declare noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef, double noundef) local_unnamed_addr #0

declare noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

declare noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN11alglib_impl9cqmxtadx2EPNS_20convexquadraticmodelEPNS_9ae_vectorES3_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = load i64, ptr %0, align 8, !tbaa !5
  %6 = tail call noundef zeroext i1 @_ZN11alglib_impl14isfinitevectorEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %1, i64 noundef %5, ptr noundef %3)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %6, ptr noundef nonnull @.str.120, ptr noundef %3)
  %7 = load i64, ptr %2, align 8, !tbaa !16
  %8 = icmp sge i64 %7, %5
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.121, ptr noundef %3)
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !17
  %11 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %10, double noundef 0.000000e+00)
  br i1 %11, label %12, label %18

12:                                               ; preds = %4
  %13 = load double, ptr %9, align 8, !tbaa !17
  %14 = fmul double %13, 5.000000e-01
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = tail call noundef double @_ZN11alglib_impl12rmatrixsyvmvElPNS_9ae_matrixEllbPNS_9ae_vectorElS3_PNS_8ae_stateE(i64 noundef %5, ptr noundef nonnull %15, i64 noundef 0, i64 noundef 0, i1 noundef zeroext true, ptr noundef %1, i64 noundef 0, ptr noundef nonnull %2, ptr noundef %3)
  %17 = tail call double @llvm.fmuladd.f64(double %14, double %16, double 0.000000e+00)
  br label %18

18:                                               ; preds = %12, %4
  %.0 = phi double [ %17, %12 ], [ 0.000000e+00, %4 ]
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = load double, ptr %19, align 8, !tbaa !18
  %21 = tail call noundef zeroext i1 @_ZN11alglib_impl13ae_fp_greaterEdd(double noundef %20, double noundef 0.000000e+00)
  %.not.not28 = icmp sgt i64 %5, 0
  %or.cond = and i1 %21, %.not.not28
  br i1 %or.cond, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %18
  %22 = getelementptr inbounds i8, ptr %1, i64 56
  %23 = getelementptr inbounds i8, ptr %0, i64 448
  br label %24

24:                                               ; preds = %.lr.ph, %24
  %.130 = phi double [ %.0, %.lr.ph ], [ %35, %24 ]
  %.02729 = phi i64 [ 0, %.lr.ph ], [ %36, %24 ]
  %25 = load ptr, ptr %22, align 8, !tbaa !19
  %26 = getelementptr inbounds double, ptr %25, i64 %.02729
  %27 = load double, ptr %26, align 8, !tbaa !20
  %28 = tail call noundef double @_ZN11alglib_impl6ae_sqrEdPNS_8ae_stateE(double noundef %27, ptr noundef %3)
  %29 = fmul double %28, 5.000000e-01
  %30 = load double, ptr %19, align 8, !tbaa !18
  %31 = fmul double %29, %30
  %32 = load ptr, ptr %23, align 8, !tbaa !19
  %33 = getelementptr inbounds double, ptr %32, i64 %.02729
  %34 = load double, ptr %33, align 8, !tbaa !20
  %35 = tail call double @llvm.fmuladd.f64(double %31, double %34, double %.130)
  %36 = add nuw nsw i64 %.02729, 1
  %exitcond.not = icmp eq i64 %36, %5
  br i1 %exitcond.not, label %.loopexit, label %24, !llvm.loop !21

.loopexit:                                        ; preds = %24, %18
  %.2 = phi double [ %.0, %18 ], [ %35, %24 ]
  ret double %.2
}

declare noundef double @_ZN11alglib_impl12rmatrixsyvmvElPNS_9ae_matrixEllbPNS_9ae_vectorElS3_PNS_8ae_stateE(i64 noundef, ptr noundef, i64 noundef, i64 noundef, i1 noundef zeroext, ptr noundef, i64 noundef, ptr noundef, ptr 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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_impl20convexquadraticmodelE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !11, i64 120, !15, i64 200, !15, i64 264, !15, i64 328, !15, i64 392, !15, i64 456, !11, i64 520, !11, i64 600, !15, i64 680, !15, i64 744, !15, i64 808, !10, i64 872, !10, i64 880, !15, i64 888, !15, i64 952, !7, i64 1016, !7, i64 1024, !11, i64 1032, !11, i64 1112, !11, i64 1192, !15, i64 1272, !15, i64 1336, !10, i64 1400, !15, i64 1408, !15, i64 1472, !15, i64 1536, !11, i64 1600, !12, i64 1680, !12, i64 1681, !12, i64 1682, !12, i64 1683}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !12, i64 32, !13, i64 40, !8, i64 72}
!12 = !{!"bool", !8, i64 0}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !12, i64 16, !13, i64 24, !8, i64 56}
!16 = !{!15, !7, i64 0}
!17 = !{!6, !10, i64 16}
!18 = !{!6, !10, i64 24}
!19 = !{!8, !8, i64 0}
!20 = !{!10, !10, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass