; LLVM IR from erincatto/box2d :: src (geometry)

; 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.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%struct.b2Vec2 = type { float, float }
%struct.b2Rot = type { float, float }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }

; 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @b2MakeOffsetBox(ptr dead_on_unwind noalias writable sret(%struct.b2Polygon) align 4 %0, float noundef %1, float noundef %2, <2 x float> %3, <2 x float> %4) #4 {
  %6 = alloca %struct.b2Vec2, align 4
  %7 = alloca %struct.b2Rot, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca %struct.b2Transform, align 4
  %11 = alloca %struct.b2Vec2, align 4
  %12 = alloca %struct.b2Vec2, align 4
  %13 = alloca %struct.b2Vec2, align 4
  %14 = alloca %struct.b2Vec2, align 4
  %15 = alloca %struct.b2Vec2, align 4
  %16 = alloca %struct.b2Vec2, align 4
  %17 = alloca %struct.b2Vec2, align 4
  %18 = alloca %struct.b2Vec2, align 4
  %19 = alloca %struct.b2Vec2, align 4
  %20 = alloca %struct.b2Vec2, align 4
  %21 = alloca %struct.b2Vec2, align 4
  %22 = alloca %struct.b2Vec2, align 4
  %23 = alloca %struct.b2Vec2, align 4
  %24 = alloca %struct.b2Vec2, align 4
  %25 = alloca %struct.b2Vec2, align 4
  %26 = alloca %struct.b2Vec2, align 4
  store <2 x float> %3, ptr %6, align 4
  store <2 x float> %4, ptr %7, align 4
  store float %1, ptr %8, align 4, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  %27 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !9
  %28 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 144, i1 false)
  %29 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 4
  store i32 4, ptr %29, align 4, !tbaa !10
  %30 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %31 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %30, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %32 = getelementptr inbounds %struct.b2Vec2, ptr %12, i32 0, i32 0
  %33 = load float, ptr %8, align 4, !tbaa !5
  %34 = fneg float %33
  store float %34, ptr %32, align 4, !tbaa !14
  %35 = getelementptr inbounds %struct.b2Vec2, ptr %12, i32 0, i32 1
  %36 = load float, ptr %9, align 4, !tbaa !5
  %37 = fneg float %36
  store float %37, ptr %35, align 4, !tbaa !15
  %38 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 0
  %39 = load <2 x float>, ptr %38, align 4
  %40 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 1
  %41 = load <2 x float>, ptr %40, align 4
  %42 = load <2 x float>, ptr %12, align 4
  %43 = call <2 x float> @b2TransformPoint(<2 x float> %39, <2 x float> %41, <2 x float> %42)
  store <2 x float> %43, ptr %11, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %44 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %45 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %44, i64 0, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %46 = getelementptr inbounds %struct.b2Vec2, ptr %14, i32 0, i32 0
  %47 = load float, ptr %8, align 4, !tbaa !5
  store float %47, ptr %46, align 4, !tbaa !14
  %48 = getelementptr inbounds %struct.b2Vec2, ptr %14, i32 0, i32 1
  %49 = load float, ptr %9, align 4, !tbaa !5
  %50 = fneg float %49
  store float %50, ptr %48, align 4, !tbaa !15
  %51 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 0
  %52 = load <2 x float>, ptr %51, align 4
  %53 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 1
  %54 = load <2 x float>, ptr %53, align 4
  %55 = load <2 x float>, ptr %14, align 4
  %56 = call <2 x float> @b2TransformPoint(<2 x float> %52, <2 x float> %54, <2 x float> %55)
  store <2 x float> %56, ptr %13, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  %57 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %58 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %57, i64 0, i64 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %59 = getelementptr inbounds %struct.b2Vec2, ptr %16, i32 0, i32 0
  %60 = load float, ptr %8, align 4, !tbaa !5
  store float %60, ptr %59, align 4, !tbaa !14
  %61 = getelementptr inbounds %struct.b2Vec2, ptr %16, i32 0, i32 1
  %62 = load float, ptr %9, align 4, !tbaa !5
  store float %62, ptr %61, align 4, !tbaa !15
  %63 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 0
  %64 = load <2 x float>, ptr %63, align 4
  %65 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 1
  %66 = load <2 x float>, ptr %65, align 4
  %67 = load <2 x float>, ptr %16, align 4
  %68 = call <2 x float> @b2TransformPoint(<2 x float> %64, <2 x float> %66, <2 x float> %67)
  store <2 x float> %68, ptr %15, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %58, ptr align 4 %15, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  %69 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 0
  %70 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %69, i64 0, i64 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %71 = getelementptr inbounds %struct.b2Vec2, ptr %18, i32 0, i32 0
  %72 = load float, ptr %8, align 4, !tbaa !5
  %73 = fneg float %72
  store float %73, ptr %71, align 4, !tbaa !14
  %74 = getelementptr inbounds %struct.b2Vec2, ptr %18, i32 0, i32 1
  %75 = load float, ptr %9, align 4, !tbaa !5
  store float %75, ptr %74, align 4, !tbaa !15
  %76 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 0
  %77 = load <2 x float>, ptr %76, align 4
  %78 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %10, i32 0, i32 1
  %79 = load <2 x float>, ptr %78, align 4
  %80 = load <2 x float>, ptr %18, align 4
  %81 = call <2 x float> @b2TransformPoint(<2 x float> %77, <2 x float> %79, <2 x float> %80)
  store <2 x float> %81, ptr %17, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %70, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %82 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %83 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %82, i64 0, i64 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %84 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 1
  %85 = getelementptr inbounds %struct.b2Vec2, ptr %20, i32 0, i32 0
  store float 0.000000e+00, ptr %85, align 4, !tbaa !14
  %86 = getelementptr inbounds %struct.b2Vec2, ptr %20, i32 0, i32 1
  store float -1.000000e+00, ptr %86, align 4, !tbaa !15
  %87 = load <2 x float>, ptr %84, align 4
  %88 = load <2 x float>, ptr %20, align 4
  %89 = call <2 x float> @b2RotateVector(<2 x float> %87, <2 x float> %88)
  store <2 x float> %89, ptr %19, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %83, ptr align 4 %19, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %90 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %91 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %90, i64 0, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %92 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 1
  %93 = getelementptr inbounds %struct.b2Vec2, ptr %22, i32 0, i32 0
  store float 1.000000e+00, ptr %93, align 4, !tbaa !14
  %94 = getelementptr inbounds %struct.b2Vec2, ptr %22, i32 0, i32 1
  store float 0.000000e+00, ptr %94, align 4, !tbaa !15
  %95 = load <2 x float>, ptr %92, align 4
  %96 = load <2 x float>, ptr %22, align 4
  %97 = call <2 x float> @b2RotateVector(<2 x float> %95, <2 x float> %96)
  store <2 x float> %97, ptr %21, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %91, ptr align 4 %21, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  %98 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %99 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %98, i64 0, i64 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %100 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 1
  %101 = getelementptr inbounds %struct.b2Vec2, ptr %24, i32 0, i32 0
  store float 0.000000e+00, ptr %101, align 4, !tbaa !14
  %102 = getelementptr inbounds %struct.b2Vec2, ptr %24, i32 0, i32 1
  store float 1.000000e+00, ptr %102, align 4, !tbaa !15
  %103 = load <2 x float>, ptr %100, align 4
  %104 = load <2 x float>, ptr %24, align 4
  %105 = call <2 x float> @b2RotateVector(<2 x float> %103, <2 x float> %104)
  store <2 x float> %105, ptr %23, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %99, ptr align 4 %23, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  %106 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 1
  %107 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %106, i64 0, i64 3
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  %108 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 1
  %109 = getelementptr inbounds %struct.b2Vec2, ptr %26, i32 0, i32 0
  store float -1.000000e+00, ptr %109, align 4, !tbaa !14
  %110 = getelementptr inbounds %struct.b2Vec2, ptr %26, i32 0, i32 1
  store float 0.000000e+00, ptr %110, align 4, !tbaa !15
  %111 = load <2 x float>, ptr %108, align 4
  %112 = load <2 x float>, ptr %26, align 4
  %113 = call <2 x float> @b2RotateVector(<2 x float> %111, <2 x float> %112)
  store <2 x float> %113, ptr %25, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %107, ptr align 4 %25, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  %114 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 3
  store float 0.000000e+00, ptr %114, align 4, !tbaa !16
  %115 = getelementptr inbounds %struct.b2Polygon, ptr %0, i32 0, i32 2
  %116 = getelementptr inbounds %struct.b2Transform, ptr %10, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %115, ptr align 4 %116, i64 8, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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, !6, i64 0}
!6 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!10 = !{!11, !13, i64 140}
!11 = !{!"b2Polygon", !7, i64 0, !7, i64 64, !12, i64 128, !6, i64 136, !13, i64 140}
!12 = !{!"b2Vec2", !6, i64 0, !6, i64 4}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !6, i64 4}
!16 = !{!11, !6, i64 136}


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

%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%struct.b2Vec2 = type { float, float }

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @b2MakeOffsetBox(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.b2Polygon) align 4 %0, float noundef %1, float noundef %2, <2 x float> %3, <2 x float> %4) local_unnamed_addr #2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(144) %6, i8 0, i64 96, i1 false)
  %7 = getelementptr inbounds i8, ptr %0, i64 140
  store i32 4, ptr %7, align 4, !tbaa !5
  %8 = fneg float %1
  %.sroa.021.0.vec.insert = insertelement <2 x float> <float poison, float undef>, float %8, i64 0
  %9 = fneg float %2
  %.sroa.021.4.vec.insert = insertelement <2 x float> %.sroa.021.0.vec.insert, float %9, i64 1
  %10 = tail call <2 x float> @b2TransformPoint(<2 x float> %3, <2 x float> %4, <2 x float> %.sroa.021.4.vec.insert)
  store <2 x float> %10, ptr %0, align 4
  %11 = getelementptr inbounds i8, ptr %0, i64 8
  %.sroa.018.0.vec.insert = insertelement <2 x float> <float poison, float undef>, float %1, i64 0
  %.sroa.018.4.vec.insert = insertelement <2 x float> %.sroa.018.0.vec.insert, float %9, i64 1
  %12 = tail call <2 x float> @b2TransformPoint(<2 x float> %3, <2 x float> %4, <2 x float> %.sroa.018.4.vec.insert)
  store <2 x float> %12, ptr %11, align 4
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.015.4.vec.insert = insertelement <2 x float> %.sroa.018.0.vec.insert, float %2, i64 1
  %14 = tail call <2 x float> @b2TransformPoint(<2 x float> %3, <2 x float> %4, <2 x float> %.sroa.015.4.vec.insert)
  store <2 x float> %14, ptr %13, align 4
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  %.sroa.012.4.vec.insert = insertelement <2 x float> %.sroa.021.0.vec.insert, float %2, i64 1
  %16 = tail call <2 x float> @b2TransformPoint(<2 x float> %3, <2 x float> %4, <2 x float> %.sroa.012.4.vec.insert)
  store <2 x float> %16, ptr %15, align 4
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  %18 = tail call <2 x float> @b2RotateVector(<2 x float> %4, <2 x float> <float 0.000000e+00, float -1.000000e+00>)
  store <2 x float> %18, ptr %17, align 4
  %19 = getelementptr inbounds i8, ptr %0, i64 72
  %20 = tail call <2 x float> @b2RotateVector(<2 x float> %4, <2 x float> <float 1.000000e+00, float 0.000000e+00>)
  store <2 x float> %20, ptr %19, align 4
  %21 = getelementptr inbounds i8, ptr %0, i64 80
  %22 = tail call <2 x float> @b2RotateVector(<2 x float> %4, <2 x float> <float 0.000000e+00, float 1.000000e+00>)
  store <2 x float> %22, ptr %21, align 4
  %23 = getelementptr inbounds i8, ptr %0, i64 88
  %24 = tail call <2 x float> @b2RotateVector(<2 x float> %4, <2 x float> <float -1.000000e+00, float 0.000000e+00>)
  store <2 x float> %24, ptr %23, align 4
  %25 = getelementptr inbounds i8, ptr %0, i64 136
  store float 0.000000e+00, ptr %25, align 4, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %0, i64 128
  store <2 x float> %3, ptr %26, align 4
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 #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" }

!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 140}
!6 = !{!"b2Polygon", !7, i64 0, !7, i64 64, !9, i64 128, !10, i64 136, !11, i64 140}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"b2Vec2", !10, i64 0, !10, i64 4}
!10 = !{!"float", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!6, !10, i64 136}


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