; LLVM IR from goldest-star/seawave-animation :: src/vcl/interaction/time_slider/time_slider.ll (ZN3vcl14timer_interval6updateEv)

; 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.vcl::timer_interval" = type { %"class.vcl::timer_basic", float, float }
%"class.vcl::timer_basic" = type { float, float, i8, float }

@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vcl14timer_interval6updateEv = external hidden unnamed_addr constant [36 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN3vcl14timer_interval6updateEv(ptr noundef nonnull align 4 dereferenceable(24) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 2
  %6 = load float, ptr %5, align 4, !tbaa !9
  %7 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 1
  %8 = load float, ptr %7, align 4, !tbaa !14
  %9 = fcmp ogt float %6, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  br label %13

11:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 50, ptr noundef @__PRETTY_FUNCTION__._ZN3vcl14timer_interval6updateEv) #3
  unreachable

12:                                               ; No predecessors!
  br label %13

13:                                               ; preds = %12, %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %14 = call noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16) %4)
  store float %14, ptr %3, align 4, !tbaa !15
  %15 = load float, ptr %3, align 4, !tbaa !15
  %16 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 2
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 1
  %19 = load float, ptr %18, align 4, !tbaa !14
  %20 = fsub float %17, %19
  %21 = fcmp ogt float %15, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %13
  store float 0.000000e+00, ptr %3, align 4, !tbaa !15
  br label %23

23:                                               ; preds = %22, %13
  br label %24

24:                                               ; preds = %30, %23
  %25 = getelementptr inbounds %"class.vcl::timer_basic", ptr %4, i32 0, i32 0
  %26 = load float, ptr %25, align 4, !tbaa !16
  %27 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 2
  %28 = load float, ptr %27, align 4, !tbaa !9
  %29 = fcmp oge float %26, %28
  br i1 %29, label %30, label %39

30:                                               ; preds = %24
  %31 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 2
  %32 = load float, ptr %31, align 4, !tbaa !9
  %33 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 1
  %34 = load float, ptr %33, align 4, !tbaa !14
  %35 = fsub float %32, %34
  %36 = getelementptr inbounds %"class.vcl::timer_basic", ptr %4, i32 0, i32 0
  %37 = load float, ptr %36, align 4, !tbaa !16
  %38 = fsub float %37, %35
  store float %38, ptr %36, align 4, !tbaa !16
  br label %24, !llvm.loop !17

39:                                               ; preds = %24
  %40 = getelementptr inbounds %"class.vcl::timer_basic", ptr %4, i32 0, i32 0
  %41 = load float, ptr %40, align 4, !tbaa !16
  %42 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 1
  %43 = load float, ptr %42, align 4, !tbaa !14
  %44 = fcmp oge float %41, %43
  br i1 %44, label %45, label %51

45:                                               ; preds = %39
  %46 = getelementptr inbounds %"class.vcl::timer_basic", ptr %4, i32 0, i32 0
  %47 = load float, ptr %46, align 4, !tbaa !16
  %48 = getelementptr inbounds %"class.vcl::timer_interval", ptr %4, i32 0, i32 2
  %49 = load float, ptr %48, align 4, !tbaa !9
  %50 = fcmp olt float %47, %49
  br label %51

51:                                               ; preds = %45, %39
  %52 = phi i1 [ false, %39 ], [ %50, %45 ]
  br i1 %52, label %53, label %54

53:                                               ; preds = %51
  br label %56

54:                                               ; preds = %51
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 59, ptr noundef @__PRETTY_FUNCTION__._ZN3vcl14timer_interval6updateEv) #3
  unreachable

55:                                               ; No predecessors!
  br label %56

56:                                               ; preds = %55, %53
  %57 = load float, ptr %3, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret float %57
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16)) #2 align 2

attributes #0 = { noreturn 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { noreturn nounwind }
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, !12, i64 20}
!10 = !{!"_ZTSN3vcl14timer_intervalE", !11, i64 0, !12, i64 16, !12, i64 20}
!11 = !{!"_ZTSN3vcl11timer_basicE", !12, i64 0, !12, i64 4, !13, i64 8, !12, i64 12}
!12 = !{!"float", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!10, !12, i64 16}
!15 = !{!12, !12, i64 0}
!16 = !{!11, !12, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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

@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vcl14timer_interval6updateEv = external hidden unnamed_addr constant [36 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN3vcl14timer_interval6updateEv(ptr noundef nonnull align 4 dereferenceable(24) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 20
  %3 = load float, ptr %2, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load float, ptr %4, align 4, !tbaa !12
  %6 = fcmp ogt float %3, %5
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 50, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vcl14timer_interval6updateEv) #2
  unreachable

8:                                                ; preds = %1
  %9 = tail call noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16) %0)
  %10 = load float, ptr %2, align 4, !tbaa !5
  %11 = load float, ptr %4, align 4, !tbaa !12
  %12 = fsub float %10, %11
  %.promoted = load float, ptr %0, align 4, !tbaa !13
  %13 = fcmp ult float %.promoted, %10
  br i1 %13, label %17, label %.lr.ph

.lr.ph:                                           ; preds = %8, %.lr.ph
  %14 = phi float [ %15, %.lr.ph ], [ %.promoted, %8 ]
  %15 = fsub float %14, %12
  %16 = fcmp ult float %15, %10
  br i1 %16, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph
  store float %15, ptr %0, align 4, !tbaa !13
  br label %17

17:                                               ; preds = %._crit_edge, %8
  %.lcssa = phi float [ %15, %._crit_edge ], [ %.promoted, %8 ]
  %18 = fcmp oge float %.lcssa, %11
  %19 = fcmp olt float %.lcssa, %10
  %or.cond = and i1 %18, %19
  br i1 %or.cond, label %20, label %.critedge

.critedge:                                        ; preds = %17
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 59, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vcl14timer_interval6updateEv) #2
  unreachable

20:                                               ; preds = %17
  %21 = fcmp ogt float %9, %12
  %.0 = select i1 %21, float 0.000000e+00, float %9
  ret float %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #1 align 2

attributes #0 = { noreturn 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 #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 = { noreturn 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, !8, i64 20}
!6 = !{!"_ZTSN3vcl14timer_intervalE", !7, i64 0, !8, i64 16, !8, i64 20}
!7 = !{!"_ZTSN3vcl11timer_basicE", !8, i64 0, !8, i64 4, !11, i64 8, !8, i64 12}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!6, !8, i64 16}
!13 = !{!7, !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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