; LLVM IR from ERGO-Code/HiGHS :: src/ipm/ipx/iterate.ll (ZNK3ipx7Iterate8feasibleEv)

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

%"class.ipx::Iterate" = type { ptr, %"class.std::valarray", %"class.std::valarray", %"class.std::valarray", %"class.std::valarray", %"class.std::valarray", %"class.std::valarray", %"class.std::vector", %"class.std::valarray", %"class.std::valarray", %"class.std::valarray", %"class.std::valarray", double, double, double, double, double, double, double, double, double, i8, i8, double, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ipx::Iterate::StateDetail, std::allocator<ipx::Iterate::StateDetail>>::_Vector_impl" }
%"struct.std::_Vector_base<ipx::Iterate::StateDetail, std::allocator<ipx::Iterate::StateDetail>>::_Vector_impl" = type { %"struct.std::_Vector_base<ipx::Iterate::StateDetail, std::allocator<ipx::Iterate::StateDetail>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ipx::Iterate::StateDetail, std::allocator<ipx::Iterate::StateDetail>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::valarray" = type { i64, 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 uwtable
declare dso_local void @_ZNK3ipx7Iterate8EvaluateEv(ptr noundef nonnull align 8 dereferenceable(296)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3ipx7Iterate8feasibleEv(ptr noundef nonnull align 8 dereferenceable(296) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8
  call void @_ZNK3ipx7Iterate8EvaluateEv(ptr noundef nonnull align 8 dereferenceable(296) %10)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %11 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = call noundef double @_ZNK3ipx5Model11norm_boundsEv(ptr noundef nonnull align 8 dereferenceable(704) %12)
  %14 = fadd double 1.000000e+00, %13
  store double %14, ptr %3, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %15 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = call noundef double @_ZNK3ipx5Model6norm_cEv(ptr noundef nonnull align 8 dereferenceable(704) %16)
  %18 = fadd double 1.000000e+00, %17
  store double %18, ptr %4, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %19 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 14
  %20 = load double, ptr %19, align 8, !tbaa !20
  %21 = load double, ptr %3, align 8, !tbaa !19
  %22 = fdiv double %20, %21
  store double %22, ptr %5, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %23 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 15
  %24 = load double, ptr %23, align 8, !tbaa !21
  %25 = load double, ptr %4, align 8, !tbaa !19
  %26 = fdiv double %24, %25
  store double %26, ptr %6, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  %27 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 14
  %28 = load double, ptr %27, align 8, !tbaa !20
  %29 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 23
  %30 = load double, ptr %29, align 8, !tbaa !22
  %31 = load double, ptr %3, align 8, !tbaa !19
  %32 = fmul double %30, %31
  %33 = fcmp ole double %28, %32
  %34 = zext i1 %33 to i8
  store i8 %34, ptr %7, align 1, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  %35 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 15
  %36 = load double, ptr %35, align 8, !tbaa !21
  %37 = getelementptr inbounds %"class.ipx::Iterate", ptr %10, i32 0, i32 23
  %38 = load double, ptr %37, align 8, !tbaa !22
  %39 = load double, ptr %4, align 8, !tbaa !19
  %40 = fmul double %38, %39
  %41 = fcmp ole double %36, %40
  %42 = zext i1 %41 to i8
  store i8 %42, ptr %8, align 1, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  %43 = load i8, ptr %7, align 1, !tbaa !23, !range !24, !noundef !25
  %44 = trunc i8 %43 to i1
  br i1 %44, label %45, label %48

45:                                               ; preds = %1
  %46 = load i8, ptr %8, align 1, !tbaa !23, !range !24, !noundef !25
  %47 = trunc i8 %46 to i1
  br label %48

48:                                               ; preds = %45, %1
  %49 = phi i1 [ false, %1 ], [ %47, %45 ]
  %50 = zext i1 %49 to i8
  store i8 %50, ptr %9, align 1, !tbaa !23
  %51 = load i8, ptr %9, align 1, !tbaa !23, !range !24, !noundef !25
  %52 = trunc i8 %51 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret i1 %52
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3ipx5Model11norm_boundsEv(ptr noundef nonnull align 8 dereferenceable(704)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3ipx5Model6norm_cEv(ptr noundef nonnull align 8 dereferenceable(704)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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, !6, i64 0}
!10 = !{!"_ZTSN3ipx7IterateE", !6, i64 0, !11, i64 8, !11, i64 24, !11, i64 40, !11, i64 56, !11, i64 72, !11, i64 88, !13, i64 104, !11, i64 128, !11, i64 144, !11, i64 160, !11, i64 176, !17, i64 192, !17, i64 200, !17, i64 208, !17, i64 216, !17, i64 224, !17, i64 232, !17, i64 240, !17, i64 248, !17, i64 256, !18, i64 264, !18, i64 265, !17, i64 272, !17, i64 280, !17, i64 288}
!11 = !{!"_ZTSSt8valarrayIdE", !12, i64 0, !6, i64 8}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSSt6vectorIN3ipx7Iterate11StateDetailESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIN3ipx7Iterate11StateDetailESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN3ipx7Iterate11StateDetailESaIS2_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN3ipx7Iterate11StateDetailESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"double", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!17, !17, i64 0}
!20 = !{!10, !17, i64 208}
!21 = !{!10, !17, i64 216}
!22 = !{!10, !17, i64 272}
!23 = !{!18, !18, i64 0}
!24 = !{i8 0, i8 2}
!25 = !{}


; 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 uwtable
declare dso_local void @_ZNK3ipx7Iterate8EvaluateEv(ptr noundef nonnull align 8 dereferenceable(296)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK3ipx7Iterate8feasibleEv(ptr noundef nonnull align 8 dereferenceable(296) %0) local_unnamed_addr #0 align 2 {
  tail call void @_ZNK3ipx7Iterate8EvaluateEv(ptr noundef nonnull align 8 dereferenceable(296) %0)
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = tail call noundef double @_ZNK3ipx5Model11norm_boundsEv(ptr noundef nonnull align 8 dereferenceable(704) %2)
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = tail call noundef double @_ZNK3ipx5Model6norm_cEv(ptr noundef nonnull align 8 dereferenceable(704) %4)
  %6 = getelementptr inbounds i8, ptr %0, i64 208
  %7 = getelementptr inbounds i8, ptr %0, i64 272
  %8 = load <2 x double>, ptr %7, align 8
  %9 = insertelement <2 x double> poison, double %3, i64 0
  %10 = insertelement <2 x double> %9, double %5, i64 1
  %11 = fadd <2 x double> %10, <double 1.000000e+00, double 1.000000e+00>
  %12 = load <2 x double>, ptr %6, align 8, !tbaa !18
  %13 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
  %14 = fmul <2 x double> %11, %13
  %15 = fcmp ole <2 x double> %12, %14
  %16 = extractelement <2 x i1> %15, i64 0
  %17 = extractelement <2 x i1> %15, i64 1
  %18 = select i1 %16, i1 %17, i1 false
  ret i1 %18
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3ipx5Model11norm_boundsEv(ptr noundef nonnull align 8 dereferenceable(704)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3ipx5Model6norm_cEv(ptr noundef nonnull align 8 dereferenceable(704)) local_unnamed_addr #1 align 2

attributes #0 = { 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 #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" }

!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 = !{!"_ZTSN3ipx7IterateE", !7, i64 0, !10, i64 8, !10, i64 24, !10, i64 40, !10, i64 56, !10, i64 72, !10, i64 88, !12, i64 104, !10, i64 128, !10, i64 144, !10, i64 160, !10, i64 176, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !16, i64 224, !16, i64 232, !16, i64 240, !16, i64 248, !16, i64 256, !17, i64 264, !17, i64 265, !16, i64 272, !16, i64 280, !16, i64 288}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt8valarrayIdE", !11, i64 0, !7, i64 8}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_ZTSSt6vectorIN3ipx7Iterate11StateDetailESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIN3ipx7Iterate11StateDetailESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN3ipx7Iterate11StateDetailESaIS2_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN3ipx7Iterate11StateDetailESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!16 = !{!"double", !8, i64 0}
!17 = !{!"bool", !8, i64 0}
!18 = !{!16, !16, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass