; LLVM IR from VTIvanov20/eight-ball-pool :: src/table.ll (ZN5Stick15GetCurrentForceEv)

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

%struct.Vector2 = type { float, float }
%class.Stick = type <{ %class.Sprite, %struct.Vector2, float, i8, [3 x i8] }>
%class.Sprite = type { %"class.DrawableManager::Drawable.base", %struct.Vector2, %struct.Texture, float, float }
%"class.DrawableManager::Drawable.base" = type <{ ptr, i32 }>
%struct.Texture = type { i32, i32, i32, i32, i32 }

; 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 nounwind uwtable
define dso_local <2 x float> @_ZN5Stick15GetCurrentForceEv(ptr noundef nonnull align 8 dereferenceable(61) %0) #1 align 2 {
  %2 = alloca %struct.Vector2, align 4
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  %8 = getelementptr inbounds %class.Stick, ptr %7, i32 0, i32 2
  %9 = load float, ptr %8, align 8, !tbaa !9
  %10 = fdiv float %9, 3.000000e+01
  store float %10, ptr %4, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %11 = getelementptr inbounds %class.Stick, ptr %7, i32 0, i32 2
  %12 = load float, ptr %11, align 8, !tbaa !9
  %13 = fmul float %12, 5.000000e+01
  %14 = load float, ptr %4, align 4, !tbaa !18
  %15 = fmul float %13, %14
  store float %15, ptr %5, align 4, !tbaa !18
  %16 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %17 = load float, ptr %16, align 4, !tbaa !19
  %18 = fcmp olt float %17, 9.000000e+01
  br i1 %18, label %19, label %34

19:                                               ; preds = %1
  %20 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 0
  %21 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %22 = load float, ptr %21, align 4, !tbaa !19
  %23 = fsub float %22, 9.000000e+01
  %24 = fdiv float %23, 9.000000e+01
  %25 = load float, ptr %5, align 4, !tbaa !18
  %26 = fmul float %24, %25
  store float %26, ptr %20, align 4, !tbaa !20
  %27 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 1
  %28 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %29 = load float, ptr %28, align 4, !tbaa !19
  %30 = fdiv float %29, 9.000000e+01
  %31 = load float, ptr %5, align 4, !tbaa !18
  %32 = fneg float %31
  %33 = fmul float %30, %32
  store float %33, ptr %27, align 4, !tbaa !21
  store i32 1, ptr %6, align 4
  br label %105

34:                                               ; preds = %1
  %35 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %36 = load float, ptr %35, align 4, !tbaa !19
  %37 = fcmp oge float %36, 9.000000e+01
  br i1 %37, label %38, label %57

38:                                               ; preds = %34
  %39 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %40 = load float, ptr %39, align 4, !tbaa !19
  %41 = fcmp olt float %40, 1.800000e+02
  br i1 %41, label %42, label %57

42:                                               ; preds = %38
  %43 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 0
  %44 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %45 = load float, ptr %44, align 4, !tbaa !19
  %46 = fsub float %45, 9.000000e+01
  %47 = fdiv float %46, 9.000000e+01
  %48 = load float, ptr %5, align 4, !tbaa !18
  %49 = fmul float %47, %48
  store float %49, ptr %43, align 4, !tbaa !20
  %50 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 1
  %51 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %52 = load float, ptr %51, align 4, !tbaa !19
  %53 = fsub float %52, 1.800000e+02
  %54 = fdiv float %53, 9.000000e+01
  %55 = load float, ptr %5, align 4, !tbaa !18
  %56 = fmul float %54, %55
  store float %56, ptr %50, align 4, !tbaa !21
  store i32 1, ptr %6, align 4
  br label %105

57:                                               ; preds = %38, %34
  %58 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %59 = load float, ptr %58, align 4, !tbaa !19
  %60 = fcmp oge float %59, 1.800000e+02
  br i1 %60, label %61, label %81

61:                                               ; preds = %57
  %62 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %63 = load float, ptr %62, align 4, !tbaa !19
  %64 = fcmp olt float %63, 2.700000e+02
  br i1 %64, label %65, label %81

65:                                               ; preds = %61
  %66 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 0
  %67 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %68 = load float, ptr %67, align 4, !tbaa !19
  %69 = fsub float %68, 1.800000e+02
  %70 = fsub float 9.000000e+01, %69
  %71 = fdiv float %70, 9.000000e+01
  %72 = load float, ptr %5, align 4, !tbaa !18
  %73 = fmul float %71, %72
  store float %73, ptr %66, align 4, !tbaa !20
  %74 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 1
  %75 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %76 = load float, ptr %75, align 4, !tbaa !19
  %77 = fsub float %76, 1.800000e+02
  %78 = fdiv float %77, 9.000000e+01
  %79 = load float, ptr %5, align 4, !tbaa !18
  %80 = fmul float %78, %79
  store float %80, ptr %74, align 4, !tbaa !21
  store i32 1, ptr %6, align 4
  br label %105

81:                                               ; preds = %61, %57
  %82 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %83 = load float, ptr %82, align 4, !tbaa !19
  %84 = fcmp oge float %83, 2.700000e+02
  br i1 %84, label %85, label %102

85:                                               ; preds = %81
  %86 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 0
  %87 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %88 = load float, ptr %87, align 4, !tbaa !19
  %89 = fsub float %88, 1.800000e+02
  %90 = fsub float 9.000000e+01, %89
  %91 = fdiv float %90, 9.000000e+01
  %92 = load float, ptr %5, align 4, !tbaa !18
  %93 = fmul float %91, %92
  store float %93, ptr %86, align 4, !tbaa !20
  %94 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 1
  %95 = getelementptr inbounds %class.Sprite, ptr %7, i32 0, i32 4
  %96 = load float, ptr %95, align 4, !tbaa !19
  %97 = fsub float %96, 2.700000e+02
  %98 = fsub float 9.000000e+01, %97
  %99 = fdiv float %98, 9.000000e+01
  %100 = load float, ptr %5, align 4, !tbaa !18
  %101 = fmul float %99, %100
  store float %101, ptr %94, align 4, !tbaa !21
  store i32 1, ptr %6, align 4
  br label %105

102:                                              ; preds = %81
  %103 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 0
  store float 0.000000e+00, ptr %103, align 4, !tbaa !20
  %104 = getelementptr inbounds %struct.Vector2, ptr %2, i32 0, i32 1
  store float 0.000000e+00, ptr %104, align 4, !tbaa !21
  store i32 1, ptr %6, align 4
  br label %105

105:                                              ; preds = %102, %85, %65, %42, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  %106 = load <2 x float>, ptr %2, align 4
  ret <2 x float> %106
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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, !15, i64 56}
!10 = !{!"_ZTS5Stick", !11, i64 0, !14, i64 48, !15, i64 56, !17, i64 60}
!11 = !{!"_ZTS6Sprite", !12, i64 0, !14, i64 12, !16, i64 20, !15, i64 40, !15, i64 44}
!12 = !{!"_ZTSN15DrawableManager8DrawableE", !13, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS7Vector2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTS7Texture", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16}
!17 = !{!"bool", !7, i64 0}
!18 = !{!15, !15, i64 0}
!19 = !{!11, !15, i64 44}
!20 = !{!14, !15, i64 0}
!21 = !{!14, !15, i64 4}


; 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 nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local <2 x float> @_ZN5Stick15GetCurrentForceEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(61) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 56
  %3 = load float, ptr %2, align 8, !tbaa !5
  %4 = fdiv float %3, 3.000000e+01
  %5 = fmul float %3, 5.000000e+01
  %6 = fmul float %5, %4
  %7 = getelementptr inbounds i8, ptr %0, i64 44
  %8 = load float, ptr %7, align 4, !tbaa !16
  %9 = fcmp olt float %8, 9.000000e+01
  br i1 %9, label %10, label %19

10:                                               ; preds = %1
  %11 = fadd float %8, -9.000000e+01
  %12 = fneg float %6
  %13 = insertelement <2 x float> poison, float %11, i64 0
  %14 = insertelement <2 x float> %13, float %8, i64 1
  %15 = fdiv <2 x float> %14, <float 9.000000e+01, float 9.000000e+01>
  %16 = insertelement <2 x float> poison, float %6, i64 0
  %17 = insertelement <2 x float> %16, float %12, i64 1
  %18 = fmul <2 x float> %17, %15
  br label %53

19:                                               ; preds = %1
  %20 = fcmp oge float %8, 9.000000e+01
  %21 = fcmp olt float %8, 1.800000e+02
  %or.cond = and i1 %20, %21
  br i1 %or.cond, label %22, label %30

22:                                               ; preds = %19
  %23 = insertelement <2 x float> poison, float %8, i64 0
  %24 = shufflevector <2 x float> %23, <2 x float> poison, <2 x i32> zeroinitializer
  %25 = fadd <2 x float> %24, <float -9.000000e+01, float -1.800000e+02>
  %26 = fdiv <2 x float> %25, <float 9.000000e+01, float 9.000000e+01>
  %27 = insertelement <2 x float> poison, float %6, i64 0
  %28 = shufflevector <2 x float> %27, <2 x float> poison, <2 x i32> zeroinitializer
  %29 = fmul <2 x float> %28, %26
  br label %53

30:                                               ; preds = %19
  %31 = fcmp oge float %8, 1.800000e+02
  %32 = fcmp olt float %8, 2.700000e+02
  %or.cond29 = and i1 %31, %32
  br i1 %or.cond29, label %33, label %42

33:                                               ; preds = %30
  %34 = fadd float %8, -1.800000e+02
  %35 = fsub float 9.000000e+01, %34
  %36 = insertelement <2 x float> poison, float %35, i64 0
  %37 = insertelement <2 x float> %36, float %34, i64 1
  %38 = fdiv <2 x float> %37, <float 9.000000e+01, float 9.000000e+01>
  %39 = insertelement <2 x float> poison, float %6, i64 0
  %40 = shufflevector <2 x float> %39, <2 x float> poison, <2 x i32> zeroinitializer
  %41 = fmul <2 x float> %40, %38
  br label %53

42:                                               ; preds = %30
  %43 = fcmp ult float %8, 2.700000e+02
  br i1 %43, label %53, label %44

44:                                               ; preds = %42
  %45 = insertelement <2 x float> poison, float %8, i64 0
  %46 = shufflevector <2 x float> %45, <2 x float> poison, <2 x i32> zeroinitializer
  %47 = fadd <2 x float> %46, <float -1.800000e+02, float -2.700000e+02>
  %48 = fsub <2 x float> <float 9.000000e+01, float 9.000000e+01>, %47
  %49 = fdiv <2 x float> %48, <float 9.000000e+01, float 9.000000e+01>
  %50 = insertelement <2 x float> poison, float %6, i64 0
  %51 = shufflevector <2 x float> %50, <2 x float> poison, <2 x i32> zeroinitializer
  %52 = fmul <2 x float> %51, %49
  br label %53

53:                                               ; preds = %42, %44, %33, %22, %10
  %.sroa.0.0 = phi <2 x float> [ %18, %10 ], [ %29, %22 ], [ %41, %33 ], [ %52, %44 ], [ zeroinitializer, %42 ]
  ret <2 x float> %.sroa.0.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="64" "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, !13, i64 56}
!6 = !{!"_ZTS5Stick", !7, i64 0, !12, i64 48, !13, i64 56, !15, i64 60}
!7 = !{!"_ZTS6Sprite", !8, i64 0, !12, i64 12, !14, i64 20, !13, i64 40, !13, i64 44}
!8 = !{!"_ZTSN15DrawableManager8DrawableE", !9, i64 8}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTS7Vector2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !10, i64 0}
!14 = !{!"_ZTS7Texture", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16}
!15 = !{!"bool", !10, i64 0}
!16 = !{!7, !13, i64 44}


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