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

; 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_frame" = type { %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::hqrndstate" = type { i64, i64, i64 }
%"struct.alglib_impl::ae_complex" = type { double, double }
%"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 }

; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16hpdmatrixrndcondEldPNS_9ae_matrixEPNS_8ae_stateE(i64 noundef %0, double noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca i64, align 8
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.alglib_impl::ae_frame", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca %"struct.alglib_impl::hqrndstate", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.alglib_impl::ae_complex", align 8
  %17 = alloca %"struct.alglib_impl::ae_complex", align 8
  %18 = alloca %"struct.alglib_impl::ae_complex", align 8
  %19 = alloca %"struct.alglib_impl::ae_complex", align 8
  %20 = alloca %"struct.alglib_impl::ae_complex", align 8
  store i64 %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !11
  store ptr %3, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #6
  %21 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %21, ptr noundef %9)
  call void @llvm.memset.p0.i64(ptr align 8 %14, i8 0, i64 24, i1 false)
  %22 = load ptr, ptr %7, align 8, !tbaa !11
  call void @_ZN11alglib_impl15ae_matrix_clearEPNS_9ae_matrixE(ptr noundef %22)
  %23 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef %14, ptr noundef %23, i1 noundef zeroext true)
  %24 = load i64, ptr %5, align 8, !tbaa !5
  %25 = icmp sle i64 %24, 0
  br i1 %25, label %29, label %26

26:                                               ; preds = %4
  %27 = load double, ptr %6, align 8, !tbaa !9
  %28 = call noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef %27, double noundef 1.000000e+00)
  br i1 %28, label %29, label %31

29:                                               ; preds = %26, %4
  %30 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %30)
  store i32 1, ptr %15, align 4
  br label %177

31:                                               ; preds = %26
  %32 = load ptr, ptr %7, align 8, !tbaa !11
  %33 = load i64, ptr %5, align 8, !tbaa !5
  %34 = load i64, ptr %5, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl20ae_matrix_set_lengthEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %32, i64 noundef %33, i64 noundef %34, ptr noundef %35)
  %36 = load i64, ptr %5, align 8, !tbaa !5
  %37 = icmp eq i64 %36, 1
  br i1 %37, label %38, label %51

38:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #6
  %39 = call { double, double } @_ZN11alglib_impl17ae_complex_from_iEl(i64 noundef 1)
  %40 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 0
  %41 = extractvalue { double, double } %39, 0
  store double %41, ptr %40, align 8
  %42 = getelementptr inbounds { double, double }, ptr %16, i32 0, i32 1
  %43 = extractvalue { double, double } %39, 1
  store double %43, ptr %42, align 8
  %44 = load ptr, ptr %7, align 8, !tbaa !11
  %45 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %44, i32 0, i32 6
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = getelementptr inbounds ptr, ptr %46, i64 0
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %48, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %49, ptr align 8 %16, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #6
  %50 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %50)
  store i32 1, ptr %15, align 4
  br label %177

51:                                               ; preds = %31
  %52 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl14hqrndrandomizeEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef %14, ptr noundef %52)
  store double 0.000000e+00, ptr %12, align 8, !tbaa !9
  %53 = load double, ptr %6, align 8, !tbaa !9
  %54 = fdiv double 1.000000e+00, %53
  %55 = load ptr, ptr %8, align 8, !tbaa !11
  %56 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef %54, ptr noundef %55)
  store double %56, ptr %13, align 8, !tbaa !9
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %86, %51
  %58 = load i64, ptr %10, align 8, !tbaa !5
  %59 = load i64, ptr %5, align 8, !tbaa !5
  %60 = sub nsw i64 %59, 1
  %61 = icmp sle i64 %58, %60
  br i1 %61, label %62, label %89

