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

; 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.Ball = type { %class.Sprite, i32, ptr }
%class.Sprite = type { %"class.DrawableManager::Drawable.base", %struct.Vector2, %struct.Texture, float, float }
%"class.DrawableManager::Drawable.base" = type <{ ptr, i32 }>
%struct.Vector2 = type { float, float }
%struct.Texture = type { i32, i32, i32, i32, i32 }
%struct.PhysicsBodyData = type { i32, i8, %struct.Vector2, %struct.Vector2, %struct.Vector2, float, float, float, float, float, float, float, float, float, float, i8, i8, i8, %struct.PhysicsShape }
%struct.PhysicsShape = type { i32, ptr, %struct.PhysicsVertexData, float, %struct.Matrix2x2 }
%struct.PhysicsVertexData = type { i32, [24 x %struct.Vector2], [24 x %struct.Vector2] }
%struct.Matrix2x2 = type { float, float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4Ball6UpdateEv(ptr noundef nonnull align 8 dereferenceable(64) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = getelementptr inbounds %struct.PhysicsBodyData, ptr %5, i32 0, i32 3
  %7 = getelementptr inbounds %struct.Vector2, ptr %6, i32 0, i32 0
  %8 = load float, ptr %7, align 8, !tbaa !17
  %9 = fcmp une float %8, 0.000000e+00
  br i1 %9, label %10, label %39

10:                                               ; preds = %1
  %11 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %struct.PhysicsBodyData, ptr %12, i32 0, i32 3
  %14 = getelementptr inbounds %struct.Vector2, ptr %13, i32 0, i32 0
  %15 = load float, ptr %14, align 8, !tbaa !17
  %16 = fcmp olt float %15, 0.000000e+00
  br i1 %16, label %17, label %24

17:                                               ; preds = %10
  %18 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct.PhysicsBodyData, ptr %19, i32 0, i32 3
  %21 = getelementptr inbounds %struct.Vector2, ptr %20, i32 0, i32 0
  %22 = load float, ptr %21, align 8, !tbaa !17
  %23 = fadd float %22, 0x3F747AE140000000
  store float %23, ptr %21, align 8, !tbaa !17
  br label %24

24:                                               ; preds = %17, %10
  %25 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.PhysicsBodyData, ptr %26, i32 0, i32 3
  %28 = getelementptr inbounds %struct.Vector2, ptr %27, i32 0, i32 0
  %29 = load float, ptr %28, align 8, !tbaa !17
  %30 = fcmp ogt float %29, 0.000000e+00
  br i1 %30, label %31, label %38

31:                                               ; preds = %24
  %32 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct.PhysicsBodyData, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds %struct.Vector2, ptr %34, i32 0, i32 0
  %36 = load float, ptr %35, align 8, !tbaa !17
  %37 = fsub float %36, 0x3F747AE140000000
  store float %37, ptr %35, align 8, !tbaa !17
  br label %38

38:                                               ; preds = %31, %24
  br label %39

39:                                               ; preds = %38, %1
  %40 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.PhysicsBodyData, ptr %41, i32 0, i32 3
  %43 = getelementptr inbounds %struct.Vector2, ptr %42, i32 0, i32 1
  %44 = load float, ptr %43, align 4, !tbaa !24
  %45 = fcmp une float %44, 0.000000e+00
  br i1 %45, label %46, label %75

46:                                               ; preds = %39
  %47 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.PhysicsBodyData, ptr %48, i32 0, i32 3
  %50 = getelementptr inbounds %struct.Vector2, ptr %49, i32 0, i32 1
  %51 = load float, ptr %50, align 4, !tbaa !24
  %52 = fcmp olt float %51, 0.000000e+00
  br i1 %52, label %53, label %60

53:                                               ; preds = %46
  %54 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.PhysicsBodyData, ptr %55, i32 0, i32 3
  %57 = getelementptr inbounds %struct.Vector2, ptr %56, i32 0, i32 1
  %58 = load float, ptr %57, align 4, !tbaa !24
  %59 = fadd float %58, 0x3F747AE140000000
  store float %59, ptr %57, align 4, !tbaa !24
  br label %60

60:                                               ; preds = %53, %46
  %61 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds %struct.PhysicsBodyData, ptr %62, i32 0, i32 3
  %64 = getelementptr inbounds %struct.Vector2, ptr %63, i32 0, i32 1
  %65 = load float, ptr %64, align 4, !tbaa !24
  %66 = fcmp ogt float %65, 0.000000e+00
  br i1 %66, label %67, label %74

67:                                               ; preds = %60
  %68 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.PhysicsBodyData, ptr %69, i32 0, i32 3
  %71 = getelementptr inbounds %struct.Vector2, ptr %70, i32 0, i32 1
  %72 = load float, ptr %71, align 4, !tbaa !24
  %73 = fsub float %72, 0x3F747AE140000000
  store float %73, ptr %71, align 4, !tbaa !24
  br label %74

74:                                               ; preds = %67, %60
  br label %75

75:                                               ; preds = %74, %39
  %76 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.PhysicsBodyData, ptr %77, i32 0, i32 3
  %79 = getelementptr inbounds %struct.Vector2, ptr %78, i32 0, i32 0
  %80 = load float, ptr %79, align 8, !tbaa !17
  %81 = fcmp olt float %80, 0x3F747AE140000000
  br i1 %81, label %82, label %112

82:                                               ; preds = %75
  %83 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.PhysicsBodyData, ptr %84, i32 0, i32 3
  %86 = getelementptr inbounds %struct.Vector2, ptr %85, i32 0, i32 0
  %87 = load float, ptr %86, align 8, !tbaa !17
  %88 = fcmp ogt float %87, 0xBF747AE140000000
  br i1 %88, label %89, label %112

89:                                               ; preds = %82
  %90 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.PhysicsBodyData, ptr %91, i32 0, i32 3
  %93 = getelementptr inbounds %struct.Vector2, ptr %92, i32 0, i32 1
  %94 = load float, ptr %93, align 4, !tbaa !24
  %95 = fcmp olt float %94, 0x3F747AE140000000
  br i1 %95, label %96, label %112

96:                                               ; preds = %89
  %97 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !9
  %99 = getelementptr inbounds %struct.PhysicsBodyData, ptr %98, i32 0, i32 3
  %100 = getelementptr inbounds %struct.Vector2, ptr %99, i32 0, i32 1
  %101 = load float, ptr %100, align 4, !tbaa !24
  %102 = fcmp ogt float %101, 0xBF747AE140000000
  br i1 %102, label %103, label %112

103:                                              ; preds = %96
  %104 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !9
  %106 = getelementptr inbounds %struct.PhysicsBodyData, ptr %105, i32 0, i32 3
  %107 = getelementptr inbounds %struct.Vector2, ptr %106, i32 0, i32 0
  store float 0.000000e+00, ptr %107, align 8, !tbaa !17
  %108 = getelementptr inbounds %class.Ball, ptr %3, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.PhysicsBodyData, ptr %109, i32 0, i32 3
  %111 = getelementptr inbounds %struct.Vector2, ptr %110, i32 0, i32 1
  store float 0.000000e+00, ptr %111, align 4, !tbaa !24
  br label %112

112:                                              ; preds = %103, %96, %89, %82, %75
  ret void
}

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

!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, !6, i64 56}
!10 = !{!"_ZTS4Ball", !11, i64 0, !13, i64 48, !6, i64 56}
!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 = !{!18, !15, i64 16}
!18 = !{!"_ZTS15PhysicsBodyData", !13, i64 0, !19, i64 4, !14, i64 8, !14, i64 16, !14, i64 24, !15, i64 32, !15, i64 36, !15, i64 40, !15, i64 44, !15, i64 48, !15, i64 52, !15, i64 56, !15, i64 60, !15, i64 64, !15, i64 68, !19, i64 72, !19, i64 73, !19, i64 74, !20, i64 80}
!19 = !{!"bool", !7, i64 0}
!20 = !{!"_ZTS12PhysicsShape", !21, i64 0, !6, i64 8, !22, i64 16, !15, i64 404, !23, i64 408}
!21 = !{!"_ZTS16PhysicsShapeType", !7, i64 0}
!22 = !{!"_ZTS17PhysicsVertexData", !13, i64 0, !7, i64 4, !7, i64 196}
!23 = !{!"_ZTS9Matrix2x2", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!24 = !{!18, !15, i64 20}


; 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(readwrite, inaccessiblemem: none) uwtable
define dso_local void @_ZN4Ball6UpdateEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(64) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 56
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 16
  %5 = load float, ptr %4, align 8, !tbaa !16
  %6 = fcmp une float %5, 0.000000e+00
  br i1 %6, label %condstore.split, label %14

condstore.split:                                  ; preds = %1
  %7 = fcmp olt float %5, 0.000000e+00
  %8 = fadd float %5, 0x3F747AE140000000
  %9 = select i1 %7, float %8, float %5
  %10 = fcmp ogt float %9, 0.000000e+00
  %11 = or i1 %7, %10
  br i1 %11, label %12, label %14

12:                                               ; preds = %condstore.split
  %13 = fadd float %9, 0xBF747AE140000000
  %simplifycfg.merge = select i1 %10, float %13, float %9
  store float %simplifycfg.merge, ptr %4, align 8, !tbaa !16
  br label %14

14:                                               ; preds = %12, %condstore.split, %1
  %15 = phi float [ %simplifycfg.merge, %12 ], [ %5, %condstore.split ], [ %5, %1 ]
  %16 = getelementptr inbounds i8, ptr %3, i64 20
  %17 = load float, ptr %16, align 4, !tbaa !23
  %18 = fcmp une float %17, 0.000000e+00
  br i1 %18, label %condstore.split7, label %26

condstore.split7:                                 ; preds = %14
  %19 = fcmp olt float %17, 0.000000e+00
  %20 = fadd float %17, 0x3F747AE140000000
  %21 = select i1 %19, float %20, float %17
  %22 = fcmp ogt float %21, 0.000000e+00
  %23 = or i1 %19, %22
  br i1 %23, label %24, label %26

24:                                               ; preds = %condstore.split7
  %25 = fadd float %21, 0xBF747AE140000000
  %simplifycfg.merge8 = select i1 %22, float %25, float %21
  store float %simplifycfg.merge8, ptr %16, align 4, !tbaa !23
  br label %26

26:                                               ; preds = %24, %condstore.split7, %14
  %27 = phi float [ %simplifycfg.merge8, %24 ], [ %17, %condstore.split7 ], [ %17, %14 ]
  %28 = tail call float @llvm.fabs.f32(float %15)
  %or.cond = fcmp olt float %28, 0x3F747AE140000000
  %29 = tail call float @llvm.fabs.f32(float %27)
  %or.cond6 = fcmp olt float %29, 0x3F747AE140000000
  %or.cond9 = and i1 %or.cond, %or.cond6
  br i1 %or.cond9, label %30, label %31

30:                                               ; preds = %26
  store <2 x float> zeroinitializer, ptr %4, align 8, !tbaa !24
  br label %31

31:                                               ; preds = %30, %26
  ret void
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) 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) }

!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, !15, i64 56}
!6 = !{!"_ZTS4Ball", !7, i64 0, !9, i64 48, !15, i64 56}
!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 = !{!"any pointer", !10, i64 0}
!16 = !{!17, !13, i64 16}
!17 = !{!"_ZTS15PhysicsBodyData", !9, i64 0, !18, i64 4, !12, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !18, i64 72, !18, i64 73, !18, i64 74, !19, i64 80}
!18 = !{!"bool", !10, i64 0}
!19 = !{!"_ZTS12PhysicsShape", !20, i64 0, !15, i64 8, !21, i64 16, !13, i64 404, !22, i64 408}
!20 = !{!"_ZTS16PhysicsShapeType", !10, i64 0}
!21 = !{!"_ZTS17PhysicsVertexData", !9, i64 0, !10, i64 4, !10, i64 196}
!22 = !{!"_ZTS9Matrix2x2", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!23 = !{!17, !13, i64 20}
!24 = !{!13, !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass