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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"struct.alglib_impl::x_vector" = type { i64, i64, i64, i64, %union.anon.1 }
%union.anon.1 = type { ptr }
%"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 }

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

; Function Attrs: noreturn nounwind
declare void @abort() #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11alglib_impl14ae_check_zerosEPKvl(ptr noundef, i64 noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl26ae_vector_init_attach_to_xEPNS_9ae_vectorEPNS_8x_vectorEPNS_8ae_stateEb(ptr noundef %0, ptr noundef %1, ptr noundef %2, i1 noundef zeroext %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %10 = zext i1 %3 to i8
  store i8 %10, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %11 = load ptr, ptr %7, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %14, label %13

13:                                               ; preds = %4
  call void @abort() #5
  unreachable

14:                                               ; preds = %4
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call noundef zeroext i1 @_ZN11alglib_impl14ae_check_zerosEPKvl(ptr noundef %15, i64 noundef 64)
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  call void @abort() #5
  unreachable

18:                                               ; preds = %14
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.alglib_impl::x_vector", ptr %19, i32 0, i32 0
  %21 = load i64, ptr %20, align 8, !tbaa !11
  store volatile i64 %21, ptr %9, align 8, !tbaa !14
  %22 = load volatile i64, ptr %9, align 8, !tbaa !14
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.alglib_impl::x_vector", ptr %23, i32 0, i32 0
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = icmp eq i64 %22, %25
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %26, ptr noundef @.str.5, ptr noundef %27)
  %28 = load volatile i64, ptr %9, align 8, !tbaa !14
  %29 = icmp sge i64 %28, 0
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %29, ptr noundef @.str.6, ptr noundef %30)
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %31, i32 0, i32 0
  store i64 0, ptr %32, align 8, !tbaa !16
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %33, i32 0, i32 4
  store ptr null, ptr %34, align 8, !tbaa !19
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::x_vector", ptr %35, i32 0, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !20
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %38, i32 0, i32 1
  store i64 %37, ptr %39, align 8, !tbaa !21
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %40, i32 0, i32 3
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load i8, ptr %8, align 1, !tbaa !9, !range !22, !noundef !23
  %44 = trunc i8 %43 to i1
  call void @_ZN11alglib_impl10ae_db_initEPNS_12ae_dyn_blockElPNS_8ae_stateEb(ptr noundef %41, i64 noundef 0, ptr noundef %42, i1 noundef zeroext %44)
  %45 = load volatile i64, ptr %9, align 8, !tbaa !14
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %46, i32 0, i32 0
  store i64 %45, ptr %47, align 8, !tbaa !16
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.alglib_impl::x_vector", ptr %48, i32 0, i32 4
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %51, i32 0, i32 4
  store ptr %50, ptr %52, align 8, !tbaa !19
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %53, i32 0, i32 2
  store i8 1, ptr %54, align 8, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

attributes #0 = { noreturn nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 }
attributes #5 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN11alglib_impl8x_vectorE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !7, i64 32}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"_ZTSN11alglib_impl9ae_vectorE", !15, i64 0, !15, i64 8, !10, 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 = !{!7, !7, i64 0}
!20 = !{!12, !13, i64 8}
!21 = !{!17, !15, i64 8}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!17, !10, i64 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"

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

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11alglib_impl14ae_check_zerosEPKvl(ptr noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl26ae_vector_init_attach_to_xEPNS_9ae_vectorEPNS_8x_vectorEPNS_8ae_stateEb(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, i1 noundef zeroext %3) local_unnamed_addr #3 {
  %5 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5)
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %4
  tail call void @abort() #4
  unreachable

7:                                                ; preds = %4
  %8 = tail call noundef zeroext i1 @_ZN11alglib_impl14ae_check_zerosEPKvl(ptr noundef %0, i64 noundef 64)
  br i1 %8, label %10, label %9

9:                                                ; preds = %7
  tail call void @abort() #4
  unreachable

10:                                               ; preds = %7
  %11 = load i64, ptr %1, align 8, !tbaa !5
  store volatile i64 %11, ptr %5, align 8, !tbaa !10
  %.0..0..0..0. = load volatile i64, ptr %5, align 8, !tbaa !10
  %12 = icmp eq i64 %.0..0..0..0., %11
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %12, ptr noundef nonnull @.str.5, ptr noundef nonnull %2)
  %.0..0..0..0.1 = load volatile i64, ptr %5, align 8, !tbaa !10
  %13 = icmp sgt i64 %.0..0..0..0.1, -1
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %13, ptr noundef nonnull @.str.6, ptr noundef nonnull %2)
  store i64 0, ptr %0, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr null, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i64, ptr %15, align 8, !tbaa !18
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %16, ptr %17, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN11alglib_impl10ae_db_initEPNS_12ae_dyn_blockElPNS_8ae_stateEb(ptr noundef nonnull %18, i64 noundef 0, ptr noundef nonnull %2, i1 noundef zeroext %3)
  %.0..0..0..0.2 = load volatile i64, ptr %5, align 8, !tbaa !10
  store i64 %.0..0..0..0.2, ptr %0, align 8, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %1, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  store ptr %20, ptr %14, align 8, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %0, i64 16
  store i8 1, ptr %21, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5)
  ret void
}

attributes #0 = { noreturn nounwind "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 willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { noreturn 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, !7, i64 0}
!6 = !{!"_ZTSN11alglib_impl8x_vectorE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !8, i64 32}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !14, i64 16, !15, i64 24, !8, i64 56}
!14 = !{!"bool", !8, i64 0}
!15 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!8, !8, i64 0}
!18 = !{!6, !7, i64 8}
!19 = !{!13, !11, i64 8}
!20 = !{!13, !14, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass