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

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

@.str.1 = external hidden unnamed_addr constant [1 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 uwtable
define dso_local void @_ZN11alglib_impl13ae_state_initEPNS_8ae_stateE(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %4, i32 0, i32 9
  store i64 0, ptr %5, align 8, !tbaa !9
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %6, i32 0, i32 5
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %8, i32 0, i32 5
  %10 = getelementptr inbounds %"struct.alglib_impl::ae_dyn_block", ptr %9, i32 0, i32 0
  store volatile ptr %7, ptr %10, align 8, !tbaa !16
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %11, i32 0, i32 5
  %13 = getelementptr inbounds %"struct.alglib_impl::ae_dyn_block", ptr %12, i32 0, i32 1
  store ptr null, ptr %13, align 8, !tbaa !17
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %14, i32 0, i32 5
  %16 = getelementptr inbounds %"struct.alglib_impl::ae_dyn_block", ptr %15, i32 0, i32 2
  store volatile ptr inttoptr (i64 1 to ptr), ptr %16, align 8, !tbaa !18
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %17, i32 0, i32 5
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %19, i32 0, i32 4
  store volatile ptr %18, ptr %20, align 8, !tbaa !19
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %21, i32 0, i32 6
  store volatile ptr null, ptr %22, align 8, !tbaa !20
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %23, i32 0, i32 8
  store volatile ptr @.str.1, ptr %24, align 8, !tbaa !21
  %25 = call noundef i64 @_ZN11alglib_impl17ae_get_endiannessEv()
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %26, i32 0, i32 0
  store i64 %25, ptr %27, align 8, !tbaa !22
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %28, i32 0, i32 0
  %30 = load i64, ptr %29, align 8, !tbaa !22
  %31 = icmp eq i64 %30, 1
  br i1 %31, label %32, label %51

32:                                               ; preds = %1
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %33, i32 0, i32 1
  store ptr %34, ptr %3, align 8, !tbaa !5
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds i32, ptr %35, i64 0
  store i32 0, ptr %36, align 4, !tbaa !23
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds i32, ptr %37, i64 1
  store i32 2146959360, ptr %38, align 4, !tbaa !23
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %39, i32 0, i32 2
  store ptr %40, ptr %3, align 8, !tbaa !5
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds i32, ptr %41, i64 0
  store i32 0, ptr %42, align 4, !tbaa !23
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds i32, ptr %43, i64 1
  store i32 2146435072, ptr %44, align 4, !tbaa !23
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %45, i32 0, i32 3
  store ptr %46, ptr %3, align 8, !tbaa !5
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds i32, ptr %47, i64 0
  store i32 0, ptr %48, align 4, !tbaa !23
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds i32, ptr %49, i64 1
  store i32 -1048576, ptr %50, align 4, !tbaa !23
  br label %77

51:                                               ; preds = %1
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %52, i32 0, i32 0
  %54 = load i64, ptr %53, align 8, !tbaa !22
  %55 = icmp eq i64 %54, 2
  br i1 %55, label %56, label %75

56:                                               ; preds = %51
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %57, i32 0, i32 1
  store ptr %58, ptr %3, align 8, !tbaa !5
  %59 = load ptr, ptr %3, align 8, !tbaa !5
  %60 = getelementptr inbounds i32, ptr %59, i64 1
  store i32 0, ptr %60, align 4, !tbaa !23
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds i32, ptr %61, i64 0
  store i32 2146959360, ptr %62, align 4, !tbaa !23
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %63, i32 0, i32 2
  store ptr %64, ptr %3, align 8, !tbaa !5
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds i32, ptr %65, i64 1
  store i32 0, ptr %66, align 4, !tbaa !23
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds i32, ptr %67, i64 0
  store i32 2146435072, ptr %68, align 4, !tbaa !23
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %69, i32 0, i32 3
  store ptr %70, ptr %3, align 8, !tbaa !5
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds i32, ptr %71, i64 1
  store i32 0, ptr %72, align 4, !tbaa !23
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds i32, ptr %73, i64 0
  store i32 -1048576, ptr %74, align 4, !tbaa !23
  br label %76

75:                                               ; preds = %51
  call void @abort() #5
  unreachable

76:                                               ; preds = %56
  br label %77

77:                                               ; preds = %76, %32
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %78, i32 0, i32 10
  store ptr null, ptr %79, align 8, !tbaa !25
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %80, i32 0, i32 11
  store ptr null, ptr %81, align 8, !tbaa !26
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = getelementptr inbounds %"struct.alglib_impl::ae_state", ptr %82, i32 0, i32 12
  store ptr null, ptr %83, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11alglib_impl17ae_get_endiannessEv() #3

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 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 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 #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, !15, i64 96}
!10 = !{!"_ZTSN11alglib_impl8ae_stateE", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !6, i64 32, !13, i64 40, !6, i64 72, !14, i64 80, !6, i64 88, !15, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!"_ZTSN11alglib_impl13ae_error_typeE", !7, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !6, i64 56}
!19 = !{!10, !6, i64 32}
!20 = !{!10, !6, i64 72}
!21 = !{!10, !6, i64 88}
!22 = !{!10, !11, i64 0}
!23 = !{!24, !24, i64 0}
!24 = !{!"int", !7, i64 0}
!25 = !{!10, !6, i64 104}
!26 = !{!10, !6, i64 112}
!27 = !{!10, !6, i64 120}


; 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.1 = external hidden unnamed_addr constant [1 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11alglib_impl13ae_state_initEPNS_8ae_stateE(ptr noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 96
  store i64 0, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  store volatile ptr %3, ptr %3, align 8, !tbaa !15
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr null, ptr %4, align 8, !tbaa !16
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  store volatile ptr inttoptr (i64 1 to ptr), ptr %5, align 8, !tbaa !17
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  store volatile ptr %3, ptr %6, align 8, !tbaa !18
  %7 = getelementptr inbounds i8, ptr %0, i64 72
  store volatile ptr null, ptr %7, align 8, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  store volatile ptr @.str.1, ptr %8, align 8, !tbaa !20
  %9 = tail call noundef i64 @_ZN11alglib_impl17ae_get_endiannessEv()
  store i64 %9, ptr %0, align 8, !tbaa !21
  switch i64 %9, label %18 [
    i64 1, label %10
    i64 2, label %14
  ]

10:                                               ; preds = %1
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  store <4 x i32> <i32 0, i32 2146959360, i32 0, i32 2146435072>, ptr %11, align 4, !tbaa !22
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 0, ptr %12, align 4, !tbaa !22
  %13 = getelementptr inbounds i8, ptr %0, i64 28
  br label %19

14:                                               ; preds = %1
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  store <4 x i32> <i32 2146959360, i32 0, i32 2146435072, i32 0>, ptr %15, align 4, !tbaa !22
  %16 = getelementptr inbounds i8, ptr %0, i64 24
  %17 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 0, ptr %17, align 4, !tbaa !22
  br label %19

18:                                               ; preds = %1
  tail call void @abort() #3
  unreachable

19:                                               ; preds = %14, %10
  %.sink = phi ptr [ %16, %14 ], [ %13, %10 ]
  store i32 -1048576, ptr %.sink, align 4, !tbaa !22
  %20 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %20, i8 0, i64 24, i1 false)
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN11alglib_impl17ae_get_endiannessEv() local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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, !14, i64 96}
!6 = !{!"_ZTSN11alglib_impl8ae_stateE", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !12, i64 40, !11, i64 72, !13, i64 80, !11, i64 88, !14, i64 96, !11, i64 104, !11, i64 112, !11, i64 120}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!13 = !{!"_ZTSN11alglib_impl13ae_error_typeE", !8, i64 0}
!14 = !{!"long long", !8, i64 0}
!15 = !{!6, !11, i64 40}
!16 = !{!6, !11, i64 48}
!17 = !{!6, !11, i64 56}
!18 = !{!6, !11, i64 32}
!19 = !{!6, !11, i64 72}
!20 = !{!6, !11, i64 88}
!21 = !{!6, !7, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass