; LLVM IR from Dimandragon/non-parametric-dsp :: alglib-cpp/src/alglibinternal.ll (ZN11alglib_impl8nisequalEPKNS_5nisetES2_PNS_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::niset" = type { i64, i64, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64 }
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon = type { ptr }

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl8nisequalEPKNS_5nisetES2_PNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #2
  store i8 0, ptr %11, align 1, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %13, i32 0, i32 0
  %15 = load i64, ptr %14, align 8, !tbaa !11
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %16, i32 0, i32 0
  %18 = load i64, ptr %17, align 8, !tbaa !11
  %19 = icmp ne i64 %15, %18
  br i1 %19, label %20, label %23

20:                                               ; preds = %3
  %21 = load i8, ptr %11, align 1, !tbaa !9, !range !16, !noundef !17
  %22 = trunc i8 %21 to i1
  store i1 %22, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %99

23:                                               ; preds = %3
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %24, i32 0, i32 1
  %26 = load i64, ptr %25, align 8, !tbaa !18
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !18
  %30 = icmp ne i64 %26, %29
  br i1 %30, label %31, label %34

31:                                               ; preds = %23
  %32 = load i8, ptr %11, align 1, !tbaa !9, !range !16, !noundef !17
  %33 = trunc i8 %32 to i1
  store i1 %33, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %99

34:                                               ; preds = %23
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %35, i32 0, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !18
  store i64 %37, ptr %9, align 8, !tbaa !19
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %38, i32 0, i32 1
  %40 = load i64, ptr %39, align 8, !tbaa !18
  store i64 %40, ptr %10, align 8, !tbaa !19
  store i64 0, ptr %8, align 8, !tbaa !19
  br label %41

41:                                               ; preds = %65, %34
  %42 = load i64, ptr %8, align 8, !tbaa !19
  %43 = load i64, ptr %9, align 8, !tbaa !19
  %44 = sub nsw i64 %43, 1
  %45 = icmp sle i64 %42, %44
  br i1 %45, label %46, label %68

46:                                               ; preds = %41
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %47, i32 0, i32 3
  %49 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %48, i32 0, i32 4
  %50 = load ptr, ptr %49, align 8, !tbaa !20
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %51, i32 0, i32 2
  %53 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %52, i32 0, i32 4
  %54 = load ptr, ptr %53, align 8, !tbaa !20
  %55 = load i64, ptr %8, align 8, !tbaa !19
  %56 = getelementptr inbounds i64, ptr %54, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !19
  %58 = getelementptr inbounds i64, ptr %50, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !19
  %60 = icmp slt i64 %59, 0
  br i1 %60, label %61, label %64

61:                                               ; preds = %46
  %62 = load i8, ptr %11, align 1, !tbaa !9, !range !16, !noundef !17
  %63 = trunc i8 %62 to i1
  store i1 %63, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %99

64:                                               ; preds = %46
  br label %65

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

68:                                               ; preds = %41
  store i64 0, ptr %8, align 8, !tbaa !19
  br label %69

69:                                               ; preds = %93, %68
  %70 = load i64, ptr %8, align 8, !tbaa !19
  %71 = load i64, ptr %10, align 8, !tbaa !19
  %72 = sub nsw i64 %71, 1
  %73 = icmp sle i64 %70, %72
  br i1 %73, label %74, label %96

74:                                               ; preds = %69
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %75, i32 0, i32 3
  %77 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %76, i32 0, i32 4
  %78 = load ptr, ptr %77, align 8, !tbaa !20
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %"struct.alglib_impl::niset", ptr %79, i32 0, i32 2
  %81 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !20
  %83 = load i64, ptr %8, align 8, !tbaa !19
  %84 = getelementptr inbounds i64, ptr %82, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !19
  %86 = getelementptr inbounds i64, ptr %78, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !19
  %88 = icmp slt i64 %87, 0
  br i1 %88, label %89, label %92

89:                                               ; preds = %74
  %90 = load i8, ptr %11, align 1, !tbaa !9, !range !16, !noundef !17
  %91 = trunc i8 %90 to i1
  store i1 %91, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %99

92:                                               ; preds = %74
  br label %93

93:                                               ; preds = %92
  %94 = load i64, ptr %8, align 8, !tbaa !19
  %95 = add nsw i64 %94, 1
  store i64 %95, ptr %8, align 8, !tbaa !19
  br label %69, !llvm.loop !23

96:                                               ; preds = %69
  store i8 1, ptr %11, align 1, !tbaa !9
  %97 = load i8, ptr %11, align 1, !tbaa !9, !range !16, !noundef !17
  %98 = trunc i8 %97 to i1
  store i1 %98, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %99

99:                                               ; preds = %96, %89, %61, %31, %20
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %100 = load i1, ptr %4, align 1
  ret i1 %100
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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_impl5nisetE", !13, i64 0, !13, i64 8, !14, i64 16, !14, i64 80, !13, i64 144}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_vectorE", !13, i64 0, !13, i64 8, !10, i64 16, !15, i64 24, !7, i64 56}
!15 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!12, !13, i64 8}
!19 = !{!13, !13, i64 0}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl8nisequalEPKNS_5nisetES2_PNS_8ae_stateE(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readnone %2) local_unnamed_addr #0 {
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %4, %5
  br i1 %.not, label %6, label %.loopexit

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i64, ptr %7, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load i64, ptr %9, align 8, !tbaa !14
  %.not26 = icmp eq i64 %8, %10
  br i1 %.not26, label %.preheader29, label %.loopexit

.preheader29:                                     ; preds = %6
  %.not27.not31 = icmp sgt i64 %8, 0
  br i1 %.not27.not31, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader29
  %11 = getelementptr inbounds i8, ptr %1, i64 136
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 72
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  br label %21

15:                                               ; preds = %21
  %16 = add nuw nsw i64 %.02332, 1
  %exitcond.not = icmp eq i64 %16, %8
  br i1 %exitcond.not, label %.preheader, label %21, !llvm.loop !16

.preheader:                                       ; preds = %15
  br i1 %.not27.not31, label %.lr.ph35, label %.loopexit

.lr.ph35:                                         ; preds = %.preheader
  %17 = getelementptr inbounds i8, ptr %0, i64 136
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %1, i64 72
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  br label %27

21:                                               ; preds = %.lr.ph, %15
  %.02332 = phi i64 [ 0, %.lr.ph ], [ %16, %15 ]
  %22 = getelementptr inbounds i64, ptr %14, i64 %.02332
  %23 = load i64, ptr %22, align 8, !tbaa !18
  %24 = getelementptr inbounds i64, ptr %12, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !18
  %26 = icmp slt i64 %25, 0
  br i1 %26, label %.loopexit, label %15

27:                                               ; preds = %27, %.lr.ph35
  %.134 = phi i64 [ 0, %.lr.ph35 ], [ %33, %27 ]
  %28 = getelementptr inbounds i64, ptr %20, i64 %.134
  %29 = load i64, ptr %28, align 8, !tbaa !18
  %30 = getelementptr inbounds i64, ptr %18, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !18
  %32 = icmp sgt i64 %31, -1
  %33 = add nuw nsw i64 %.134, 1
  %exitcond39.not = icmp ne i64 %33, %8
  %or.cond.not = select i1 %32, i1 %exitcond39.not, i1 false
  br i1 %or.cond.not, label %27, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %21, %27, %.preheader29, %.preheader, %6, %3
  %.0 = phi i1 [ false, %3 ], [ false, %6 ], [ true, %.preheader ], [ true, %.preheader29 ], [ %32, %27 ], [ false, %21 ]
  ret i1 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) 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, !7, i64 0}
!6 = !{!"_ZTSN11alglib_impl5nisetE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 80, !7, i64 144}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !11, i64 16, !12, i64 24, !8, i64 56}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!6, !7, i64 8}
!15 = !{!8, !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !17}


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