; LLVM IR from jrouwe/JoltPhysics :: TestFramework/UI/UIAnimationSlide.ll (ZN16UIAnimationSlide6UpdateEP9UIElementf)

; 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.UIAnimationSlide = type { %class.UIAnimation, i32, i32, i32, float, float, i32, i32, i32, i32, float }
%class.UIAnimation = type { 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 uwtable
define dso_local noundef zeroext i1 @_ZN16UIAnimationSlide6UpdateEP9UIElementf(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, float noundef %2) unnamed_addr #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store float %2, ptr %7, align 4, !tbaa !9
  %12 = load ptr, ptr %5, align 8
  %13 = load float, ptr %7, align 4, !tbaa !9
  %14 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 10
  %15 = load float, ptr %14, align 4, !tbaa !11
  %16 = fadd float %15, %13
  store float %16, ptr %14, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %17 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 10
  %18 = load float, ptr %17, align 4, !tbaa !11
  %19 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 4
  %20 = load float, ptr %19, align 4, !tbaa !16
  %21 = fsub float %18, %20
  %22 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 5
  %23 = load float, ptr %22, align 8, !tbaa !17
  %24 = fdiv float %21, %23
  store float %24, ptr %8, align 4, !tbaa !9
  %25 = load float, ptr %8, align 4, !tbaa !9
  %26 = fcmp oge float %25, 1.000000e+00
  br i1 %26, label %27, label %28

27:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %68

28:                                               ; preds = %3
  %29 = load float, ptr %8, align 4, !tbaa !9
  %30 = fcmp olt float %29, 0.000000e+00
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store float 0.000000e+00, ptr %8, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %31, %28
  %33 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !18
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %39

36:                                               ; preds = %32
  %37 = load float, ptr %8, align 4, !tbaa !9
  %38 = fsub float 1.000000e+00, %37
  store float %38, ptr %8, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %36, %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %40 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 6
  %41 = load i32, ptr %40, align 4, !tbaa !19
  %42 = sitofp i32 %41 to float
  %43 = load float, ptr %8, align 4, !tbaa !9
  %44 = fsub float 1.000000e+00, %43
  %45 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 8
  %46 = load i32, ptr %45, align 4, !tbaa !20
  %47 = sitofp i32 %46 to float
  %48 = load float, ptr %8, align 4, !tbaa !9
  %49 = fmul float %47, %48
  %50 = call float @llvm.fmuladd.f32(float %42, float %44, float %49)
  store float %50, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %51 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 7
  %52 = load i32, ptr %51, align 8, !tbaa !21
  %53 = sitofp i32 %52 to float
  %54 = load float, ptr %8, align 4, !tbaa !9
  %55 = fsub float 1.000000e+00, %54
  %56 = getelementptr inbounds %class.UIAnimationSlide, ptr %12, i32 0, i32 9
  %57 = load i32, ptr %56, align 8, !tbaa !22
  %58 = sitofp i32 %57 to float
  %59 = load float, ptr %8, align 4, !tbaa !9
  %60 = fmul float %58, %59
  %61 = call float @llvm.fmuladd.f32(float %53, float %55, float %60)
  store float %61, ptr %11, align 4, !tbaa !9
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load float, ptr %10, align 4, !tbaa !9
  %64 = fptosi float %63 to i32
  call void @_ZN9UIElement12SetRelativeXEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144) %62, i32 noundef %64, i32 noundef 0, i32 noundef 0)
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load float, ptr %11, align 4, !tbaa !9
  %67 = fptosi float %66 to i32
  call void @_ZN9UIElement12SetRelativeYEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144) %65, i32 noundef %67, i32 noundef 0, i32 noundef 0)
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %68

68:                                               ; preds = %39, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %69 = load i1, ptr %4, align 1
  ret i1 %69
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UIElement12SetRelativeXEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UIElement12SetRelativeYEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, i32 noundef, i32 noundef) #1 align 2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!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 44}
!12 = !{!"_ZTS16UIAnimationSlide", !13, i64 0, !14, i64 8, !15, i64 12, !15, i64 16, !10, i64 20, !10, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !10, i64 44}
!13 = !{!"_ZTS11UIAnimation"}
!14 = !{!"_ZTSN16UIAnimationSlide5EModeE", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!12, !10, i64 20}
!17 = !{!12, !10, i64 24}
!18 = !{!12, !14, i64 8}
!19 = !{!12, !15, i64 28}
!20 = !{!12, !15, i64 36}
!21 = !{!12, !15, i64 32}
!22 = !{!12, !15, i64 40}


; 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
define dso_local noundef zeroext i1 @_ZN16UIAnimationSlide6UpdateEP9UIElementf(ptr nocapture noundef nonnull align 8 dereferenceable(48) %0, ptr noundef %1, float noundef %2) unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 44
  %5 = load float, ptr %4, align 4, !tbaa !5
  %6 = fadd float %5, %2
  store float %6, ptr %4, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 20
  %8 = load float, ptr %7, align 4, !tbaa !13
  %9 = fsub float %6, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load float, ptr %10, align 8, !tbaa !14
  %12 = fdiv float %9, %11
  %13 = fcmp ult float %12, 1.000000e+00
  br i1 %13, label %14, label %39

14:                                               ; preds = %3
  %15 = fcmp olt float %12, 0.000000e+00
  %.014 = select i1 %15, float 0.000000e+00, float %12
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !15
  %18 = icmp eq i32 %17, 1
  %19 = fsub float 1.000000e+00, %.014
  %.1 = select i1 %18, float %19, float %.014
  %20 = getelementptr inbounds i8, ptr %0, i64 28
  %21 = load i32, ptr %20, align 4, !tbaa !16
  %22 = sitofp i32 %21 to float
  %23 = fsub float 1.000000e+00, %.1
  %24 = getelementptr inbounds i8, ptr %0, i64 36
  %25 = load i32, ptr %24, align 4, !tbaa !17
  %26 = sitofp i32 %25 to float
  %27 = fmul float %.1, %26
  %28 = tail call float @llvm.fmuladd.f32(float %22, float %23, float %27)
  %29 = getelementptr inbounds i8, ptr %0, i64 32
  %30 = load i32, ptr %29, align 8, !tbaa !18
  %31 = sitofp i32 %30 to float
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = sitofp i32 %33 to float
  %35 = fmul float %.1, %34
  %36 = tail call float @llvm.fmuladd.f32(float %31, float %23, float %35)
  %37 = fptosi float %28 to i32
  tail call void @_ZN9UIElement12SetRelativeXEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144) %1, i32 noundef %37, i32 noundef 0, i32 noundef 0)
  %38 = fptosi float %36 to i32
  tail call void @_ZN9UIElement12SetRelativeYEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144) %1, i32 noundef %38, i32 noundef 0, i32 noundef 0)
  br label %39

39:                                               ; preds = %3, %14
  ret i1 %13
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UIElement12SetRelativeXEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UIElement12SetRelativeYEiNS_6EUnitsENS_10EAlignmentE(ptr noundef nonnull align 8 dereferenceable(144), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !12, i64 44}
!6 = !{!"_ZTS16UIAnimationSlide", !7, i64 0, !8, i64 8, !11, i64 12, !11, i64 16, !12, i64 20, !12, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !12, i64 44}
!7 = !{!"_ZTS11UIAnimation"}
!8 = !{!"_ZTSN16UIAnimationSlide5EModeE", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"float", !9, i64 0}
!13 = !{!6, !12, i64 20}
!14 = !{!6, !12, i64 24}
!15 = !{!6, !8, i64 8}
!16 = !{!6, !11, i64 28}
!17 = !{!6, !11, i64 36}
!18 = !{!6, !11, i64 32}
!19 = !{!6, !11, i64 40}


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