; 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::eigsubspacestate" = type { i64, i64, i64, i64, double, i64, i64, i8, i8, %"struct.alglib_impl::hqrndstate", i8, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", %"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", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::apbuffers", %"struct.alglib_impl::ae_matrix", %"struct.alglib_impl::ae_matrix", i64, i64, i64, %"struct.alglib_impl::rcommstate" }
%"struct.alglib_impl::hqrndstate" = type { i64, i64, i64 }
%"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::apbuffers" = type { %"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_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_matrix" = type { i64, i64, i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon.1 }
%union.anon.1 = type { ptr }
%"struct.alglib_impl::rcommstate" = type { i32, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }

@.str.350 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.351 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.352 = external hidden unnamed_addr constant [29 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl18eigsubspacesetcondEPNS_16eigsubspacestateEdlPNS_8ae_stateE(ptr noundef %0, double noundef %1, i64 noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !11
  store ptr %3, ptr %8, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %9, i32 0, i32 10
  %11 = load i8, ptr %10, align 8, !tbaa !13, !range !23, !noundef !24
  %12 = trunc i8 %11 to i1
  %13 = xor i1 %12, true
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %13, ptr noundef @.str.350, ptr noundef %14)
  %15 = load double, ptr %6, align 8, !tbaa !9
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %15, ptr noundef %16)
  br i1 %17, label %18, label %21

18:                                               ; preds = %4
  %19 = load double, ptr %6, align 8, !tbaa !9
  %20 = call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %19, double noundef 0.000000e+00)
  br label %21

21:                                               ; preds = %18, %4
  %22 = phi i1 [ false, %4 ], [ %20, %18 ]
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %22, ptr noundef @.str.351, ptr noundef %23)
  %24 = load i64, ptr %7, align 8, !tbaa !11
  %25 = icmp sge i64 %24, 0
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %25, ptr noundef @.str.352, ptr noundef %26)
  %27 = load double, ptr %6, align 8, !tbaa !9
  %28 = call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %27, double noundef 0.000000e+00)
  br i1 %28, label %29, label %33

29:                                               ; preds = %21
  %30 = load i64, ptr %7, align 8, !tbaa !11
  %31 = icmp eq i64 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  store double 0x3EB0C6F7A0B5ED8D, ptr %6, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %32, %29, %21
  %34 = load double, ptr %6, align 8, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %35, i32 0, i32 4
  store double %34, ptr %36, align 8, !tbaa !25
  %37 = load i64, ptr %7, align 8, !tbaa !11
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::eigsubspacestate", ptr %38, i32 0, i32 3
  store i64 %37, ptr %39, align 8, !tbaa !26
  ret void
}

declare noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef, ptr noundef) #0

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

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double noundef) #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 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, !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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !15, i64 88}
!14 = !{!"_ZTSN11alglib_impl16eigsubspacestateE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !10, i64 32, !12, i64 40, !12, i64 48, !15, i64 56, !15, i64 57, !16, i64 64, !15, i64 88, !17, i64 96, !19, i64 160, !19, i64 240, !19, i64 320, !19, i64 400, !19, i64 480, !19, i64 560, !19, i64 640, !19, i64 720, !19, i64 800, !17, i64 880, !17, i64 944, !17, i64 1008, !17, i64 1072, !17, i64 1136, !20, i64 1200, !19, i64 1936, !19, i64 2016, !12, i64 2096, !12, i64 2104, !12, i64 2112, !21, i64 2120}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTSN11alglib_impl10hqrndstateE", !12, i64 0, !12, i64 8, !12, i64 16}
!17 = !{!"_ZTSN11alglib_impl9ae_vectorE", !12, i64 0, !12, i64 8, !15, i64 16, !18, i64 24, !7, i64 56}
!18 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!"_ZTSN11alglib_impl9ae_matrixE", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !15, i64 32, !18, i64 40, !7, i64 72}
!20 = !{!"_ZTSN11alglib_impl9apbuffersE", !17, i64 0, !17, i64 64, !17, i64 128, !17, i64 192, !17, i64 256, !17, i64 320, !17, i64 384, !17, i64 448, !17, i64 512, !19, i64 576, !19, i64 656}
!21 = !{!"_ZTSN11alglib_impl10rcommstateE", !22, i64 0, !17, i64 8, !17, i64 72, !17, i64 136, !17, i64 200}
!22 = !{!"int", !7, i64 0}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!14, !10, i64 32}
!26 = !{!14, !12, i64 24}


; 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.350 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.351 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.352 = external hidden unnamed_addr constant [29 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl18eigsubspacesetcondEPNS_16eigsubspacestateEdlPNS_8ae_stateE(ptr nocapture noundef %0, double noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !20, !noundef !21
  %7 = trunc nuw i8 %6 to i1
  %8 = xor i1 %7, true
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %8, ptr noundef nonnull @.str.350, ptr noundef %3)
  %9 = tail call noundef zeroext i1 @_ZN11alglib_impl11ae_isfiniteEdPNS_8ae_stateE(double noundef %1, ptr noundef %3)
  br i1 %9, label %10, label %12

10:                                               ; preds = %4
  %11 = tail call noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef %1, double noundef 0.000000e+00)
  br label %12

12:                                               ; preds = %10, %4
  %13 = phi i1 [ false, %4 ], [ %11, %10 ]
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %13, ptr noundef nonnull @.str.351, ptr noundef %3)
  %14 = icmp sgt i64 %2, -1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %14, ptr noundef nonnull @.str.352, ptr noundef %3)
  %15 = tail call noundef zeroext i1 @_ZN11alglib_impl8ae_fp_eqEdd(double noundef %1, double noundef 0.000000e+00)
  %16 = icmp eq i64 %2, 0
  %or.cond = and i1 %16, %15
  %.0 = select i1 %or.cond, double 0x3EB0C6F7A0B5ED8D, double %1
  %17 = getelementptr inbounds i8, ptr %0, i64 32
  store double %.0, ptr %17, align 8, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %2, ptr %18, align 8, !tbaa !23
  ret void
}

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

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

declare noundef zeroext i1 @_ZN11alglib_impl16ae_fp_greater_eqEdd(double noundef, double 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 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, !11, i64 88}
!6 = !{!"_ZTSN11alglib_impl16eigsubspacestateE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !7, i64 40, !7, i64 48, !11, i64 56, !11, i64 57, !12, i64 64, !11, i64 88, !13, i64 96, !16, i64 160, !16, i64 240, !16, i64 320, !16, i64 400, !16, i64 480, !16, i64 560, !16, i64 640, !16, i64 720, !16, i64 800, !13, i64 880, !13, i64 944, !13, i64 1008, !13, i64 1072, !13, i64 1136, !17, i64 1200, !16, i64 1936, !16, i64 2016, !7, i64 2096, !7, i64 2104, !7, i64 2112, !18, i64 2120}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl10hqrndstateE", !7, i64 0, !7, i64 8, !7, i64 16}
!13 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !11, i64 16, !14, i64 24, !8, i64 56}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"_ZTSN11alglib_impl9ae_matrixE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !14, i64 40, !8, i64 72}
!17 = !{!"_ZTSN11alglib_impl9apbuffersE", !13, i64 0, !13, i64 64, !13, i64 128, !13, i64 192, !13, i64 256, !13, i64 320, !13, i64 384, !13, i64 448, !13, i64 512, !16, i64 576, !16, i64 656}
!18 = !{!"_ZTSN11alglib_impl10rcommstateE", !19, i64 0, !13, i64 8, !13, i64 72, !13, i64 136, !13, i64 200}
!19 = !{!"int", !8, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!6, !10, i64 32}
!23 = !{!6, !7, i64 24}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass