; LLVM IR from mvr/jiggle :: src (Collision)

; 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.jgVector2 = type { float, float }
%struct.jgCollision = type { ptr, ptr, ptr, ptr, %struct.jgVector2, float, %struct.jgVector2, float, float, float, float }
%struct.jgArea = type { ptr, %struct.jgAABB, %struct.jgVector2, ptr, i8, %struct.jgVector2, %struct.jgVector2, float, i8, float, float, i8 }
%struct.jgAABB = type { %struct.jgVector2, %struct.jgVector2, i8 }
%struct.jgList = type { ptr, i32, i32 }
%struct.jgParticle = type { float, %struct.jgVector2, %struct.jgVector2, %struct.jgVector2, %struct.jgVector2, %struct.jgVector2, float, float, i8, i8, ptr }

; Function Attrs: nounwind uwtable
declare dso_local ptr @jgCollisionAlloc() #0

; Function Attrs: nounwind uwtable
declare dso_local void @jgCollisionFree(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @jgCollisionFindMoveProportions(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @jgCollisionFind(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca %struct.jgVector2, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.jgVector2, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca %struct.jgVector2, align 4
  %17 = alloca %struct.jgVector2, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %18 = call ptr @jgCollisionAlloc()
  store ptr %18, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %19 = call ptr @jgCollisionAlloc()
  store ptr %19, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  store i8 0, ptr %8, align 1, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.jgCollision, ptr %20, i32 0, i32 7
  store float 0x7FF0000000000000, ptr %21, align 4, !tbaa !11
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.jgCollision, ptr %22, i32 0, i32 7
  store float 0x7FF0000000000000, ptr %23, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call <2 x float> @jgParticleAreaNormal(ptr noundef %24)
  store <2 x float> %25, ptr %9, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.jgArea, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  %29 = call ptr @jgListGet(ptr noundef %28, i32 noundef 0)
  store ptr %29, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jgArea, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = call ptr @jgListGet(ptr noundef %32, i32 noundef 1)
  store ptr %33, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !18
  br label %34

34:                                               ; preds = %138, %2
  %35 = load i32, ptr %12, align 4, !tbaa !18
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.jgArea, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  %39 = getelementptr inbounds %struct.jgList, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !20
  %41 = icmp slt i32 %35, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %140

43:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.jgParticle, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.jgParticle, ptr %46, i32 0, i32 1
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.jgParticle, ptr %48, i32 0, i32 1
  %50 = load <2 x float>, ptr %45, align 4
  %51 = load <2 x float>, ptr %47, align 4
  %52 = load <2 x float>, ptr %49, align 4
  %53 = call <2 x float> @jgVector2ClosestPointOnLine(<2 x float> %50, <2 x float> %51, <2 x float> %52)
  store <2 x float> %53, ptr %13, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.jgParticle, ptr %54, i32 0, i32 1
  %56 = load <2 x float>, ptr %55, align 4
  %57 = load <2 x float>, ptr %13, align 4
  %58 = call float @jgVector2DistanceBetween(<2 x float> %56, <2 x float> %57)
  store float %58, ptr %14, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.jgParticle, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.jgParticle, ptr %61, i32 0, i32 1
  %63 = load <2 x float>, ptr %60, align 4
  %64 = load <2 x float>, ptr %62, align 4
  %65 = call <2 x float> @jgVector2Normal(<2 x float> %63, <2 x float> %64)
  store <2 x float> %65, ptr %16, align 4
  %66 = load <2 x float>, ptr %9, align 4
  %67 = load <2 x float>, ptr %16, align 4
  %68 = call float @jgVector2Dot(<2 x float> %66, <2 x float> %67)
  store float %68, ptr %15, align 4, !tbaa !22
  %69 = load float, ptr %15, align 4, !tbaa !22
  %70 = fcmp ole float %69, 0.000000e+00
  br i1 %70, label %71, label %90

71:                                               ; preds = %43
  %72 = load float, ptr %14, align 4, !tbaa !22
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.jgCollision, ptr %73, i32 0, i32 7
  %75 = load float, ptr %74, align 4, !tbaa !11
  %76 = fcmp olt float %72, %75
  br i1 %76, label %77, label %89

77:                                               ; preds = %71
  %78 = load float, ptr %14, align 4, !tbaa !22
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.jgCollision, ptr %79, i32 0, i32 7
  store float %78, ptr %80, align 4, !tbaa !11
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = load ptr, ptr %6, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.jgCollision, ptr %82, i32 0, i32 2
  store ptr %81, ptr %83, align 8, !tbaa !23
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.jgCollision, ptr %85, i32 0, i32 3
  store ptr %84, ptr %86, align 8, !tbaa !24
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.jgCollision, ptr %87, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %88, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !25
  store i8 1, ptr %8, align 1, !tbaa !9
  br label %89

89:                                               ; preds = %77, %71
  br label %109

90:                                               ; preds = %43
  %91 = load float, ptr %14, align 4, !tbaa !22
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.jgCollision, ptr %92, i32 0, i32 7
  %94 = load float, ptr %93, align 4, !tbaa !11
  %95 = fcmp olt float %91, %94
  br i1 %95, label %96, label %108

96:                                               ; preds = %90
  %97 = load float, ptr %14, align 4, !tbaa !22
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.jgCollision, ptr %98, i32 0, i32 7
  store float %97, ptr %99, align 4, !tbaa !11
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.jgCollision, ptr %101, i32 0, i32 2
  store ptr %100, ptr %102, align 8, !tbaa !23
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.jgCollision, ptr %104, i32 0, i32 3
  store ptr %103, ptr %105, align 8, !tbaa !24
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.jgCollision, ptr %106, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %107, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !25
  br label %108

108:                                              ; preds = %96, %90
  br label %109

109:                                              ; preds = %108, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %12, align 4, !tbaa !18
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %12, align 4, !tbaa !18
  %113 = load ptr, ptr %3, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.jgArea, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !15
  %116 = load i32, ptr %12, align 4, !tbaa !18
  %117 = call ptr @jgListGet(ptr noundef %115, i32 noundef %116)
  store ptr %117, ptr %10, align 8, !tbaa !5
  %118 = load i32, ptr %12, align 4, !tbaa !18
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.jgArea, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !15
  %122 = getelementptr inbounds %struct.jgList, ptr %121, i32 0, i32 1
  %123 = load i32, ptr %122, align 8, !tbaa !20
  %124 = sub nsw i32 %123, 1
  %125 = icmp eq i32 %118, %124
  br i1 %125, label %126, label %131

126:                                              ; preds = %110
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.jgArea, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !15
  %130 = call ptr @jgListGet(ptr noundef %129, i32 noundef 0)
  br label %138

131:                                              ; preds = %110
  %132 = load ptr, ptr %3, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.jgArea, ptr %132, i32 0, i32 0
  %134 = load ptr, ptr %133, align 8, !tbaa !15
  %135 = load i32, ptr %12, align 4, !tbaa !18
  %136 = add nsw i32 %135, 1
  %137 = call ptr @jgListGet(ptr noundef %134, i32 noundef %136)
  br label %138

138:                                              ; preds = %131, %126
  %139 = phi ptr [ %130, %126 ], [ %137, %131 ]
  store ptr %139, ptr %11, align 8, !tbaa !5
  br label %34, !llvm.loop !26

140:                                              ; preds = %42
  %141 = load i8, ptr %8, align 1, !tbaa !9, !range !28, !noundef !29
  %142 = trunc i8 %141 to i1
  br i1 %142, label %143, label %146

143:                                              ; preds = %140
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  call void @jgCollisionFree(ptr noundef %144)
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %145, ptr %7, align 8, !tbaa !5
  br label %149

146:                                              ; preds = %140
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  call void @jgCollisionFree(ptr noundef %147)
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %148, ptr %7, align 8, !tbaa !5
  br label %149

149:                                              ; preds = %146, %143
  %150 = load ptr, ptr %3, align 8, !tbaa !5
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.jgCollision, ptr %151, i32 0, i32 1
  store ptr %150, ptr %152, align 8, !tbaa !30
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.jgCollision, ptr %154, i32 0, i32 0
  store ptr %153, ptr %155, align 8, !tbaa !31
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.jgCollision, ptr %156, i32 0, i32 2
  %158 = load ptr, ptr %157, align 8, !tbaa !23
  %159 = getelementptr inbounds %struct.jgParticle, ptr %158, i32 0, i32 1
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.jgCollision, ptr %160, i32 0, i32 3
  %162 = load ptr, ptr %161, align 8, !tbaa !24
  %163 = getelementptr inbounds %struct.jgParticle, ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.jgCollision, ptr %164, i32 0, i32 4
  %166 = load <2 x float>, ptr %159, align 4
  %167 = load <2 x float>, ptr %163, align 4
  %168 = load <2 x float>, ptr %165, align 8
  %169 = call float @jgVector2PositionAlong(<2 x float> %166, <2 x float> %167, <2 x float> %168)
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.jgCollision, ptr %170, i32 0, i32 5
  store float %169, ptr %171, align 8, !tbaa !32
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.jgCollision, ptr %172, i32 0, i32 6
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.jgCollision, ptr %174, i32 0, i32 2
  %176 = load ptr, ptr %175, align 8, !tbaa !23
  %177 = getelementptr inbounds %struct.jgParticle, ptr %176, i32 0, i32 1
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.jgCollision, ptr %178, i32 0, i32 3
  %180 = load ptr, ptr %179, align 8, !tbaa !24
  %181 = getelementptr inbounds %struct.jgParticle, ptr %180, i32 0, i32 1
  %182 = load <2 x float>, ptr %177, align 4
  %183 = load <2 x float>, ptr %181, align 4
  %184 = call <2 x float> @jgVector2Normal(<2 x float> %182, <2 x float> %183)
  store <2 x float> %184, ptr %17, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %173, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  %185 = load ptr, ptr %7, align 8, !tbaa !5
  call void @jgCollisionFindMoveProportions(ptr noundef %185)
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  ret ptr %186
}

declare <2 x float> @jgParticleAreaNormal(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @jgListGet(ptr noundef, i32 noundef) #4

declare <2 x float> @jgVector2ClosestPointOnLine(<2 x float>, <2 x float>, <2 x float>) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @jgVector2DistanceBetween(<2 x float>, <2 x float>) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @jgVector2Dot(<2 x float>, <2 x float>) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @jgVector2Normal(<2 x float>, <2 x float>) #5

; 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) #6

declare float @jgVector2PositionAlong(<2 x float>, <2 x float>, <2 x float>) #3

attributes #0 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { inlinehint 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 #5 = { inlinehint 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !14, i64 52}
!12 = !{!"jgCollision", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !14, i64 40, !13, i64 44, !14, i64 52, !14, i64 56, !14, i64 60, !14, i64 64}
!13 = !{!"jgVector2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"jgArea", !6, i64 0, !17, i64 8, !13, i64 28, !6, i64 40, !10, i64 48, !13, i64 52, !13, i64 60, !14, i64 68, !10, i64 72, !14, i64 76, !14, i64 80, !10, i64 84}
!17 = !{!"jgAABB", !13, i64 0, !13, i64 8, !10, i64 16}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!21, !19, i64 8}
!21 = !{!"jgList", !6, i64 0, !19, i64 8, !19, i64 12}
!22 = !{!14, !14, i64 0}
!23 = !{!12, !6, i64 16}
!24 = !{!12, !6, i64 24}
!25 = !{i64 0, i64 4, !22, i64 4, i64 4, !22}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!12, !6, i64 8}
!31 = !{!12, !6, i64 0}
!32 = !{!12, !14, 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: nounwind uwtable
declare dso_local ptr @jgCollisionAlloc() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @jgCollisionFree(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @jgCollisionFindMoveProportions(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @jgCollisionFind(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = tail call ptr @jgCollisionAlloc()
  %4 = tail call ptr @jgCollisionAlloc()
  %5 = getelementptr inbounds i8, ptr %4, i64 52
  store float 0x7FF0000000000000, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %3, i64 52
  store float 0x7FF0000000000000, ptr %6, align 4, !tbaa !5
  %7 = tail call <2 x float> @jgParticleAreaNormal(ptr noundef %1) #5
  %8 = load ptr, ptr %0, align 8, !tbaa !12
  %9 = tail call ptr @jgListGet(ptr noundef %8, i32 noundef 0)
  %10 = load ptr, ptr %0, align 8, !tbaa !12
  %11 = tail call ptr @jgListGet(ptr noundef %10, i32 noundef 1)
  %12 = load ptr, ptr %0, align 8, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load i32, ptr %13, align 8, !tbaa !16
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %2
  %16 = getelementptr inbounds i8, ptr %1, i64 4
  br label %17

._crit_edge:                                      ; preds = %37
  br i1 %.1, label %52, label %.critedge

17:                                               ; preds = %.lr.ph, %37
  %.06171 = phi i1 [ false, %.lr.ph ], [ %.1, %37 ]
  %.06270 = phi ptr [ %9, %.lr.ph ], [ %40, %37 ]
  %.06369 = phi ptr [ %11, %.lr.ph ], [ %47, %37 ]
  %.06468 = phi i32 [ 0, %.lr.ph ], [ %38, %37 ]
  %18 = getelementptr inbounds i8, ptr %.06270, i64 4
  %19 = getelementptr inbounds i8, ptr %.06369, i64 4
  %20 = load <2 x float>, ptr %18, align 4
  %21 = load <2 x float>, ptr %19, align 4
  %22 = load <2 x float>, ptr %16, align 4
  %23 = tail call <2 x float> @jgVector2ClosestPointOnLine(<2 x float> %20, <2 x float> %21, <2 x float> %22) #5
  %24 = load <2 x float>, ptr %16, align 4
  %25 = tail call float @jgVector2DistanceBetween(<2 x float> %24, <2 x float> %23)
  %26 = load <2 x float>, ptr %18, align 4
  %27 = load <2 x float>, ptr %19, align 4
  %28 = tail call <2 x float> @jgVector2Normal(<2 x float> %26, <2 x float> %27)
  %29 = tail call float @jgVector2Dot(<2 x float> %7, <2 x float> %28)
  %30 = fcmp ugt float %29, 0.000000e+00
  br i1 %30, label %34, label %31

31:                                               ; preds = %17
  %32 = load float, ptr %5, align 4, !tbaa !5
  %33 = fcmp olt float %25, %32
  br i1 %33, label %.sink.split, label %37

34:                                               ; preds = %17
  %35 = load float, ptr %6, align 4, !tbaa !5
  %36 = fcmp olt float %25, %35
  br i1 %36, label %.sink.split, label %37

.sink.split:                                      ; preds = %34, %31
  %.sink74 = phi ptr [ %5, %31 ], [ %6, %34 ]
  %.pn = phi ptr [ %4, %31 ], [ %3, %34 ]
  %.1.ph = phi i1 [ true, %31 ], [ %.06171, %34 ]
  %.sink = getelementptr inbounds i8, ptr %.pn, i64 32
  %.sink72 = getelementptr inbounds i8, ptr %.pn, i64 24
  %.sink73 = getelementptr inbounds i8, ptr %.pn, i64 16
  store float %25, ptr %.sink74, align 4, !tbaa !5
  store ptr %.06270, ptr %.sink73, align 8, !tbaa !19
  store ptr %.06369, ptr %.sink72, align 8, !tbaa !20
  store <2 x float> %23, ptr %.sink, align 8
  br label %37

37:                                               ; preds = %.sink.split, %34, %31
  %.1 = phi i1 [ %.06171, %31 ], [ %.06171, %34 ], [ %.1.ph, %.sink.split ]
  %38 = add nuw nsw i32 %.06468, 1
  %39 = load ptr, ptr %0, align 8, !tbaa !12
  %40 = tail call ptr @jgListGet(ptr noundef %39, i32 noundef %38)
  %41 = load ptr, ptr %0, align 8, !tbaa !12
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load i32, ptr %42, align 8, !tbaa !16
  %44 = add i32 %43, -2
  %45 = icmp eq i32 %.06468, %44
  %46 = add nuw nsw i32 %.06468, 2
  %.sink75 = select i1 %45, i32 0, i32 %46
  %47 = tail call ptr @jgListGet(ptr noundef nonnull %41, i32 noundef %.sink75)
  %48 = load ptr, ptr %0, align 8, !tbaa !12
  %49 = getelementptr inbounds i8, ptr %48, i64 8
  %50 = load i32, ptr %49, align 8, !tbaa !16
  %51 = icmp slt i32 %38, %50
  br i1 %51, label %17, label %._crit_edge, !llvm.loop !21

.critedge:                                        ; preds = %2, %._crit_edge
  br label %52

52:                                               ; preds = %._crit_edge, %.critedge
  %.sink76 = phi ptr [ %4, %.critedge ], [ %3, %._crit_edge ]
  %.0 = phi ptr [ %3, %.critedge ], [ %4, %._crit_edge ]
  tail call void @jgCollisionFree(ptr noundef %.sink76)
  %53 = getelementptr inbounds i8, ptr %.0, i64 8
  store ptr %0, ptr %53, align 8, !tbaa !23
  store ptr %1, ptr %.0, align 8, !tbaa !24
  %54 = getelementptr inbounds i8, ptr %.0, i64 16
  %55 = load ptr, ptr %54, align 8, !tbaa !19
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  %57 = getelementptr inbounds i8, ptr %.0, i64 24
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  %60 = getelementptr inbounds i8, ptr %.0, i64 32
  %61 = load <2 x float>, ptr %56, align 4
  %62 = load <2 x float>, ptr %59, align 4
  %63 = load <2 x float>, ptr %60, align 8
  %64 = tail call float @jgVector2PositionAlong(<2 x float> %61, <2 x float> %62, <2 x float> %63) #5
  %65 = getelementptr inbounds i8, ptr %.0, i64 40
  store float %64, ptr %65, align 8, !tbaa !25
  %66 = getelementptr inbounds i8, ptr %.0, i64 44
  %67 = load ptr, ptr %54, align 8, !tbaa !19
  %68 = getelementptr inbounds i8, ptr %67, i64 4
  %69 = load ptr, ptr %57, align 8, !tbaa !20
  %70 = getelementptr inbounds i8, ptr %69, i64 4
  %71 = load <2 x float>, ptr %68, align 4
  %72 = load <2 x float>, ptr %70, align 4
  %73 = tail call <2 x float> @jgVector2Normal(<2 x float> %71, <2 x float> %72)
  store <2 x float> %73, ptr %66, align 4
  tail call void @jgCollisionFindMoveProportions(ptr noundef nonnull %.0)
  ret ptr %.0
}

declare <2 x float> @jgParticleAreaNormal(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @jgListGet(ptr noundef, i32 noundef) local_unnamed_addr #3

declare <2 x float> @jgVector2ClosestPointOnLine(<2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @jgVector2DistanceBetween(<2 x float>, <2 x float>) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @jgVector2Dot(<2 x float>, <2 x float>) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @jgVector2Normal(<2 x float>, <2 x float>) local_unnamed_addr #4

declare float @jgVector2PositionAlong(<2 x float>, <2 x float>, <2 x float>) local_unnamed_addr #2

attributes #0 = { 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 = { 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 = { "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 = { inlinehint 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 #4 = { inlinehint 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 #5 = { 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, !11, i64 52}
!6 = !{!"jgCollision", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !11, i64 40, !10, i64 44, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"jgVector2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !8, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"jgArea", !7, i64 0, !14, i64 8, !10, i64 28, !7, i64 40, !15, i64 48, !10, i64 52, !10, i64 60, !11, i64 68, !15, i64 72, !11, i64 76, !11, i64 80, !15, i64 84}
!14 = !{!"jgAABB", !10, i64 0, !10, i64 8, !15, i64 16}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{!17, !18, i64 8}
!17 = !{!"jgList", !7, i64 0, !18, i64 8, !18, i64 12}
!18 = !{!"int", !8, i64 0}
!19 = !{!6, !7, i64 16}
!20 = !{!6, !7, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!6, !7, i64 8}
!24 = !{!6, !7, i64 0}
!25 = !{!6, !11, i64 40}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass