; LLVM IR from thekyria/elabtsaot2 :: emulator_hw/hardware_model (sliceanalog)

; 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.elabtsaot::SliceAnalog" = type { double, double, %"class.elabtsaot::DAC", %"class.elabtsaot::DAC", %"class.std::vector" }
%"class.elabtsaot::DAC" = type <{ double, double, i32, i32, i32, [4 x i8], double, double, double, double, i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<elabtsaot::Atom>, std::allocator<std::vector<elabtsaot::Atom>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<elabtsaot::Atom>, std::allocator<std::vector<elabtsaot::Atom>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<elabtsaot::Atom>, std::allocator<std::vector<elabtsaot::Atom>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<elabtsaot::Atom>, std::allocator<std::vector<elabtsaot::Atom>>>::_Vector_impl_data" = type { ptr, ptr, 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
declare dso_local noundef i64 @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK9elabtsaot11SliceAnalog20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(184) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca double, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %8 = call noundef double @_ZNSt14numeric_limitsIdE3maxEv() #4
  store double %8, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !11
  br label %9

9:                                                ; preds = %52, %1
  %10 = load i32, ptr %4, align 4, !tbaa !11
  %11 = zext i32 %10 to i64
  %12 = getelementptr inbounds %"class.elabtsaot::SliceAnalog", ptr %7, i32 0, i32 4
  %13 = call noundef i64 @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  %14 = icmp ne i64 %11, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %9
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %55

16:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %48, %16
  %18 = load i32, ptr %6, align 4, !tbaa !11
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds %"class.elabtsaot::SliceAnalog", ptr %7, i32 0, i32 4
  %21 = load i32, ptr %4, align 4, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %22) #4
  %24 = call noundef i64 @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #4
  %25 = icmp ne i64 %19, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %17
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %51

27:                                               ; preds = %17
  %28 = getelementptr inbounds %"class.elabtsaot::SliceAnalog", ptr %7, i32 0, i32 4
  %29 = load i32, ptr %4, align 4, !tbaa !11
  %30 = zext i32 %29 to i64
  %31 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %30) #4
  %32 = load i32, ptr %6, align 4, !tbaa !11
  %33 = zext i32 %32 to i64
  %34 = call noundef nonnull align 8 dereferenceable(392) ptr @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %33) #4
  %35 = call noundef double @_ZNK9elabtsaot4Atom20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(392) %34)
  %36 = load double, ptr %3, align 8, !tbaa !9
  %37 = fcmp olt double %35, %36
  br i1 %37, label %38, label %47

38:                                               ; preds = %27
  %39 = getelementptr inbounds %"class.elabtsaot::SliceAnalog", ptr %7, i32 0, i32 4
  %40 = load i32, ptr %4, align 4, !tbaa !11
  %41 = zext i32 %40 to i64
  %42 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %41) #4
  %43 = load i32, ptr %6, align 4, !tbaa !11
  %44 = zext i32 %43 to i64
  %45 = call noundef nonnull align 8 dereferenceable(392) ptr @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %42, i64 noundef %44) #4
  %46 = call noundef double @_ZNK9elabtsaot4Atom20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(392) %45)
  store double %46, ptr %3, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %38, %27
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %6, align 4, !tbaa !11
  %50 = add i32 %49, 1
  store i32 %50, ptr %6, align 4, !tbaa !11
  br label %17, !llvm.loop !13

51:                                               ; preds = %26
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %4, align 4, !tbaa !11
  %54 = add i32 %53, 1
  store i32 %54, ptr %4, align 4, !tbaa !11
  br label %9, !llvm.loop !15

55:                                               ; preds = %15
  %56 = load double, ptr %3, align 8, !tbaa !9
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret double %56
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE3maxEv() #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(392) ptr @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

declare noundef double @_ZNK9elabtsaot4Atom20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(392)) #3

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 = { 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 #3 = { "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 #4 = { 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 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK9elabtsaot11SliceAnalog20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(184) %0) local_unnamed_addr #1 align 2 {
  %2 = tail call noundef double @_ZNSt14numeric_limitsIdE3maxEv() #3
  %3 = getelementptr inbounds i8, ptr %0, i64 160
  %4 = tail call noundef i64 @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %.not19 = icmp eq i64 %4, 0
  br i1 %.not19, label %._crit_edge22, label %.preheader

.preheader:                                       ; preds = %1, %._crit_edge
  %5 = phi i64 [ %9, %._crit_edge ], [ 0, %1 ]
  %.01121 = phi i32 [ %8, %._crit_edge ], [ 0, %1 ]
  %.01220 = phi double [ %.1.lcssa, %._crit_edge ], [ %2, %1 ]
  %6 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %5) #3
  %7 = tail call noundef i64 @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %.not1516 = icmp eq i64 %7, 0
  br i1 %.not1516, label %._crit_edge, label %.lr.ph

._crit_edge22:                                    ; preds = %._crit_edge, %1
  %.012.lcssa = phi double [ %2, %1 ], [ %.1.lcssa, %._crit_edge ]
  ret double %.012.lcssa

._crit_edge:                                      ; preds = %20, %.preheader
  %.1.lcssa = phi double [ %.01220, %.preheader ], [ %.2, %20 ]
  %8 = add i32 %.01121, 1
  %9 = zext i32 %8 to i64
  %10 = tail call noundef i64 @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %.not = icmp eq i64 %10, %9
  br i1 %.not, label %._crit_edge22, label %.preheader, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %20
  %11 = phi i64 [ %22, %20 ], [ 0, %.preheader ]
  %.018 = phi i32 [ %21, %20 ], [ 0, %.preheader ]
  %.117 = phi double [ %.2, %20 ], [ %.01220, %.preheader ]
  %12 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %5) #3
  %13 = tail call noundef nonnull align 8 dereferenceable(392) ptr @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %11) #3
  %14 = tail call noundef double @_ZNK9elabtsaot4Atom20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(392) %13)
  %15 = fcmp olt double %14, %.117
  br i1 %15, label %16, label %20

16:                                               ; preds = %.lr.ph
  %17 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %5) #3
  %18 = tail call noundef nonnull align 8 dereferenceable(392) ptr @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %11) #3
  %19 = tail call noundef double @_ZNK9elabtsaot4Atom20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(392) %18)
  br label %20

20:                                               ; preds = %.lr.ph, %16
  %.2 = phi double [ %19, %16 ], [ %.117, %.lr.ph ]
  %21 = add i32 %.018, 1
  %22 = zext i32 %21 to i64
  %23 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_IN9elabtsaot4AtomESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %5) #3
  %24 = tail call noundef i64 @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #3
  %.not15 = icmp eq i64 %24, %22
  br i1 %.not15, label %._crit_edge, label %.lr.ph, !llvm.loop !7
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE3maxEv() local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(392) ptr @_ZNKSt6vectorIN9elabtsaot4AtomESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

declare noundef double @_ZNK9elabtsaot4Atom20getMinMaxAchievableREv(ptr noundef nonnull align 8 dereferenceable(392)) local_unnamed_addr #2

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" }
attributes #2 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


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