; LLVM IR from Dimandragon/non-parametric-dsp :: alglib-cpp/src (optimization)

; 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::qpxproblem" = type { i64, i8, double, i8, %"struct.alglib_impl::ae_vector", i8, %"struct.alglib_impl::ae_vector", i8, %"struct.alglib_impl::ae_vector", i8, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i8, %"struct.alglib_impl::sparsematrix", i8, %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, %"struct.alglib_impl::sparsematrix", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", i64, %"struct.alglib_impl::xquadraticconstraints", i64, %"struct.alglib_impl::sparsematrix" }
%"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::xquadraticconstraints" = type { i64, %"struct.alglib_impl::ae_obj_array", %"struct.alglib_impl::ae_vector" }
%"struct.alglib_impl::ae_obj_array" = type { i64, i64, i8, ptr, ptr, ptr, ptr, %"struct.alglib_impl::ae_lock", %"struct.alglib_impl::ae_dyn_block" }
%"struct.alglib_impl::ae_lock" = type { ptr, %"struct.alglib_impl::ae_dyn_block", i8 }
%"struct.alglib_impl::sparsematrix" = 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", i64, i64, i64, i64, i64, i64 }

; 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_impl26qpxproblemhasquadratictermEPNS_10qpxproblemEPNS_8ae_stateE(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #2
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %"struct.alglib_impl::qpxproblem", ptr %8, i32 0, i32 12
  %10 = load i8, ptr %9, align 8, !tbaa !9, !range !20, !noundef !21
  %11 = trunc i8 %10 to i1
  br i1 %11, label %15, label %12

12:                                               ; preds = %2
  store i8 0, ptr %6, align 1, !tbaa !22
  %13 = load i8, ptr %6, align 1, !tbaa !22, !range !20, !noundef !21
  %14 = trunc i8 %13 to i1
  store i1 %14, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %30

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.alglib_impl::qpxproblem", ptr %16, i32 0, i32 13
  %18 = getelementptr inbounds %"struct.alglib_impl::sparsematrix", ptr %17, i32 0, i32 2
  %19 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %18, i32 0, i32 4
  %20 = load ptr, ptr %19, align 8, !tbaa !23
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.alglib_impl::qpxproblem", ptr %21, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !24
  %24 = getelementptr inbounds i64, ptr %20, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !25
  %26 = icmp sgt i64 %25, 0
  %27 = zext i1 %26 to i8
  store i8 %27, ptr %6, align 1, !tbaa !22
  %28 = load i8, ptr %6, align 1, !tbaa !22, !range !20, !noundef !21
  %29 = trunc i8 %28 to i1
  store i1 %29, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %30

30:                                               ; preds = %15, %12
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #2
  %31 = load i1, ptr %3, align 1
  ret i1 %31
}

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, !12, i64 376}
!10 = !{!"_ZTSN11alglib_impl10qpxproblemE", !11, i64 0, !12, i64 8, !13, i64 16, !12, i64 24, !14, i64 32, !12, i64 96, !14, i64 104, !12, i64 168, !14, i64 176, !12, i64 240, !14, i64 248, !14, i64 312, !12, i64 376, !16, i64 384, !12, i64 752, !14, i64 760, !14, i64 824, !11, i64 888, !16, i64 896, !14, i64 1264, !14, i64 1328, !11, i64 1392, !17, i64 1400, !11, i64 1608, !16, i64 1616}
!11 = !{!"long", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl9ae_vectorE", !11, i64 0, !11, i64 8, !12, 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 = !{!"_ZTSN11alglib_impl12sparsematrixE", !14, i64 0, !14, i64 64, !14, i64 128, !14, i64 192, !14, i64 256, !11, i64 320, !11, i64 328, !11, i64 336, !11, i64 344, !11, i64 352, !11, i64 360}
!17 = !{!"_ZTSN11alglib_impl21xquadraticconstraintsE", !11, i64 0, !18, i64 8, !14, i64 144}
!18 = !{!"_ZTSN11alglib_impl12ae_obj_arrayE", !11, i64 0, !11, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !19, i64 56, !15, i64 104}
!19 = !{!"_ZTSN11alglib_impl7ae_lockE", !6, i64 0, !15, i64 8, !12, i64 40}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!12, !12, i64 0}
!23 = !{!7, !7, i64 0}
!24 = !{!10, !11, i64 0}
!25 = !{!11, !11, 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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @_ZN11alglib_impl26qpxproblemhasquadratictermEPNS_10qpxproblemEPNS_8ae_stateE(ptr nocapture noundef readonly %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 376
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !19, !noundef !20
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %6, label %13

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 568
  %8 = load ptr, ptr %7, align 8, !tbaa !21
  %9 = load i64, ptr %0, align 8, !tbaa !22
  %10 = getelementptr inbounds i64, ptr %8, i64 %9
  %11 = load i64, ptr %10, align 8, !tbaa !23
  %12 = icmp sgt i64 %11, 0
  br label %13

13:                                               ; preds = %2, %6
  %.0 = phi i1 [ %12, %6 ], [ false, %2 ]
  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, !10, i64 376}
!6 = !{!"_ZTSN11alglib_impl10qpxproblemE", !7, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !12, i64 32, !10, i64 96, !12, i64 104, !10, i64 168, !12, i64 176, !10, i64 240, !12, i64 248, !12, i64 312, !10, i64 376, !15, i64 384, !10, i64 752, !12, i64 760, !12, i64 824, !7, i64 888, !15, i64 896, !12, i64 1264, !12, i64 1328, !7, i64 1392, !16, i64 1400, !7, i64 1608, !15, i64 1616}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTSN11alglib_impl9ae_vectorE", !7, i64 0, !7, i64 8, !10, i64 16, !13, i64 24, !8, i64 56}
!13 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"_ZTSN11alglib_impl12sparsematrixE", !12, i64 0, !12, i64 64, !12, i64 128, !12, i64 192, !12, i64 256, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !7, i64 352, !7, i64 360}
!16 = !{!"_ZTSN11alglib_impl21xquadraticconstraintsE", !7, i64 0, !17, i64 8, !12, i64 144}
!17 = !{!"_ZTSN11alglib_impl12ae_obj_arrayE", !7, i64 0, !7, i64 8, !10, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !18, i64 56, !13, i64 104}
!18 = !{!"_ZTSN11alglib_impl7ae_lockE", !14, i64 0, !13, i64 8, !10, i64 40}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!8, !8, i64 0}
!22 = !{!6, !7, i64 0}
!23 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass