; 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::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.0 }
%union.anon.0 = type { ptr }
%"struct.alglib_impl::hqrndstate" = type { i64, i64, i64 }
%"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.226 = external hidden unnamed_addr constant [46 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 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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl31rmatrixrndorthogonalfromtheleftEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.alglib_impl::ae_frame", align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca %"struct.alglib_impl::ae_vector", align 8
  %18 = alloca %"struct.alglib_impl::ae_vector", align 8
  %19 = alloca %"struct.alglib_impl::hqrndstate", align 8
  %20 = alloca i32, align 4
  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
  call void @llvm.lifetime.start.p0(i64 32, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #4
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  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 %17, i8 0, i64 64, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %18, i8 0, i64 64, i1 false)
  call void @llvm.memset.p0.i64(ptr align 8 %19, i8 0, i64 24, i1 false)
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef %17, i64 noundef 0, i64 noundef 3, ptr noundef %22, i1 noundef zeroext true)
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef %18, i64 noundef 0, i64 noundef 3, ptr noundef %23, i1 noundef zeroext true)
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef %19, ptr noundef %24, i1 noundef zeroext true)
  %25 = load i64, ptr %7, align 8, !tbaa !9
  %26 = icmp sge i64 %25, 1
  br i1 %26, label %27, label %30

27:                                               ; preds = %4
  %28 = load i64, ptr %6, align 8, !tbaa !9
  %29 = icmp sge i64 %28, 1
  br label %30

30:                                               ; preds = %27, %4
  %31 = phi i1 [ false, %4 ], [ %29, %27 ]
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %31, ptr noundef @.str.226, ptr noundef %32)
  %33 = load i64, ptr %6, align 8, !tbaa !9
  %34 = icmp eq i64 %33, 1
  br i1 %34, label %35, label %69

35:                                               ; preds = %30
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = call noundef i64 @_ZN11alglib_impl16ae_randomintegerElPNS_8ae_stateE(i64 noundef 2, ptr noundef %36)
  %38 = mul nsw i64 2, %37
  %39 = sub nsw i64 %38, 1
  %40 = sitofp i64 %39 to double
  store double %40, ptr %10, align 8, !tbaa !11
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %64, %35
  %42 = load i64, ptr %14, align 8, !tbaa !9
  %43 = load i64, ptr %7, align 8, !tbaa !9
  %44 = sub nsw i64 %43, 1
  %45 = icmp sle i64 %42, %44
  br i1 %45, label %46, label %67

46:                                               ; preds = %41
  %47 = load ptr, ptr %5, 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 !13
  %50 = getelementptr inbounds ptr, ptr %49, i64 0
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = load i64, ptr %14, align 8, !tbaa !9
  %53 = getelementptr inbounds double, ptr %51, i64 %52
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = load double, ptr %10, align 8, !tbaa !11
  %56 = fmul double %54, %55
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %57, i32 0, i32 6
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  %60 = getelementptr inbounds ptr, ptr %59, i64 0
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = load i64, ptr %14, align 8, !tbaa !9
  %63 = getelementptr inbounds double, ptr %61, i64 %62
  store double %56, ptr %63, align 8, !tbaa !11
  br label %64

64:                                               ; preds = %46
  %65 = load i64, ptr %14, align 8, !tbaa !9
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %14, align 8, !tbaa !9
  br label %41, !llvm.loop !14

67:                                               ; preds = %41
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %68)
  store i32 1, ptr %20, align 4
  br label %167

69:                                               ; preds = %30
  %70 = load i64, ptr %7, align 8, !tbaa !9
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %17, i64 noundef %70, ptr noundef %71)
  %72 = load i64, ptr %6, align 8, !tbaa !9
  %73 = add nsw i64 %72, 1
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef %18, i64 noundef %73, ptr noundef %74)
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl14hqrndrandomizeEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef %19, ptr noundef %75)
  store i64 2, ptr %12, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %136, %69
  %77 = load i64, ptr %12, align 8, !tbaa !9
  %78 = load i64, ptr %6, align 8, !tbaa !9
  %79 = icmp sle i64 %77, %78
  br i1 %79, label %80, label %139

80:                                               ; preds = %76
  br label %81

81:                                               ; preds = %117, %80
  store i64 1, ptr %13, align 8, !tbaa !9
  br label %82

82:                                               ; preds = %104, %81
  %83 = load i64, ptr %13, align 8, !tbaa !9
  %84 = load i64, ptr %12, align 8, !tbaa !9
  %85 = icmp sle i64 %83, %84
  br i1 %85, label %86, label %107