62:                                               ; preds = %57
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %82, %62
  %64 = load i64, ptr %11, align 8, !tbaa !5
  %65 = load i64, ptr %5, align 8, !tbaa !5
  %66 = sub nsw i64 %65, 1
  %67 = icmp sle i64 %64, %66
  br i1 %67, label %68, label %85

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #6
  %69 = call { double, double } @_ZN11alglib_impl17ae_complex_from_iEl(i64 noundef 0)
  %70 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 0
  %71 = extractvalue { double, double } %69, 0
  store double %71, ptr %70, align 8
  %72 = getelementptr inbounds { double, double }, ptr %17, i32 0, i32 1
  %73 = extractvalue { double, double } %69, 1
  store double %73, ptr %72, align 8
  %74 = load ptr, ptr %7, align 8, !tbaa !11
  %75 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %74, i32 0, i32 6
  %76 = load ptr, ptr %75, align 8, !tbaa !13
  %77 = load i64, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds ptr, ptr %76, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !11
  %80 = load i64, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %79, i64 %80
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %81, ptr align 8 %17, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  br label %82

82:                                               ; preds = %68
  %83 = load i64, ptr %11, align 8, !tbaa !5
  %84 = add nsw i64 %83, 1
  store i64 %84, ptr %11, align 8, !tbaa !5
  br label %63, !llvm.loop !15

85:                                               ; preds = %63
  br label %86

86:                                               ; preds = %85
  %87 = load i64, ptr %10, align 8, !tbaa !5
  %88 = add nsw i64 %87, 1
  store i64 %88, ptr %10, align 8, !tbaa !5
  br label %57, !llvm.loop !17

89:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #6
  %90 = load double, ptr %12, align 8, !tbaa !9
  %91 = load ptr, ptr %8, align 8, !tbaa !11
  %92 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %90, ptr noundef %91)
  %93 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef %92)
  %94 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 0
  %95 = extractvalue { double, double } %93, 0
  store double %95, ptr %94, align 8
  %96 = getelementptr inbounds { double, double }, ptr %18, i32 0, i32 1
  %97 = extractvalue { double, double } %93, 1
  store double %97, ptr %96, align 8
  %98 = load ptr, ptr %7, align 8, !tbaa !11
  %99 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %98, i32 0, i32 6
  %100 = load ptr, ptr %99, align 8, !tbaa !13
  %101 = getelementptr inbounds ptr, ptr %100, i64 0
  %102 = load ptr, ptr %101, align 8, !tbaa !11
  %103 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %102, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %103, ptr align 8 %18, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #6
  store i64 1, ptr %10, align 8, !tbaa !5
  br label %104

104:                                              ; preds = %132, %89
  %105 = load i64, ptr %10, align 8, !tbaa !5
  %106 = load i64, ptr %5, align 8, !tbaa !5
  %107 = sub nsw i64 %106, 2
  %108 = icmp sle i64 %105, %107
  br i1 %108, label %109, label %135

109:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #6
  %110 = load ptr, ptr %8, align 8, !tbaa !11
  %111 = call noundef double @_ZN11alglib_impl13hqrnduniformrEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef %14, ptr noundef %110)
  %112 = load double, ptr %13, align 8, !tbaa !9
  %113 = load double, ptr %12, align 8, !tbaa !9
  %114 = fsub double %112, %113
  %115 = load double, ptr %12, align 8, !tbaa !9
  %116 = call double @llvm.fmuladd.f64(double %111, double %114, double %115)
  %117 = load ptr, ptr %8, align 8, !tbaa !11
  %118 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %116, ptr noundef %117)
  %119 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef %118)
  %120 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 0
  %121 = extractvalue { double, double } %119, 0
  store double %121, ptr %120, align 8
  %122 = getelementptr inbounds { double, double }, ptr %19, i32 0, i32 1
  %123 = extractvalue { double, double } %119, 1
  store double %123, ptr %122, align 8
  %124 = load ptr, ptr %7, align 8, !tbaa !11
  %125 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %124, i32 0, i32 6
  %126 = load ptr, ptr %125, align 8, !tbaa !13
  %127 = load i64, ptr %10, align 8, !tbaa !5
  %128 = getelementptr inbounds ptr, ptr %126, i64 %127
  %129 = load ptr, ptr %128, align 8, !tbaa !11
  %130 = load i64, ptr %10, align 8, !tbaa !5
  %131 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %129, i64 %130
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %131, ptr align 8 %19, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #6
  br label %132

132:                                              ; preds = %109
  %133 = load i64, ptr %10, align 8, !tbaa !5
  %134 = add nsw i64 %133, 1
  store i64 %134, ptr %10, align 8, !tbaa !5
  br label %104, !llvm.loop !18

135:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %136 = load double, ptr %13, align 8, !tbaa !9
  %137 = load ptr, ptr %8, align 8, !tbaa !11
  %138 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %136, ptr noundef %137)
  %139 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef %138)
  %140 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %141 = extractvalue { double, double } %139, 0
  store double %141, ptr %140, align 8
  %142 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %143 = extractvalue { double, double } %139, 1
  store double %143, ptr %142, align 8
  %144 = load ptr, ptr %7, align 8, !tbaa !11
  %145 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %144, i32 0, i32 6
  %146 = load ptr, ptr %145, align 8, !tbaa !13
  %147 = load i64, ptr %5, align 8, !tbaa !5
  %148 = sub nsw i64 %147, 1
  %149 = getelementptr inbounds ptr, ptr %146, i64 %148
  %150 = load ptr, ptr %149, align 8, !tbaa !11
  %151 = load i64, ptr %5, align 8, !tbaa !5
  %152 = sub nsw i64 %151, 1
  %153 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %150, i64 %152
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %153, ptr align 8 %20, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  %154 = load ptr, ptr %7, align 8, !tbaa !11
  %155 = load i64, ptr %5, align 8, !tbaa !5
  %156 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl18hmatrixrndmultiplyEPNS_9ae_matrixElPNS_8ae_stateE(ptr noundef %154, i64 noundef %155, ptr noundef %156)
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %172, %135
  %158 = load i64, ptr %10, align 8, !tbaa !5
  %159 = load i64, ptr %5, align 8, !tbaa !5
  %160 = sub nsw i64 %159, 1
  %161 = icmp sle i64 %158, %160
  br i1 %161, label %162, label %175

162:                                              ; preds = %157
  %163 = load ptr, ptr %7, align 8, !tbaa !11
  %164 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %163, i32 0, i32 6
  %165 = load ptr, ptr %164, align 8, !tbaa !13
  %166 = load i64, ptr %10, align 8, !tbaa !5
  %167 = getelementptr inbounds ptr, ptr %165, i64 %166
  %168 = load ptr, ptr %167, align 8, !tbaa !11
  %169 = load i64, ptr %10, align 8, !tbaa !5
  %170 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %168, i64 %169
  %171 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %170, i32 0, i32 1
  store double 0.000000e+00, ptr %171, align 8, !tbaa !19
  br label %172

172:                                              ; preds = %162
  %173 = load i64, ptr %10, align 8, !tbaa !5
  %174 = add nsw i64 %173, 1
  store i64 %174, ptr %10, align 8, !tbaa !5
  br label %157, !llvm.loop !21

175:                                              ; preds = %157
  %176 = load ptr, ptr %8, align 8, !tbaa !11
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %176)
  store i32 0, ptr %15, align 4
  br label %177

177:                                              ; preds = %175, %38, %29
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  %178 = load i32, ptr %15, align 4
  switch i32 %178, label %180 [
    i32 0, label %179
    i32 1, label %179
  ]

179:                                              ; preds = %177, %177
  ret void

180:                                              ; preds = %177
  unreachable
}

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

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

declare void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef, ptr noundef) #5

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) #5

declare noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef, double noundef) #5

declare { double, double } @_ZN11alglib_impl17ae_complex_from_iEl(i64 noundef) #5

declare { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef) #5

declare void @_ZN11alglib_impl15ae_matrix_clearEPNS_9ae_matrixE(ptr noundef) #5

declare void @_ZN11alglib_impl20ae_matrix_set_lengthEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #5

declare void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef, ptr noundef, i1 noundef zeroext) #5

declare void @_ZN11alglib_impl14hqrndrandomizeEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef, ptr noundef) #5

declare noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef, ptr noundef) #5

declare noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef, ptr noundef) #5

declare noundef double @_ZN11alglib_impl13hqrnduniformrEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef, ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { "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 #6 = { 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 = !{!"long", !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 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{i64 0, i64 8, !9, i64 8, i64 8, !9}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}
!19 = !{!20, !10, i64 8}
!20 = !{!"_ZTSN11alglib_impl10ae_complexE", !10, i64 0, !10, i64 8}
!21 = distinct !{!21, !16}


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

%"struct.alglib_impl::ae_frame" = type { %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%"struct.alglib_impl::hqrndstate" = type { i64, i64, i64 }
%"struct.alglib_impl::ae_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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl16hpdmatrixrndcondEldPNS_9ae_matrixEPNS_8ae_stateE(i64 noundef %0, double noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca %"struct.alglib_impl::ae_frame", align 8
  %6 = alloca %"struct.alglib_impl::hqrndstate", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef %3, ptr noundef nonnull %5)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  call void @_ZN11alglib_impl15ae_matrix_clearEPNS_9ae_matrixE(ptr noundef %2)
  call void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef nonnull %6, ptr noundef %3, i1 noundef zeroext true)
  %7 = icmp slt i64 %0, 1
  br i1 %7, label %._crit_edge78, label %8

8:                                                ; preds = %4
  %9 = call noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef %1, double noundef 1.000000e+00)
  br i1 %9, label %._crit_edge78, label %10

10:                                               ; preds = %8
  call void @_ZN11alglib_impl20ae_matrix_set_lengthEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %2, i64 noundef %0, i64 noundef %0, ptr noundef %3)
  %11 = icmp eq i64 %0, 1
  %12 = getelementptr inbounds i8, ptr %2, i64 72
  br i1 %11, label %13, label %.preheader.lr.ph

13:                                               ; preds = %10
  %14 = call { double, double } @_ZN11alglib_impl17ae_complex_from_iEl(i64 noundef 1)
  %15 = extractvalue { double, double } %14, 0
  %16 = extractvalue { double, double } %14, 1
  %17 = load ptr, ptr %12, align 8, !tbaa !5
  %18 = load ptr, ptr %17, align 8, !tbaa !8
  store double %15, ptr %18, align 8, !tbaa !10
  %.sroa.48.0..sroa_idx = getelementptr inbounds i8, ptr %18, i64 8
  store double %16, ptr %.sroa.48.0..sroa_idx, align 8, !tbaa !10
  br label %._crit_edge78

.preheader.lr.ph:                                 ; preds = %10
  call void @_ZN11alglib_impl14hqrndrandomizeEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef nonnull %6, ptr noundef %3)
  %19 = fdiv double 1.000000e+00, %1
  %20 = call noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef %19, ptr noundef %3)
  br label %.preheader.us

.preheader.us:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph
  %.070.us = phi i64 [ 0, %.preheader.lr.ph ], [ %30, %._crit_edge.us ]
  br label %21

21:                                               ; preds = %.preheader.us, %21
  %.06168.us = phi i64 [ 0, %.preheader.us ], [ %29, %21 ]
  %22 = call { double, double } @_ZN11alglib_impl17ae_complex_from_iEl(i64 noundef 0)
  %23 = extractvalue { double, double } %22, 0
  %24 = extractvalue { double, double } %22, 1
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = getelementptr inbounds ptr, ptr %25, i64 %.070.us
  %27 = load ptr, ptr %26, align 8, !tbaa !8
  %28 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %27, i64 %.06168.us
  store double %23, ptr %28, align 8, !tbaa !10
  %.sroa.46.0..sroa_idx.us = getelementptr inbounds i8, ptr %28, i64 8
  store double %24, ptr %.sroa.46.0..sroa_idx.us, align 8, !tbaa !10
  %29 = add nuw nsw i64 %.06168.us, 1
  %exitcond.not = icmp eq i64 %29, %0
  br i1 %exitcond.not, label %._crit_edge.us, label %21, !llvm.loop !12

._crit_edge.us:                                   ; preds = %21
  %30 = add nuw nsw i64 %.070.us, 1
  %exitcond79.not = icmp eq i64 %30, %0
  br i1 %exitcond79.not, label %._crit_edge71, label %.preheader.us, !llvm.loop !14

._crit_edge71:                                    ; preds = %._crit_edge.us
  %31 = add nsw i64 %0, -1
  %32 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef 0.000000e+00, ptr noundef %3)
  %33 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef %32)
  %34 = extractvalue { double, double } %33, 0
  %35 = extractvalue { double, double } %33, 1
  %36 = getelementptr inbounds i8, ptr %2, i64 72
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = load ptr, ptr %37, align 8, !tbaa !8
  store double %34, ptr %38, align 8, !tbaa !10
  %.sroa.44.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 8
  store double %35, ptr %.sroa.44.0..sroa_idx, align 8, !tbaa !10
  %.not72 = icmp slt i64 %0, 3
  br i1 %.not72, label %.lr.ph77.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %._crit_edge71, %.lr.ph
  %.173 = phi i64 [ %49, %.lr.ph ], [ 1, %._crit_edge71 ]
  %39 = call noundef double @_ZN11alglib_impl13hqrnduniformrEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef nonnull %6, ptr noundef %3)
  %40 = call double @llvm.fmuladd.f64(double %39, double %20, double 0.000000e+00)
  %41 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %40, ptr noundef %3)
  %42 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef %41)
  %43 = extractvalue { double, double } %42, 0
  %44 = extractvalue { double, double } %42, 1
  %45 = load ptr, ptr %36, align 8, !tbaa !5
  %46 = getelementptr inbounds ptr, ptr %45, i64 %.173
  %47 = load ptr, ptr %46, align 8, !tbaa !8
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %47, i64 %.173
  store double %43, ptr %48, align 8, !tbaa !10
  %.sroa.42.0..sroa_idx = getelementptr inbounds i8, ptr %48, i64 8
  store double %44, ptr %.sroa.42.0..sroa_idx, align 8, !tbaa !10
  %49 = add nuw i64 %.173, 1
  %exitcond80.not = icmp eq i64 %49, %31
  br i1 %exitcond80.not, label %.lr.ph77.preheader, label %.lr.ph, !llvm.loop !15

.lr.ph77.preheader:                               ; preds = %.lr.ph, %._crit_edge71
  %50 = call noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef %20, ptr noundef %3)
  %51 = call { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef %50)
  %52 = extractvalue { double, double } %51, 0
  %53 = extractvalue { double, double } %51, 1
  %54 = load ptr, ptr %36, align 8, !tbaa !5
  %55 = getelementptr inbounds ptr, ptr %54, i64 %31
  %56 = load ptr, ptr %55, align 8, !tbaa !8
  %57 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %56, i64 %31
  store double %52, ptr %57, align 8, !tbaa !10
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %57, i64 8
  store double %53, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !10
  call void @_ZN11alglib_impl18hmatrixrndmultiplyEPNS_9ae_matrixElPNS_8ae_stateE(ptr noundef nonnull %2, i64 noundef %0, ptr noundef %3)
  %smax = call i64 @llvm.smax.i64(i64 %0, i64 1)
  %xtraiter = and i64 %smax, 3
  %58 = icmp slt i64 %0, 4
  br i1 %58, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77.preheader.new

.lr.ph77.preheader.new:                           ; preds = %.lr.ph77.preheader
  %unroll_iter = and i64 %smax, 9223372036854775804
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77, %.lr.ph77.preheader.new
  %.275 = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %78, %.lr.ph77 ]
  %niter = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %niter.next.3, %.lr.ph77 ]
  %59 = load ptr, ptr %36, align 8, !tbaa !5
  %60 = getelementptr inbounds ptr, ptr %59, i64 %.275
  %61 = load ptr, ptr %60, align 8, !tbaa !8
  %62 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %61, i64 %.275, i32 1
  store double 0.000000e+00, ptr %62, align 8, !tbaa !16
  %63 = or disjoint i64 %.275, 1
  %64 = load ptr, ptr %36, align 8, !tbaa !5
  %65 = getelementptr inbounds ptr, ptr %64, i64 %63
  %66 = load ptr, ptr %65, align 8, !tbaa !8
  %67 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %66, i64 %63, i32 1
  store double 0.000000e+00, ptr %67, align 8, !tbaa !16
  %68 = or disjoint i64 %.275, 2
  %69 = load ptr, ptr %36, align 8, !tbaa !5
  %70 = getelementptr inbounds ptr, ptr %69, i64 %68
  %71 = load ptr, ptr %70, align 8, !tbaa !8
  %72 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %71, i64 %68, i32 1
  store double 0.000000e+00, ptr %72, align 8, !tbaa !16
  %73 = or disjoint i64 %.275, 3
  %74 = load ptr, ptr %36, align 8, !tbaa !5
  %75 = getelementptr inbounds ptr, ptr %74, i64 %73
  %76 = load ptr, ptr %75, align 8, !tbaa !8
  %77 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %76, i64 %73, i32 1
  store double 0.000000e+00, ptr %77, align 8, !tbaa !16
  %78 = add nuw nsw i64 %.275, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77, !llvm.loop !18

._crit_edge78.loopexit.unr-lcssa:                 ; preds = %.lr.ph77, %.lr.ph77.preheader
  %.275.unr = phi i64 [ 0, %.lr.ph77.preheader ], [ %78, %.lr.ph77 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge78, label %.lr.ph77.epil

.lr.ph77.epil:                                    ; preds = %._crit_edge78.loopexit.unr-lcssa, %.lr.ph77.epil
  %.275.epil = phi i64 [ %83, %.lr.ph77.epil ], [ %.275.unr, %._crit_edge78.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph77.epil ], [ 0, %._crit_edge78.loopexit.unr-lcssa ]
  %79 = load ptr, ptr %36, align 8, !tbaa !5
  %80 = getelementptr inbounds ptr, ptr %79, i64 %.275.epil
  %81 = load ptr, ptr %80, align 8, !tbaa !8
  %82 = getelementptr inbounds %"struct.alglib_impl::ae_complex", ptr %81, i64 %.275.epil, i32 1
  store double 0.000000e+00, ptr %82, align 8, !tbaa !16
  %83 = add nuw nsw i64 %.275.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge78, label %.lr.ph77.epil, !llvm.loop !19

._crit_edge78:                                    ; preds = %._crit_edge78.loopexit.unr-lcssa, %.lr.ph77.epil, %4, %8, %13
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  ret void
}

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

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

declare void @_ZN11alglib_impl13ae_frame_makeEPNS_8ae_stateEPNS_8ae_frameE(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) local_unnamed_addr #4

declare noundef zeroext i1 @_ZN11alglib_impl10ae_fp_lessEdd(double noundef, double noundef) local_unnamed_addr #4

declare { double, double } @_ZN11alglib_impl17ae_complex_from_iEl(i64 noundef) local_unnamed_addr #4

declare { double, double } @_ZN11alglib_impl17ae_complex_from_dEd(double noundef) local_unnamed_addr #4

declare void @_ZN11alglib_impl15ae_matrix_clearEPNS_9ae_matrixE(ptr noundef) local_unnamed_addr #4

declare void @_ZN11alglib_impl20ae_matrix_set_lengthEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #4

declare void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #4

declare void @_ZN11alglib_impl14hqrndrandomizeEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef, ptr noundef) local_unnamed_addr #4

declare noundef double @_ZN11alglib_impl6ae_logEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #4

declare noundef double @_ZN11alglib_impl6ae_expEdPNS_8ae_stateE(double noundef, ptr noundef) local_unnamed_addr #4

declare noundef double @_ZN11alglib_impl13hqrnduniformrEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{!17, !11, i64 8}
!17 = !{!"_ZTSN11alglib_impl10ae_complexE", !11, i64 0, !11, i64 8}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.unroll.disable"}


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