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

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

; 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 noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN3vcl11timer_event6updateEv(ptr noundef nonnull align 4 dereferenceable(28) %0) #1 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  %5 = call noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16) %4)
  store float %5, ptr %3, align 4, !tbaa !9
  %6 = load float, ptr %3, align 4, !tbaa !9
  %7 = getelementptr inbounds %"class.vcl::timer_event", ptr %4, i32 0, i32 3
  %8 = load float, ptr %7, align 4, !tbaa !11
  %9 = fadd float %8, %6
  store float %9, ptr %7, align 4, !tbaa !11
  %10 = getelementptr inbounds %"class.vcl::timer_event", ptr %4, i32 0, i32 3
  %11 = load float, ptr %10, align 4, !tbaa !11
  %12 = getelementptr inbounds %"class.vcl::timer_event", ptr %4, i32 0, i32 2
  %13 = load float, ptr %12, align 4, !tbaa !15
  %14 = fcmp ogt float %11, %13
  br i1 %14, label %15, label %18

15:                                               ; preds = %1
  %16 = getelementptr inbounds %"class.vcl::timer_event", ptr %4, i32 0, i32 1
  store i8 1, ptr %16, align 4, !tbaa !16
  %17 = getelementptr inbounds %"class.vcl::timer_event", ptr %4, i32 0, i32 3
  store float 0.000000e+00, ptr %17, align 4, !tbaa !11
  br label %20

18:                                               ; preds = %1
  %19 = getelementptr inbounds %"class.vcl::timer_event", ptr %4, i32 0, i32 1
  store i8 0, ptr %19, align 4, !tbaa !16
  br label %20

20:                                               ; preds = %18, %15
  %21 = load float, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret float %21
}

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 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTSN3vcl11timer_eventE", !13, i64 0, !14, i64 16, !10, i64 20, !10, i64 24}
!13 = !{!"_ZTSN3vcl11timer_basicE", !10, i64 0, !10, i64 4, !14, i64 8, !10, i64 12}
!14 = !{!"bool", !7, i64 0}
!15 = !{!12, !10, i64 20}
!16 = !{!12, !14, i64 16}


; 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 noundef float @_ZN3vcl11timer_basic6updateEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #0 align 2

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

9:                                                ; preds = %1
  store float 0.000000e+00, ptr %3, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %1, %9
  %.sink = phi i8 [ 1, %9 ], [ 0, %1 ]
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  store i8 %.sink, ptr %11, align 4
  ret float %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" }

!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 24}
!6 = !{!"_ZTSN3vcl11timer_eventE", !7, i64 0, !11, i64 16, !8, i64 20, !8, i64 24}
!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 20}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,ReassociatePass,SROAPass,TailCallElimPass