; LLVM IR from chriskiefer/libcccrt :: benchmarks/maximilian.ll (ZN10maxiSample9playUntilEd)

; 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.maxiSample = type { double, double, double, double, %class.maxiLagExp, i16, i32, i16, [6 x i8], %class.maxiTrigger, %"class.std::vector", %"class.std::__cxx11::basic_string", i32, i32, i32, i16, i32, i16, i8, double }
%class.maxiLagExp = type { double, double, double }
%class.maxiTrigger = type <{ double, i8, [7 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN10maxiSample9playUntilEd(ptr noundef nonnull align 8 dereferenceable(176) %0, double noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 0
  %7 = load double, ptr %6, align 8, !tbaa !11
  %8 = fadd double %7, 1.000000e+00
  store double %8, ptr %6, align 8, !tbaa !11
  %9 = load double, ptr %4, align 8, !tbaa !9
  %10 = fcmp ogt double %9, 1.000000e+00
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  store double 1.000000e+00, ptr %4, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %11, %2
  %13 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 0
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = fptosi double %14 to i64
  %16 = sitofp i64 %15 to double
  %17 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 10
  %18 = call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #1
  %19 = uitofp i64 %18 to double
  %20 = load double, ptr %4, align 8, !tbaa !9
  %21 = fmul double %19, %20
  %22 = fcmp olt double %16, %21
  br i1 %22, label %23, label %31

23:                                               ; preds = %12
  %24 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 10
  %25 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 0
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = fptosi double %26 to i64
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %27) #1
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 3
  store double %29, ptr %30, align 8, !tbaa !25
  br label %33

31:                                               ; preds = %12
  %32 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 3
  store double 0.000000e+00, ptr %32, align 8, !tbaa !25
  br label %33

33:                                               ; preds = %31, %23
  %34 = getelementptr inbounds %class.maxiSample, ptr %5, i32 0, i32 3
  %35 = load double, ptr %34, align 8, !tbaa !25
  ret double %35
}

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 = { 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, !10, i64 0}
!12 = !{!"_ZTS10maxiSample", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !13, i64 32, !14, i64 56, !15, i64 60, !14, i64 64, !16, i64 72, !18, i64 88, !22, i64 112, !15, i64 144, !15, i64 148, !15, i64 152, !14, i64 156, !15, i64 160, !14, i64 164, !17, i64 166, !10, i64 168}
!13 = !{!"_ZTS10maxiLagExpIdE", !10, i64 0, !10, i64 8, !10, i64 16}
!14 = !{!"short", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTS11maxiTrigger", !10, i64 0, !17, i64 8}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIdSaIdEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !24, i64 8, !7, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!12, !10, i64 24}


; 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 nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN10maxiSample9playUntilEd(ptr noundef nonnull align 8 dereferenceable(176) %0, double noundef %1) local_unnamed_addr #0 align 2 {
  %3 = load double, ptr %0, align 8, !tbaa !5
  %4 = fadd double %3, 1.000000e+00
  store double %4, ptr %0, align 8, !tbaa !5
  %5 = fcmp ogt double %1, 1.000000e+00
  %.0 = select i1 %5, double 1.000000e+00, double %1
  %6 = fptosi double %4 to i64
  %7 = sitofp i64 %6 to double
  %8 = getelementptr inbounds i8, ptr %0, i64 88
  %9 = tail call noundef i64 @_ZNKSt6vectorIdSaIdEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #1
  %10 = uitofp i64 %9 to double
  %11 = fmul double %.0, %10
  %12 = fcmp ogt double %11, %7
  br i1 %12, label %13, label %18

13:                                               ; preds = %2
  %14 = load double, ptr %0, align 8, !tbaa !5
  %15 = fptosi double %14 to i64
  %16 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %15) #1
  %17 = load double, ptr %16, align 8, !tbaa !23
  br label %18

18:                                               ; preds = %2, %13
  %.sink = phi double [ %17, %13 ], [ 0.000000e+00, %2 ]
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  store double %.sink, ptr %19, align 8
  ret double %.sink
}

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 = { 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, !7, i64 0}
!6 = !{!"_ZTS10maxiSample", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 56, !12, i64 60, !11, i64 64, !13, i64 72, !15, i64 88, !20, i64 112, !12, i64 144, !12, i64 148, !12, i64 152, !11, i64 156, !12, i64 160, !11, i64 164, !14, i64 166, !7, i64 168}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS10maxiLagExpIdE", !7, i64 0, !7, i64 8, !7, i64 16}
!11 = !{!"short", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_ZTS11maxiTrigger", !7, i64 0, !14, i64 8}
!14 = !{!"bool", !8, i64 0}
!15 = !{!"_ZTSSt6vectorIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"any pointer", !8, i64 0}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !21, i64 0, !22, i64 8, !8, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !19, i64 0}
!22 = !{!"long", !8, i64 0}
!23 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,SROAPass,SimplifyCFGPass,TailCallElimPass