; LLVM IR from yangfengzzz/DigitalVox3 :: vox.render/runtime/animator_controller.ll (ZN3vox18AnimatorController14set_time_ratioEf)

; 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.vox::AnimatorController" = type <{ float, float, float, i8, i8, [2 x i8] }>

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3vox18AnimatorController14set_time_ratioEf(ptr noundef nonnull align 4 dereferenceable(14) %0, float noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.vox::AnimatorController", ptr %5, i32 0, i32 0
  %7 = load float, ptr %6, align 4, !tbaa !11
  %8 = getelementptr inbounds %"class.vox::AnimatorController", ptr %5, i32 0, i32 1
  store float %7, ptr %8, align 4, !tbaa !14
  %9 = getelementptr inbounds %"class.vox::AnimatorController", ptr %5, i32 0, i32 4
  %10 = load i8, ptr %9, align 1, !tbaa !15, !range !16, !noundef !17
  %11 = trunc i8 %10 to i1
  br i1 %11, label %12, label %18

12:                                               ; preds = %2
  %13 = load float, ptr %4, align 4, !tbaa !9
  %14 = load float, ptr %4, align 4, !tbaa !9
  %15 = call float @llvm.floor.f32(float %14)
  %16 = fsub float %13, %15
  %17 = getelementptr inbounds %"class.vox::AnimatorController", ptr %5, i32 0, i32 0
  store float %16, ptr %17, align 4, !tbaa !11
  br label %22

18:                                               ; preds = %2
  %19 = load float, ptr %4, align 4, !tbaa !9
  %20 = call noundef float @_ZN3vox4math5ClampIfEET_S2_S2_S2_(float noundef 0.000000e+00, float noundef %19, float noundef 1.000000e+00)
  %21 = getelementptr inbounds %"class.vox::AnimatorController", ptr %5, i32 0, i32 0
  store float %20, ptr %21, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %18, %12
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.floor.f32(float) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3vox4math5ClampIfEET_S2_S2_S2_(float noundef, float noundef, float noundef) #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" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { alwaysinline 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" }

!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 0}
!12 = !{!"_ZTSN3vox18AnimatorControllerE", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 12, !13, i64 13}
!13 = !{!"bool", !7, i64 0}
!14 = !{!12, !10, i64 4}
!15 = !{!12, !13, i64 13}
!16 = !{i8 0, i8 2}
!17 = !{}


; 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
define dso_local void @_ZN3vox18AnimatorController14set_time_ratioEf(ptr nocapture noundef nonnull align 4 dereferenceable(14) %0, float noundef %1) local_unnamed_addr #0 align 2 {
  %3 = load float, ptr %0, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 4
  store float %3, ptr %4, align 4, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %0, i64 13
  %6 = load i8, ptr %5, align 1, !tbaa !12, !range !13, !noundef !14
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %11

8:                                                ; preds = %2
  %9 = tail call float @llvm.floor.f32(float %1)
  %10 = fsub float %1, %9
  br label %13

11:                                               ; preds = %2
  %12 = tail call noundef float @_ZN3vox4math5ClampIfEET_S2_S2_S2_(float noundef 0.000000e+00, float noundef %1, float noundef 1.000000e+00)
  br label %13

13:                                               ; preds = %11, %8
  %storemerge = phi float [ %12, %11 ], [ %10, %8 ]
  store float %storemerge, ptr %0, align 4, !tbaa !5
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.floor.f32(float) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3vox4math5ClampIfEET_S2_S2_S2_(float noundef, float noundef, float noundef) 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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { alwaysinline 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" }

!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 = !{!"_ZTSN3vox18AnimatorControllerE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12, !10, i64 13}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !10, i64 13}
!13 = !{i8 0, i8 2}
!14 = !{}


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