86:                                               ; preds = %82
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl12hqrndnormal2EPNS_10hqrndstateEPdS2_PNS_8ae_stateE(ptr noundef %19, ptr noundef %15, ptr noundef %16, ptr noundef %87)
  %88 = load double, ptr %15, align 8, !tbaa !11
  %89 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 4
  %90 = load ptr, ptr %89, align 8, !tbaa !13
  %91 = load i64, ptr %13, align 8, !tbaa !9
  %92 = getelementptr inbounds double, ptr %90, i64 %91
  store double %88, ptr %92, align 8, !tbaa !11
  %93 = load i64, ptr %13, align 8, !tbaa !9
  %94 = add nsw i64 %93, 1
  %95 = load i64, ptr %12, align 8, !tbaa !9
  %96 = icmp sle i64 %94, %95
  br i1 %96, label %97, label %104

97:                                               ; preds = %86
  %98 = load double, ptr %16, align 8, !tbaa !11
  %99 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 4
  %100 = load ptr, ptr %99, align 8, !tbaa !13
  %101 = load i64, ptr %13, align 8, !tbaa !9
  %102 = add nsw i64 %101, 1
  %103 = getelementptr inbounds double, ptr %100, i64 %102
  store double %98, ptr %103, align 8, !tbaa !11
  br label %104

104:                                              ; preds = %97, %86
  %105 = load i64, ptr %13, align 8, !tbaa !9
  %106 = add nsw i64 %105, 2
  store i64 %106, ptr %13, align 8, !tbaa !9
  br label %82, !llvm.loop !16

107:                                              ; preds = %82
  %108 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 4
  %109 = load ptr, ptr %108, align 8, !tbaa !13
  %110 = getelementptr inbounds double, ptr %109, i64 1
  %111 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 4
  %112 = load ptr, ptr %111, align 8, !tbaa !13
  %113 = getelementptr inbounds double, ptr %112, i64 1
  %114 = load i64, ptr %12, align 8, !tbaa !9
  %115 = call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef 1, i64 noundef %114)
  %116 = call noundef double @_ZN11alglib_impl15ae_v_dotproductEPKdlS1_ll(ptr noundef %110, i64 noundef 1, ptr noundef %113, i64 noundef 1, i64 noundef %115)
  store double %116, ptr %11, align 8, !tbaa !11
  br label %117

117:                                              ; preds = %107
  %118 = load double, ptr %11, align 8, !tbaa !11
  %119 = call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %118, double noundef 0.000000e+00)
  br i1 %119, label %81, label %120, !llvm.loop !17

120:                                              ; preds = %117
  %121 = load i64, ptr %12, align 8, !tbaa !9
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl18generatereflectionEPNS_9ae_vectorElPdPNS_8ae_stateE(ptr noundef %18, i64 noundef %121, ptr noundef %10, ptr noundef %122)
  %123 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 4
  %124 = load ptr, ptr %123, align 8, !tbaa !13
  %125 = getelementptr inbounds double, ptr %124, i64 1
  store double 1.000000e+00, ptr %125, align 8, !tbaa !11
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = load double, ptr %10, align 8, !tbaa !11
  %128 = load i64, ptr %6, align 8, !tbaa !9
  %129 = load i64, ptr %12, align 8, !tbaa !9
  %130 = sub nsw i64 %128, %129
  %131 = load i64, ptr %6, align 8, !tbaa !9
  %132 = sub nsw i64 %131, 1
  %133 = load i64, ptr %7, align 8, !tbaa !9
  %134 = sub nsw i64 %133, 1
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl26applyreflectionfromtheleftEPNS_9ae_matrixEdPNS_9ae_vectorEllllS3_PNS_8ae_stateE(ptr noundef %126, double noundef %127, ptr noundef %18, i64 noundef %130, i64 noundef %132, i64 noundef 0, i64 noundef %134, ptr noundef %17, ptr noundef %135)
  br label %136

136:                                              ; preds = %120
  %137 = load i64, ptr %12, align 8, !tbaa !9
  %138 = add nsw i64 %137, 1
  store i64 %138, ptr %12, align 8, !tbaa !9
  br label %76, !llvm.loop !18

139:                                              ; preds = %76
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %140

140:                                              ; preds = %162, %139
  %141 = load i64, ptr %13, align 8, !tbaa !9
  %142 = load i64, ptr %6, align 8, !tbaa !9
  %143 = sub nsw i64 %142, 1
  %144 = icmp sle i64 %141, %143
  br i1 %144, label %145, label %165

145:                                              ; preds = %140
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = call noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef %19, i64 noundef 2, ptr noundef %146)
  %148 = mul nsw i64 2, %147
  %149 = sub nsw i64 %148, 1
  %150 = sitofp i64 %149 to double
  store double %150, ptr %10, align 8, !tbaa !11
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %"struct.alglib_impl::ae_matrix", ptr %151, i32 0, i32 6
  %153 = load ptr, ptr %152, align 8, !tbaa !13
  %154 = load i64, ptr %13, align 8, !tbaa !9
  %155 = getelementptr inbounds ptr, ptr %153, i64 %154
  %156 = load ptr, ptr %155, align 8, !tbaa !5
  %157 = getelementptr inbounds double, ptr %156, i64 0
  %158 = load i64, ptr %7, align 8, !tbaa !9
  %159 = sub nsw i64 %158, 1
  %160 = call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef 0, i64 noundef %159)
  %161 = load double, ptr %10, align 8, !tbaa !11
  call void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef %157, i64 noundef 1, i64 noundef %160, double noundef %161)
  br label %162

162:                                              ; preds = %145
  %163 = load i64, ptr %13, align 8, !tbaa !9
  %164 = add nsw i64 %163, 1
  store i64 %164, ptr %13, align 8, !tbaa !9
  br label %140, !llvm.loop !19

165:                                              ; preds = %140
  %166 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %166)
  store i32 0, ptr %20, align 4
  br label %167

167:                                              ; preds = %165, %67
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  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 32, ptr %9) #4
  %168 = load i32, ptr %20, align 4
  switch i32 %168, label %170 [
    i32 0, label %169
    i32 1, label %169
  ]

169:                                              ; preds = %167, %167
  ret void

170:                                              ; preds = %167
  unreachable
}

declare noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef, double noundef) #2

declare noundef double @_ZN11alglib_impl15ae_v_dotproductEPKdlS1_ll(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) #2

declare noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef, i64 noundef) #2

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

declare void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i1 noundef zeroext) #2

declare void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #2

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) #2

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

declare void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef, i64 noundef, i64 noundef, double noundef) #2

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

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

declare noundef i64 @_ZN11alglib_impl16ae_randomintegerElPNS_8ae_stateE(i64 noundef, ptr noundef) #2

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

declare noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #2

declare void @_ZN11alglib_impl12hqrndnormal2EPNS_10hqrndstateEPdS2_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { "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 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15}


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

@.str.226 = external hidden unnamed_addr constant [46 x i8], align 1

; 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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl31rmatrixrndorthogonalfromtheleftEPNS_9ae_matrixEllPNS_8ae_stateE(ptr noundef %0, i64 noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #3 {
  %5 = alloca %"struct.alglib_impl::ae_frame", align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca %"struct.alglib_impl::ae_vector", align 8
  %10 = alloca %"struct.alglib_impl::ae_vector", align 8
  %11 = alloca %"struct.alglib_impl::hqrndstate", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #4
  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(64) %9, i8 0, i64 64, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %10, i8 0, i64 64, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %11, i8 0, i64 24, i1 false)
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef nonnull %9, i64 noundef 0, i64 noundef 3, ptr noundef %3, i1 noundef zeroext true)
  call void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef nonnull %10, i64 noundef 0, i64 noundef 3, ptr noundef %3, i1 noundef zeroext true)
  call void @_ZN11alglib_impl16_hqrndstate_initEPvPNS_8ae_stateEb(ptr noundef nonnull %11, ptr noundef %3, i1 noundef zeroext true)
  %12 = icmp sgt i64 %2, 0
  %13 = icmp sgt i64 %1, 0
  %14 = and i1 %13, %12
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef nonnull @.str.226, ptr noundef %3)
  %15 = icmp eq i64 %1, 1
  br i1 %15, label %16, label %36

16:                                               ; preds = %4
  %17 = call noundef i64 @_ZN11alglib_impl16ae_randomintegerElPNS_8ae_stateE(i64 noundef 2, ptr noundef %3)
  %18 = shl nsw i64 %17, 1
  %19 = add nsw i64 %18, -1
  %20 = sitofp i64 %19 to double
  br i1 %12, label %.lr.ph67, label %._crit_edge68

.lr.ph67:                                         ; preds = %16
  %21 = getelementptr inbounds i8, ptr %0, i64 72
  %xtraiter = and i64 %2, 1
  %22 = icmp eq i64 %2, 1
  br i1 %22, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67.new

.lr.ph67.new:                                     ; preds = %.lr.ph67
  %unroll_iter = and i64 %2, 9223372036854775806
  br label %23

23:                                               ; preds = %23, %.lr.ph67.new
  %.065 = phi i64 [ 0, %.lr.ph67.new ], [ %35, %23 ]
  %niter = phi i64 [ 0, %.lr.ph67.new ], [ %niter.next.1, %23 ]
  %24 = load ptr, ptr %21, align 8, !tbaa !5
  %25 = load ptr, ptr %24, align 8, !tbaa !8
  %26 = getelementptr inbounds double, ptr %25, i64 %.065
  %27 = load double, ptr %26, align 8, !tbaa !10
  %28 = fmul double %27, %20
  store double %28, ptr %26, align 8, !tbaa !10
  %29 = or disjoint i64 %.065, 1
  %30 = load ptr, ptr %21, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !8
  %32 = getelementptr inbounds double, ptr %31, i64 %29
  %33 = load double, ptr %32, align 8, !tbaa !10
  %34 = fmul double %33, %20
  store double %34, ptr %32, align 8, !tbaa !10
  %35 = add nuw nsw i64 %.065, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge68.loopexit.unr-lcssa, label %23, !llvm.loop !12

36:                                               ; preds = %4
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %9, i64 noundef %2, ptr noundef %3)
  %37 = add i64 %1, 1
  call void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef nonnull %10, i64 noundef %37, ptr noundef %3)
  call void @_ZN11alglib_impl14hqrndrandomizeEPNS_10hqrndstateEPNS_8ae_stateE(ptr noundef nonnull %11, ptr noundef %3)
  %.not60 = icmp slt i64 %1, 2
  br i1 %.not60, label %._crit_edge68, label %.preheader58.lr.ph

.preheader58.lr.ph:                               ; preds = %36
  %38 = getelementptr inbounds i8, ptr %10, i64 56
  %39 = add nsw i64 %1, -1
  %40 = add nsw i64 %2, -1
  br label %.preheader58

.preheader58:                                     ; preds = %.preheader58.lr.ph, %60
  %.05161 = phi i64 [ 2, %.preheader58.lr.ph ], [ %65, %60 ]
  br label %43

.preheader:                                       ; preds = %60
  br i1 %13, label %.lr.ph, label %._crit_edge68

.lr.ph:                                           ; preds = %.preheader
  %41 = getelementptr inbounds i8, ptr %0, i64 72
  %42 = add nsw i64 %2, -1
  br label %66

43:                                               ; preds = %.backedge, %.preheader58
  %.05059 = phi i64 [ 1, %.preheader58 ], [ %.05059.be, %.backedge ]
  call void @_ZN11alglib_impl12hqrndnormal2EPNS_10hqrndstateEPdS2_PNS_8ae_stateE(ptr noundef nonnull %11, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef %3)
  %44 = load double, ptr %7, align 8, !tbaa !10
  %45 = load ptr, ptr %38, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %45, i64 %.05059
  store double %44, ptr %46, align 8, !tbaa !10
  %.not56.not = icmp ult i64 %.05059, %.05161
  br i1 %.not56.not, label %47, label %52

47:                                               ; preds = %43
  %48 = load double, ptr %8, align 8, !tbaa !10
  %49 = load ptr, ptr %38, align 8, !tbaa !5
  %50 = getelementptr inbounds double, ptr %49, i64 %.05059
  %51 = getelementptr inbounds i8, ptr %50, i64 8
  store double %48, ptr %51, align 8, !tbaa !10
  br label %52

52:                                               ; preds = %47, %43
  %53 = add nuw nsw i64 %.05059, 2
  %.not55 = icmp ugt i64 %53, %.05161
  br i1 %.not55, label %54, label %.backedge

.backedge:                                        ; preds = %52, %54
  %.05059.be = phi i64 [ %53, %52 ], [ 1, %54 ]
  br label %43, !llvm.loop !14

54:                                               ; preds = %52
  %55 = load ptr, ptr %38, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef 1, i64 noundef %.05161)
  %58 = call noundef double @_ZN11alglib_impl15ae_v_dotproductEPKdlS1_ll(ptr noundef nonnull %56, i64 noundef 1, ptr noundef nonnull %56, i64 noundef 1, i64 noundef %57)
  %59 = call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %58, double noundef 0.000000e+00)
  br i1 %59, label %.backedge, label %60

60:                                               ; preds = %54
  call void @_ZN11alglib_impl18generatereflectionEPNS_9ae_vectorElPdPNS_8ae_stateE(ptr noundef nonnull %10, i64 noundef %.05161, ptr noundef nonnull %6, ptr noundef %3)
  %61 = load ptr, ptr %38, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %61, i64 8
  store double 1.000000e+00, ptr %62, align 8, !tbaa !10
  %63 = load double, ptr %6, align 8, !tbaa !10
  %64 = sub nsw i64 %1, %.05161
  call void @_ZN11alglib_impl26applyreflectionfromtheleftEPNS_9ae_matrixEdPNS_9ae_vectorEllllS3_PNS_8ae_stateE(ptr noundef %0, double noundef %63, ptr noundef nonnull %10, i64 noundef %64, i64 noundef %39, i64 noundef 0, i64 noundef %40, ptr noundef nonnull %9, ptr noundef %3)
  %65 = add nuw i64 %.05161, 1
  %exitcond.not = icmp eq i64 %.05161, %1
  br i1 %exitcond.not, label %.preheader, label %.preheader58, !llvm.loop !15

66:                                               ; preds = %.lr.ph, %66
  %.163 = phi i64 [ 0, %.lr.ph ], [ %76, %66 ]
  %67 = call noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef nonnull %11, i64 noundef 2, ptr noundef %3)
  %68 = shl nsw i64 %67, 1
  %69 = add nsw i64 %68, -1
  %70 = sitofp i64 %69 to double
  store double %70, ptr %6, align 8, !tbaa !10
  %71 = load ptr, ptr %41, align 8, !tbaa !5
  %72 = getelementptr inbounds ptr, ptr %71, i64 %.163
  %73 = load ptr, ptr %72, align 8, !tbaa !8
  %74 = call noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef 0, i64 noundef %42)
  %75 = load double, ptr %6, align 8, !tbaa !10
  call void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef %73, i64 noundef 1, i64 noundef %74, double noundef %75)
  %76 = add nuw nsw i64 %.163, 1
  %exitcond69.not = icmp eq i64 %76, %1
  br i1 %exitcond69.not, label %._crit_edge68, label %66, !llvm.loop !16

._crit_edge68.loopexit.unr-lcssa:                 ; preds = %23, %.lr.ph67
  %.065.unr = phi i64 [ 0, %.lr.ph67 ], [ %35, %23 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge68, label %._crit_edge68.loopexit.epilog-lcssa

._crit_edge68.loopexit.epilog-lcssa:              ; preds = %._crit_edge68.loopexit.unr-lcssa
  %77 = load ptr, ptr %21, align 8, !tbaa !5
  %78 = load ptr, ptr %77, align 8, !tbaa !8
  %79 = getelementptr inbounds double, ptr %78, i64 %.065.unr
  %80 = load double, ptr %79, align 8, !tbaa !10
  %81 = fmul double %80, %20
  store double %81, ptr %79, align 8, !tbaa !10
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %66, %._crit_edge68.loopexit.epilog-lcssa, %._crit_edge68.loopexit.unr-lcssa, %.preheader, %36, %16
  call void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  ret void
}

declare noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef, double noundef) local_unnamed_addr #2

declare noundef double @_ZN11alglib_impl15ae_v_dotproductEPKdlS1_ll(ptr noundef, i64 noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

declare noundef i64 @_ZN11alglib_impl8ae_v_lenEll(i64 noundef, i64 noundef) local_unnamed_addr #2

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

declare void @_ZN11alglib_impl14ae_vector_initEPNS_9ae_vectorEllPNS_8ae_stateEb(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

declare void @_ZN11alglib_impl20ae_vector_set_lengthEPNS_9ae_vectorElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN11alglib_impl14ae_frame_leaveEPNS_8ae_stateE(ptr noundef) local_unnamed_addr #2

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

declare void @_ZN11alglib_impl9ae_v_muldEPdlld(ptr noundef, i64 noundef, i64 noundef, double noundef) local_unnamed_addr #2

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

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

declare noundef i64 @_ZN11alglib_impl16ae_randomintegerElPNS_8ae_stateE(i64 noundef, ptr noundef) local_unnamed_addr #2

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

declare noundef i64 @_ZN11alglib_impl13hqrnduniformiEPNS_10hqrndstateElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare void @_ZN11alglib_impl12hqrndnormal2EPNS_10hqrndstateEPdS2_PNS_8ae_stateE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { "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 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 = !{!"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 = distinct !{!16, !13}


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