; LLVM IR from SOHNE/Dura2D :: src/kinetics/d2Body.ll (ZN6d2Body11ComputeAABBEv)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.d2Vec2 = type { float, float }
%class.d2Body = type <{ i16, [2 x i8], i32, %struct.d2Transform, %struct.d2Vec2, %struct.d2Vec2, float, float, float, %struct.d2Vec2, float, float, float, float, float, float, float, ptr, ptr, ptr, ptr, ptr, float, [4 x i8] }>
%struct.d2Transform = type { %struct.d2Vec2, %struct.d2Rot }
%struct.d2Rot = type { float, float }
%struct.d2PolygonShape = type { %struct.d2Shape, float, float, i32, ptr, ptr }
%struct.d2Shape = type { ptr }
%struct.d2AABB = type { %struct.d2Vec2, %struct.d2Vec2, ptr, ptr }
%struct.d2CircleShape = type <{ %struct.d2Shape, float, [4 x i8] }>

@_ZTI7d2Shape = external dso_local constant { ptr, ptr }, align 8
@_ZTI14d2PolygonShape = external constant ptr
@_ZTI13d2CircleShape = external constant ptr
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6d2Body11ComputeAABBEv(ptr noundef nonnull align 8 dereferenceable(132) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.d2Vec2, align 4
  %5 = alloca %struct.d2Vec2, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.d2Vec2, align 4
  %8 = alloca %struct.d2Vec2, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.d2Vec2, align 4
  %11 = alloca %struct.d2Vec2, align 4
  %12 = alloca %struct.d2Vec2, align 4
  %13 = alloca %struct.d2Vec2, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  %15 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 18
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = getelementptr inbounds ptr, ptr %17, i64 2
  %19 = load ptr, ptr %18, align 8
  %20 = call noundef i32 %19(ptr noundef nonnull align 8 dereferenceable(8) %16)
  switch i32 %20, label %106 [
    i32 1, label %21
    i32 2, label %21
    i32 0, label %71
  ]

21:                                               ; preds = %1, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #9
  %22 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 18
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = icmp eq ptr %23, null
  br i1 %24, label %27, label %25

25:                                               ; preds = %21
  %26 = call ptr @__dynamic_cast(ptr %23, ptr @_ZTI7d2Shape, ptr @_ZTI14d2PolygonShape, i64 0) #9
  br label %28

27:                                               ; preds = %21
  br label %28

28:                                               ; preds = %27, %25
  %29 = phi ptr [ %26, %25 ], [ null, %27 ]
  store ptr %29, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.d2PolygonShape, ptr %30, i32 0, i32 5
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %33 = getelementptr inbounds %struct.d2Vec2, ptr %32, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %33, i64 8, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.d2PolygonShape, ptr %34, i32 0, i32 5
  %36 = load ptr, ptr %35, align 8, !tbaa !19
  %37 = getelementptr inbounds %struct.d2Vec2, ptr %36, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %37, i64 8, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 1, ptr %6, align 4, !tbaa !25
  br label %38

38:                                               ; preds = %59, %28
  %39 = load i32, ptr %6, align 4, !tbaa !25
  %40 = icmp slt i32 %39, 4
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %62

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.d2PolygonShape, ptr %43, i32 0, i32 5
  %45 = load ptr, ptr %44, align 8, !tbaa !19
  %46 = load i32, ptr %6, align 4, !tbaa !25
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds %struct.d2Vec2, ptr %45, i64 %47
  %49 = call <2 x float> @_Z5d2MinRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %48)
  store <2 x float> %49, ptr %7, align 4
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.d2PolygonShape, ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = load i32, ptr %6, align 4, !tbaa !25
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %struct.d2Vec2, ptr %53, i64 %55
  %57 = call <2 x float> @_Z5d2MaxRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %56)
  store <2 x float> %57, ptr %8, align 4
  %58 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  br label %59

59:                                               ; preds = %42
  %60 = load i32, ptr %6, align 4, !tbaa !25
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %6, align 4, !tbaa !25
  br label %38, !llvm.loop !26

62:                                               ; preds = %41
  %63 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 17
  %64 = load ptr, ptr %63, align 8, !tbaa !28
  %65 = getelementptr inbounds %struct.d2AABB, ptr %64, i32 0, i32 0
  %66 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %65, ptr noundef nonnull align 4 dereferenceable(8) %4)
  %67 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 17
  %68 = load ptr, ptr %67, align 8, !tbaa !28
  %69 = getelementptr inbounds %struct.d2AABB, ptr %68, i32 0, i32 1
  %70 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %69, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #9
  br label %109

71:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %72 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 18
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  %74 = icmp eq ptr %73, null
  br i1 %74, label %77, label %75

75:                                               ; preds = %71
  %76 = call ptr @__dynamic_cast(ptr %73, ptr @_ZTI7d2Shape, ptr @_ZTI13d2CircleShape, i64 0) #9
  br label %78

77:                                               ; preds = %71
  br label %78

78:                                               ; preds = %77, %75
  %79 = phi ptr [ %76, %75 ], [ null, %77 ]
  store ptr %79, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %80 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 3
  %81 = getelementptr inbounds %struct.d2Transform, ptr %80, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.d2CircleShape, ptr %82, i32 0, i32 1
  %84 = load float, ptr %83, align 8, !tbaa !29
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.d2CircleShape, ptr %85, i32 0, i32 1
  %87 = load float, ptr %86, align 8, !tbaa !29
  call void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %11, float noundef %84, float noundef %87)
  %88 = call <2 x float> @_ZNK6d2Vec2miERKS_(ptr noundef nonnull align 4 dereferenceable(8) %81, ptr noundef nonnull align 4 dereferenceable(8) %11)
  store <2 x float> %88, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %89 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 3
  %90 = getelementptr inbounds %struct.d2Transform, ptr %89, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.d2CircleShape, ptr %91, i32 0, i32 1
  %93 = load float, ptr %92, align 8, !tbaa !29
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.d2CircleShape, ptr %94, i32 0, i32 1
  %96 = load float, ptr %95, align 8, !tbaa !29
  call void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %13, float noundef %93, float noundef %96)
  %97 = call <2 x float> @_ZNK6d2Vec2plERKS_(ptr noundef nonnull align 4 dereferenceable(8) %90, ptr noundef nonnull align 4 dereferenceable(8) %13)
  store <2 x float> %97, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  %98 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 17
  %99 = load ptr, ptr %98, align 8, !tbaa !28
  %100 = getelementptr inbounds %struct.d2AABB, ptr %99, i32 0, i32 0
  %101 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %100, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %102 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 17
  %103 = load ptr, ptr %102, align 8, !tbaa !28
  %104 = getelementptr inbounds %struct.d2AABB, ptr %103, i32 0, i32 1
  %105 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %104, ptr noundef nonnull align 4 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %109

106:                                              ; preds = %1
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %107, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %109

109:                                              ; preds = %106, %78, %62
  %110 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 17
  %111 = load ptr, ptr %110, align 8, !tbaa !28
  %112 = getelementptr inbounds %struct.d2AABB, ptr %111, i32 0, i32 3
  %113 = load ptr, ptr %112, align 8, !tbaa !31
  %114 = icmp eq ptr %113, null
  br i1 %114, label %115, label %119

115:                                              ; preds = %109
  %116 = getelementptr inbounds %class.d2Body, ptr %14, i32 0, i32 17
  %117 = load ptr, ptr %116, align 8, !tbaa !28
  %118 = getelementptr inbounds %struct.d2AABB, ptr %117, i32 0, i32 3
  store ptr %14, ptr %118, align 8, !tbaa !31
  br label %119

119:                                              ; preds = %115, %109
  ret void
}

; Function Attrs: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Z5d2MinRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Z5d2MaxRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #6

declare <2 x float> @_ZNK6d2Vec2miERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

declare <2 x float> @_ZNK6d2Vec2plERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #8 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #7

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 #3 = { mustprogress 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 #4 = { nounwind willreturn memory(read) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint mustprogress 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 #7 = { inlinehint 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 #8 = { 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 #9 = { 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, !6, i64 96}
!10 = !{!"_ZTS6d2Body", !11, i64 0, !12, i64 4, !13, i64 8, !14, i64 24, !14, i64 32, !15, i64 40, !15, i64 44, !15, i64 48, !14, i64 52, !15, i64 60, !15, i64 64, !15, i64 68, !15, i64 72, !15, i64 76, !15, i64 80, !15, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !15, i64 128}
!11 = !{!"short", !7, i64 0}
!12 = !{!"_ZTS10d2BodyType", !7, i64 0}
!13 = !{!"_ZTS11d2Transform", !14, i64 0, !16, i64 8}
!14 = !{!"_ZTS6d2Vec2", !15, i64 0, !15, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTS5d2Rot", !15, i64 0, !15, i64 4}
!17 = !{!18, !18, i64 0}
!18 = !{!"vtable pointer", !8, i64 0}
!19 = !{!20, !6, i64 32}
!20 = !{!"_ZTS14d2PolygonShape", !21, i64 0, !15, i64 8, !15, i64 12, !22, i64 16, !6, i64 24, !6, i64 32}
!21 = !{!"_ZTS7d2Shape"}
!22 = !{!"int", !7, i64 0}
!23 = !{i64 0, i64 4, !24, i64 4, i64 4, !24}
!24 = !{!15, !15, i64 0}
!25 = !{!22, !22, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!10, !6, i64 88}
!29 = !{!30, !15, i64 8}
!30 = !{!"_ZTS13d2CircleShape", !21, i64 0, !15, i64 8}
!31 = !{!32, !6, i64 24}
!32 = !{!"_ZTS6d2AABB", !14, i64 0, !14, i64 8, !6, i64 16, !6, i64 24}


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%struct.d2Vec2 = type { float, float }

@_ZTI7d2Shape = external dso_local constant { ptr, ptr }, align 8
@_ZTI14d2PolygonShape = external constant ptr
@_ZTI13d2CircleShape = external constant ptr
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6d2Body11ComputeAABBEv(ptr noundef nonnull align 8 dereferenceable(132) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca %struct.d2Vec2, align 8
  %3 = alloca %struct.d2Vec2, align 8
  %4 = alloca %struct.d2Vec2, align 8
  %5 = alloca %struct.d2Vec2, align 8
  %6 = alloca %struct.d2Vec2, align 8
  %7 = alloca %struct.d2Vec2, align 4
  %8 = alloca %struct.d2Vec2, align 8
  %9 = alloca %struct.d2Vec2, align 4
  %10 = getelementptr inbounds i8, ptr %0, i64 96
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = getelementptr inbounds i8, ptr %12, i64 16
  %14 = load ptr, ptr %13, align 8
  %15 = tail call noundef i32 %14(ptr noundef nonnull align 8 dereferenceable(8) %11)
  switch i32 %15, label %66 [
    i32 1, label %16
    i32 2, label %16
    i32 0, label %51
  ]

16:                                               ; preds = %1, %1
  %17 = load ptr, ptr %10, align 8, !tbaa !5, !nonnull !18, !noundef !18
  %18 = tail call ptr @__dynamic_cast(ptr nonnull %17, ptr nonnull @_ZTI7d2Shape, ptr nonnull @_ZTI14d2PolygonShape, i64 0) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %19 = getelementptr inbounds i8, ptr %18, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  %21 = load i64, ptr %20, align 4
  store i64 %21, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store i64 %21, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %22 = getelementptr inbounds i8, ptr %20, i64 8
  %23 = call <2 x float> @_Z5d2MinRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %22)
  store <2 x float> %23, ptr %4, align 8
  %24 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %25 = load ptr, ptr %19, align 8, !tbaa !19
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = call <2 x float> @_Z5d2MaxRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %26)
  store <2 x float> %27, ptr %5, align 8
  %28 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %29 = load ptr, ptr %19, align 8, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %31 = call <2 x float> @_Z5d2MinRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %30)
  store <2 x float> %31, ptr %4, align 8
  %32 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %33 = load ptr, ptr %19, align 8, !tbaa !19
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %35 = call <2 x float> @_Z5d2MaxRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %34)
  store <2 x float> %35, ptr %5, align 8
  %36 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  %37 = load ptr, ptr %19, align 8, !tbaa !19
  %38 = getelementptr inbounds i8, ptr %37, i64 24
  %39 = call <2 x float> @_Z5d2MinRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %38)
  store <2 x float> %39, ptr %4, align 8
  %40 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %41 = load ptr, ptr %19, align 8, !tbaa !19
  %42 = getelementptr inbounds i8, ptr %41, i64 24
  %43 = call <2 x float> @_Z5d2MaxRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %42)
  store <2 x float> %43, ptr %5, align 8
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  %45 = getelementptr inbounds i8, ptr %0, i64 88
  %46 = load ptr, ptr %45, align 8, !tbaa !23
  %47 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %46, ptr noundef nonnull align 4 dereferenceable(8) %2)
  %48 = load ptr, ptr %45, align 8, !tbaa !23
  %49 = getelementptr inbounds i8, ptr %48, i64 8
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %49, ptr noundef nonnull align 4 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  br label %69

51:                                               ; preds = %1
  %52 = load ptr, ptr %10, align 8, !tbaa !5, !nonnull !18, !noundef !18
  %53 = tail call ptr @__dynamic_cast(ptr nonnull %52, ptr nonnull @_ZTI7d2Shape, ptr nonnull @_ZTI13d2CircleShape, i64 0) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %54 = getelementptr inbounds i8, ptr %0, i64 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %55 = getelementptr inbounds i8, ptr %53, i64 8
  %56 = load float, ptr %55, align 8, !tbaa !24
  call void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %7, float noundef %56, float noundef %56)
  %57 = call <2 x float> @_ZNK6d2Vec2miERKS_(ptr noundef nonnull align 4 dereferenceable(8) %54, ptr noundef nonnull align 4 dereferenceable(8) %7)
  store <2 x float> %57, ptr %6, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #8
  %58 = load float, ptr %55, align 8, !tbaa !24
  call void @_ZN6d2Vec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %9, float noundef %58, float noundef %58)
  %59 = call <2 x float> @_ZNK6d2Vec2plERKS_(ptr noundef nonnull align 4 dereferenceable(8) %54, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store <2 x float> %59, ptr %8, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #8
  %60 = getelementptr inbounds i8, ptr %0, i64 88
  %61 = load ptr, ptr %60, align 8, !tbaa !23
  %62 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %61, ptr noundef nonnull align 4 dereferenceable(8) %6)
  %63 = load ptr, ptr %60, align 8, !tbaa !23
  %64 = getelementptr inbounds i8, ptr %63, i64 8
  %65 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZN6d2Vec2aSERKS_(ptr noundef nonnull align 4 dereferenceable(8) %64, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  br label %69

66:                                               ; preds = %1
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %69

69:                                               ; preds = %66, %51, %16
  %70 = getelementptr inbounds i8, ptr %0, i64 88
  %71 = load ptr, ptr %70, align 8, !tbaa !23
  %72 = getelementptr inbounds i8, ptr %71, i64 24
  %73 = load ptr, ptr %72, align 8, !tbaa !26
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %76

75:                                               ; preds = %69
  store ptr %0, ptr %72, align 8, !tbaa !26
  br label %76

76:                                               ; preds = %75, %69
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Z5d2MinRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Z5d2MaxRK6d2Vec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #5

declare <2 x float> @_ZNK6d2Vec2miERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

declare <2 x float> @_ZNK6d2Vec2plERKS_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 #3 = { mustprogress 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 #4 = { mustprogress nofree nounwind willreturn memory(read) }
attributes #5 = { inlinehint mustprogress 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 #6 = { inlinehint 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 #7 = { 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 #8 = { 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, !15, i64 96}
!6 = !{!"_ZTS6d2Body", !7, i64 0, !10, i64 4, !11, i64 8, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !12, i64 52, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !15, i64 88, !15, i64 96, !15, i64 104, !15, i64 112, !15, i64 120, !13, i64 128}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS10d2BodyType", !8, i64 0}
!11 = !{!"_ZTS11d2Transform", !12, i64 0, !14, i64 8}
!12 = !{!"_ZTS6d2Vec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_ZTS5d2Rot", !13, i64 0, !13, i64 4}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !9, i64 0}
!18 = !{}
!19 = !{!20, !15, i64 32}
!20 = !{!"_ZTS14d2PolygonShape", !21, i64 0, !13, i64 8, !13, i64 12, !22, i64 16, !15, i64 24, !15, i64 32}
!21 = !{!"_ZTS7d2Shape"}
!22 = !{!"int", !8, i64 0}
!23 = !{!6, !15, i64 88}
!24 = !{!25, !13, i64 8}
!25 = !{!"_ZTS13d2CircleShape", !21, i64 0, !13, i64 8}
!26 = !{!27, !15, i64 24}
!27 = !{!"_ZTS6d2AABB", !12, i64 0, !12, i64 8, !15, i64 16, !15, i64 24}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass