; LLVM IR from Dimandragon/non-parametric-dsp :: 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::ae_smart_ptr" = type { ptr, ptr, i8, i8, i64, ptr, ptr, %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }

@.str.20 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [70 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl7ae_freeEPv(ptr noundef) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19ae_smart_ptr_assignEPNS_12ae_smart_ptrEPvbblPFvS2_PKvPNS_8ae_stateEbEPFvS2_E(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3, i64 noundef %4, ptr noundef %5, ptr noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  %15 = zext i1 %2 to i8
  store i8 %15, ptr %10, align 1, !tbaa !9
  %16 = zext i1 %3 to i8
  store i8 %16, ptr %11, align 1, !tbaa !9
  store i64 %4, ptr %12, align 8, !tbaa !11
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  %17 = load ptr, ptr %9, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %25, label %19

19:                                               ; preds = %7
  %20 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %21 = trunc i8 %20 to i1
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = load ptr, ptr %13, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br label %25

25:                                               ; preds = %22, %19, %7
  %26 = phi i1 [ true, %19 ], [ true, %7 ], [ %24, %22 ]
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %26, ptr noundef @.str.20, ptr noundef null)
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %35, label %29

29:                                               ; preds = %25
  %30 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %35

32:                                               ; preds = %29
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br label %35

35:                                               ; preds = %32, %29, %25
  %36 = phi i1 [ true, %29 ], [ true, %25 ], [ %34, %32 ]
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %36, ptr noundef @.str.21, ptr noundef null)
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %45, label %39

39:                                               ; preds = %35
  %40 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %45

42:                                               ; preds = %39
  %43 = load i64, ptr %12, align 8, !tbaa !11
  %44 = icmp sgt i64 %43, 0
  br label %45

45:                                               ; preds = %42, %39, %35
  %46 = phi i1 [ true, %39 ], [ true, %35 ], [ %44, %42 ]
  call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %46, ptr noundef @.str.22, ptr noundef null)
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %47, i32 0, i32 2
  %49 = load i8, ptr %48, align 8, !tbaa !15, !range !13, !noundef !14
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %72

51:                                               ; preds = %45
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !18
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %72

56:                                               ; preds = %51
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %57, i32 0, i32 6
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  call void %59(ptr noundef %62)
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %63, i32 0, i32 3
  %65 = load i8, ptr %64, align 1, !tbaa !20, !range !13, !noundef !14
  %66 = trunc i8 %65 to i1
  br i1 %66, label %67, label %71

67:                                               ; preds = %56
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %68, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  call void @_ZN11alglib_impl7ae_freeEPv(ptr noundef %70)
  br label %71

71:                                               ; preds = %67, %56
  br label %72

72:                                               ; preds = %71, %51, %45
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %75, label %104

75:                                               ; preds = %72
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %77, i32 0, i32 1
  store ptr %76, ptr %78, align 8, !tbaa !18
  %79 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %80 = trunc i8 %79 to i1
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %81, i32 0, i32 2
  %83 = zext i1 %80 to i8
  store i8 %83, ptr %82, align 8, !tbaa !15
  %84 = load i8, ptr %11, align 1, !tbaa !9, !range !13, !noundef !14
  %85 = trunc i8 %84 to i1
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %86, i32 0, i32 3
  %88 = zext i1 %85 to i8
  store i8 %88, ptr %87, align 1, !tbaa !20
  %89 = load i8, ptr %10, align 1, !tbaa !9, !range !13, !noundef !14
  %90 = trunc i8 %89 to i1
  br i1 %90, label %91, label %93

91:                                               ; preds = %75
  %92 = load i64, ptr %12, align 8, !tbaa !11
  br label %94

93:                                               ; preds = %75
  br label %94

94:                                               ; preds = %93, %91
  %95 = phi i64 [ %92, %91 ], [ 0, %93 ]
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %96, i32 0, i32 4
  store i64 %95, ptr %97, align 8, !tbaa !21
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %99, i32 0, i32 5
  store ptr %98, ptr %100, align 8, !tbaa !22
  %101 = load ptr, ptr %14, align 8, !tbaa !5
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %102, i32 0, i32 6
  store ptr %101, ptr %103, align 8, !tbaa !19
  br label %117

104:                                              ; preds = %72
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %105, i32 0, i32 1
  store ptr null, ptr %106, align 8, !tbaa !18
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %107, i32 0, i32 2
  store i8 0, ptr %108, align 8, !tbaa !15
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %109, i32 0, i32 3
  store i8 0, ptr %110, align 1, !tbaa !20
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %111, i32 0, i32 4
  store i64 0, ptr %112, align 8, !tbaa !21
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %113, i32 0, i32 5
  store ptr null, ptr %114, align 8, !tbaa !22
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %115, i32 0, i32 6
  store ptr null, ptr %116, align 8, !tbaa !19
  br label %117

117:                                              ; preds = %104, %94
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %118, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8, !tbaa !23
  %121 = icmp ne ptr %120, null
  br i1 %121, label %122, label %129

122:                                              ; preds = %117
  %123 = load ptr, ptr %8, align 8, !tbaa !5
  %124 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %123, i32 0, i32 1
  %125 = load ptr, ptr %124, align 8, !tbaa !18
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = getelementptr inbounds %"struct.alglib_impl::ae_smart_ptr", ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !23
  store ptr %125, ptr %128, align 8, !tbaa !5
  br label %129

129:                                              ; preds = %122, %117
  ret void
}

attributes #0 = { 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 #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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 16}
!16 = !{!"_ZTSN11alglib_impl12ae_smart_ptrE", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 17, !12, i64 24, !6, i64 32, !6, i64 40, !17, i64 48}
!17 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!16, !6, i64 8}
!19 = !{!16, !6, i64 40}
!20 = !{!16, !10, i64 17}
!21 = !{!16, !12, i64 24}
!22 = !{!16, !6, i64 32}
!23 = !{!16, !6, i64 0}


; 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.20 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [70 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11alglib_impl7ae_freeEPv(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11alglib_impl19ae_smart_ptr_assignEPNS_12ae_smart_ptrEPvbblPFvS2_PKvPNS_8ae_stateEbEPFvS2_E(ptr nocapture noundef %0, ptr noundef %1, i1 noundef zeroext %2, i1 noundef zeroext %3, i64 noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #1 {
  %8 = zext i1 %2 to i8
  %9 = zext i1 %3 to i8
  %10 = icmp eq ptr %1, null
  br i1 %10, label %.thread, label %11

.thread:                                          ; preds = %7
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext true, ptr noundef nonnull @.str.20, ptr noundef null)
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext true, ptr noundef nonnull @.str.21, ptr noundef null)
  br label %15

11:                                               ; preds = %7
  %12 = icmp ne ptr %5, null
  %not. = xor i1 %2, true
  %spec.select = or i1 %12, %not.
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %spec.select, ptr noundef nonnull @.str.20, ptr noundef null)
  %13 = icmp ne ptr %6, null
  %spec.select41 = or i1 %13, %not.
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %spec.select41, ptr noundef nonnull @.str.21, ptr noundef null)
  %14 = icmp sgt i64 %4, 0
  %spec.select44 = or i1 %14, %not.
  br label %15

15:                                               ; preds = %.thread, %11
  %16 = phi i1 [ %spec.select44, %11 ], [ true, %.thread ]
  tail call void @_ZN11alglib_impl9ae_assertEbPKcPNS_8ae_stateE(i1 noundef zeroext %16, ptr noundef nonnull @.str.22, ptr noundef null)
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load i8, ptr %17, align 8, !tbaa !5, !range !13, !noundef !14
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %31

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %31, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  tail call void %25(ptr noundef nonnull %22)
  %26 = getelementptr inbounds i8, ptr %0, i64 17
  %27 = load i8, ptr %26, align 1, !tbaa !17, !range !13, !noundef !14
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %29, label %31

29:                                               ; preds = %23
  %30 = load ptr, ptr %21, align 8, !tbaa !15
  tail call void @_ZN11alglib_impl7ae_freeEPv(ptr noundef %30)
  br label %31

31:                                               ; preds = %23, %29, %20, %15
  br i1 %10, label %34, label %32

32:                                               ; preds = %31
  %33 = select i1 %2, i64 %4, i64 0
  br label %34

34:                                               ; preds = %31, %32
  %.sink50 = phi i8 [ %8, %32 ], [ 0, %31 ]
  %.sink49 = phi i8 [ %9, %32 ], [ 0, %31 ]
  %.sink48 = phi i64 [ %33, %32 ], [ 0, %31 ]
  %.sink47 = phi ptr [ %5, %32 ], [ null, %31 ]
  %.sink = phi ptr [ %6, %32 ], [ null, %31 ]
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %35, align 8
  store i8 %.sink50, ptr %17, align 8
  %36 = getelementptr inbounds i8, ptr %0, i64 17
  store i8 %.sink49, ptr %36, align 1
  %37 = getelementptr inbounds i8, ptr %0, i64 24
  store i64 %.sink48, ptr %37, align 8
  %38 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %.sink47, ptr %38, align 8
  %39 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %.sink, ptr %39, align 8
  %40 = load ptr, ptr %0, align 8, !tbaa !18
  %.not40 = icmp eq ptr %40, null
  br i1 %.not40, label %42, label %41

41:                                               ; preds = %34
  store ptr %1, ptr %40, align 8, !tbaa !19
  br label %42

42:                                               ; preds = %41, %34
  ret void
}

attributes #0 = { 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 #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, !10, i64 16}
!6 = !{!"_ZTSN11alglib_impl12ae_smart_ptrE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 17, !11, i64 24, !7, i64 32, !7, i64 40, !12, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !7, i64 40}
!17 = !{!6, !10, i64 17}
!18 = !{!6, !7, i64 0}
!19 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass