; LLVM IR from ERGO-Code/HiGHS :: src/util/HighsUtils.ll (Z22predictFromScatterDataRK16HighsScatterDatadRdb)

; 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.HighsScatterData = type <{ i32, i32, i32, [4 x i8], %"class.std::vector.3", %"class.std::vector.3", i8, [7 x i8], double, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z22predictFromScatterDataRK16HighsScatterDatadRdb(ptr noundef nonnull align 8 dereferenceable(156) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(8) %2, i1 noundef zeroext %3) #1 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  %10 = zext i1 %3 to i8
  store i8 %10, ptr %9, align 1, !tbaa !11
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.HighsScatterData, ptr %11, i32 0, i32 6
  %13 = load i8, ptr %12, align 8, !tbaa !13, !range !20, !noundef !21
  %14 = trunc i8 %13 to i1
  br i1 %14, label %16, label %15

15:                                               ; preds = %4
  store i1 false, ptr %5, align 1
  br label %40

16:                                               ; preds = %4
  %17 = load i8, ptr %9, align 1, !tbaa !11, !range !20, !noundef !21
  %18 = trunc i8 %17 to i1
  br i1 %18, label %19, label %30

19:                                               ; preds = %16
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.HighsScatterData, ptr %20, i32 0, i32 11
  %22 = load double, ptr %21, align 8, !tbaa !22
  %23 = load double, ptr %7, align 8, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.HighsScatterData, ptr %24, i32 0, i32 12
  %26 = load double, ptr %25, align 8, !tbaa !23
  %27 = call double @pow(double noundef %23, double noundef %26) #3
  %28 = fmul double %22, %27
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  store double %28, ptr %29, align 8, !tbaa !9
  store i1 true, ptr %5, align 1
  br label %40

30:                                               ; preds = %16
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.HighsScatterData, ptr %31, i32 0, i32 8
  %33 = load double, ptr %32, align 8, !tbaa !24
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.HighsScatterData, ptr %34, i32 0, i32 9
  %36 = load double, ptr %35, align 8, !tbaa !25
  %37 = load double, ptr %7, align 8, !tbaa !9
  %38 = call double @llvm.fmuladd.f64(double %36, double %37, double %33)
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  store double %38, ptr %39, align 8, !tbaa !9
  store i1 true, ptr %5, align 1
  br label %40

40:                                               ; preds = %30, %19, %15
  %41 = load i1, ptr %5, align 1
  ret i1 %41
}

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 "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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !12, i64 64}
!14 = !{!"_ZTS16HighsScatterData", !15, i64 0, !15, i64 4, !15, i64 8, !16, i64 16, !16, i64 40, !12, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !15, i64 120, !15, i64 124, !15, i64 128, !15, i64 132, !15, i64 136, !15, i64 140, !15, i64 144, !15, i64 148, !15, i64 152}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTSSt6vectorIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!14, !10, i64 96}
!23 = !{!14, !10, i64 104}
!24 = !{!14, !10, i64 72}
!25 = !{!14, !10, i64 80}


; 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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local noundef zeroext i1 @_Z22predictFromScatterDataRK16HighsScatterDatadRdb(ptr nocapture noundef nonnull readonly align 8 dereferenceable(156) %0, double noundef %1, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %2, i1 noundef zeroext %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %0, i64 64
  %6 = load i8, ptr %5, align 8, !tbaa !5, !range !17, !noundef !18
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %22

8:                                                ; preds = %4
  br i1 %3, label %9, label %16

9:                                                ; preds = %8
  %10 = getelementptr inbounds i8, ptr %0, i64 96
  %11 = load double, ptr %10, align 8, !tbaa !19
  %12 = getelementptr inbounds i8, ptr %0, i64 104
  %13 = load double, ptr %12, align 8, !tbaa !20
  %14 = tail call double @pow(double noundef %1, double noundef %13) #3
  %15 = fmul double %11, %14
  br label %.sink.split

16:                                               ; preds = %8
  %17 = getelementptr inbounds i8, ptr %0, i64 72
  %18 = load double, ptr %17, align 8, !tbaa !21
  %19 = getelementptr inbounds i8, ptr %0, i64 80
  %20 = load double, ptr %19, align 8, !tbaa !22
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %1, double %18)
  br label %.sink.split

.sink.split:                                      ; preds = %9, %16
  %.sink = phi double [ %21, %16 ], [ %15, %9 ]
  store double %.sink, ptr %2, align 8, !tbaa !23
  br label %22

22:                                               ; preds = %.sink.split, %4
  ret i1 %7
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) 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 nofree nounwind willreturn memory(write) "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, !15, i64 64}
!6 = !{!"_ZTS16HighsScatterData", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 40, !15, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !7, i64 152}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIdSaIdEE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"bool", !8, i64 0}
!16 = !{!"double", !8, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!6, !16, i64 96}
!20 = !{!6, !16, i64 104}
!21 = !{!6, !16, i64 72}
!22 = !{!6, !16, i64 80}
!23 = !{!16, !16, i64 0}


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