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

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@b2Transform_identity = external hidden constant %struct.b2Transform, align 4
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @b2IsValidRay(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

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 nounwind uwtable
declare hidden <2 x float> @b2Sub(<2 x float>, <2 x float>) #6

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden <2 x float> @b2MulAdd(<2 x float>, float noundef, <2 x float>) #6

declare void @b2MakeProxy(ptr dead_on_unwind writable sret(%struct.b2ShapeProxy) align 4, ptr noundef, i32 noundef, float noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @b2RayCastPolygon(ptr dead_on_unwind noalias writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.b2Vec2, align 4
  %7 = alloca %struct.b2Vec2, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca float, align 4
  %14 = alloca %struct.b2Vec2, align 4
  %15 = alloca float, align 4
  %16 = alloca %struct.b2Vec2, align 4
  %17 = alloca %struct.b2ShapeCastPairInput, align 4
  %18 = alloca %struct.b2ShapeProxy, align 4
  %19 = alloca %struct.b2ShapeProxy, align 4
  store ptr %1, ptr %4, align 8, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call zeroext i1 @b2IsValidRay(ptr noundef %21)
  br i1 %22, label %27, label %23

23:                                               ; preds = %20
  %24 = call i32 @b2InternalAssertFcn(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 781)
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  call void @llvm.trap()
  br label %27

27:                                               ; preds = %26, %23, %20
  br label %28

28:                                               ; preds = %27
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.b2Polygon, ptr %29, i32 0, i32 3
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = fcmp oeq float %31, 0.000000e+00
  br i1 %32, label %33, label %159

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.b2RayCastInput, ptr %34, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %35, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.b2RayCastInput, ptr %36, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %37, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store float 0.000000e+00, ptr %8, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.b2RayCastInput, ptr %38, i32 0, i32 2
  %40 = load float, ptr %39, align 4, !tbaa !16
  store float %40, ptr %9, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 -1, ptr %10, align 4, !tbaa !18
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !18
  br label %41

41:                                               ; preds = %118, %33
  %42 = load i32, ptr %11, align 4, !tbaa !18
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.b2Polygon, ptr %43, i32 0, i32 4
  %45 = load i32, ptr %44, align 4, !tbaa !19
  %46 = icmp slt i32 %42, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %41
  store i32 4, ptr %12, align 4
  br label %121

48:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.b2Polygon, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %11, align 4, !tbaa !18
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %50, i64 0, i64 %52
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.b2Polygon, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %11, align 4, !tbaa !18
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %55, i64 0, i64 %57
  %59 = load <2 x float>, ptr %58, align 4
  %60 = load <2 x float>, ptr %6, align 4
  %61 = call <2 x float> @b2Sub(<2 x float> %59, <2 x float> %60)
  store <2 x float> %61, ptr %14, align 4
  %62 = load <2 x float>, ptr %53, align 4
  %63 = load <2 x float>, ptr %14, align 4
  %64 = call float @b2Dot(<2 x float> %62, <2 x float> %63)
  store float %64, ptr %13, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.b2Polygon, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %11, align 4, !tbaa !18
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %66, i64 0, i64 %68
  %70 = load <2 x float>, ptr %69, align 4
  %71 = load <2 x float>, ptr %7, align 4
  %72 = call float @b2Dot(<2 x float> %70, <2 x float> %71)
  store float %72, ptr %15, align 4, !tbaa !15
  %73 = load float, ptr %15, align 4, !tbaa !15
  %74 = fcmp oeq float %73, 0.000000e+00
  br i1 %74, label %75, label %80

75:                                               ; preds = %48
  %76 = load float, ptr %13, align 4, !tbaa !15
  %77 = fcmp olt float %76, 0.000000e+00
  br i1 %77, label %78, label %79

78:                                               ; preds = %75
  store i32 1, ptr %12, align 4
  br label %115

79:                                               ; preds = %75
  br label %109

80:                                               ; preds = %48
  %81 = load float, ptr %15, align 4, !tbaa !15
  %82 = fcmp olt float %81, 0.000000e+00
  br i1 %82, label %83, label %94

83:                                               ; preds = %80
  %84 = load float, ptr %13, align 4, !tbaa !15
  %85 = load float, ptr %8, align 4, !tbaa !15
  %86 = load float, ptr %15, align 4, !tbaa !15
  %87 = fmul float %85, %86
  %88 = fcmp olt float %84, %87
  br i1 %88, label %89, label %94

89:                                               ; preds = %83
  %90 = load float, ptr %13, align 4, !tbaa !15
  %91 = load float, ptr %15, align 4, !tbaa !15
  %92 = fdiv float %90, %91
  store float %92, ptr %8, align 4, !tbaa !15
  %93 = load i32, ptr %11, align 4, !tbaa !18
  store i32 %93, ptr %10, align 4, !tbaa !18
  br label %108

94:                                               ; preds = %83, %80
  %95 = load float, ptr %15, align 4, !tbaa !15
  %96 = fcmp ogt float %95, 0.000000e+00
  br i1 %96, label %97, label %107

97:                                               ; preds = %94
  %98 = load float, ptr %13, align 4, !tbaa !15
  %99 = load float, ptr %9, align 4, !tbaa !15
  %100 = load float, ptr %15, align 4, !tbaa !15
  %101 = fmul float %99, %100
  %102 = fcmp olt float %98, %101
  br i1 %102, label %103, label %107

103:                                              ; preds = %97
  %104 = load float, ptr %13, align 4, !tbaa !15
  %105 = load float, ptr %15, align 4, !tbaa !15
  %106 = fdiv float %104, %105
  store float %106, ptr %9, align 4, !tbaa !15
  br label %107

107:                                              ; preds = %103, %97, %94
  br label %108

108:                                              ; preds = %107, %89
  br label %109

109:                                              ; preds = %108, %79
  %110 = load float, ptr %9, align 4, !tbaa !15
  %111 = load float, ptr %8, align 4, !tbaa !15
  %112 = fcmp olt float %110, %111
  br i1 %112, label %113, label %114

113:                                              ; preds = %109
  store i32 1, ptr %12, align 4
  br label %115

114:                                              ; preds = %109
  store i32 0, ptr %12, align 4
  br label %115

115:                                              ; preds = %114, %113, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %116 = load i32, ptr %12, align 4
  switch i32 %116, label %121 [
    i32 0, label %117
  ]

117:                                              ; preds = %115
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %11, align 4, !tbaa !18
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %11, align 4, !tbaa !18
  br label %41, !llvm.loop !20

121:                                              ; preds = %115, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  %122 = load i32, ptr %12, align 4
  switch i32 %122, label %158 [
    i32 4, label %123
  ]

123:                                              ; preds = %121
  br label %124

124:                                              ; preds = %123
  %125 = load float, ptr %8, align 4, !tbaa !15
  %126 = fcmp ole float 0.000000e+00, %125
  br i1 %126, label %127, label %133

127:                                              ; preds = %124
  %128 = load float, ptr %8, align 4, !tbaa !15
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.b2RayCastInput, ptr %129, i32 0, i32 2
  %131 = load float, ptr %130, align 4, !tbaa !16
  %132 = fcmp ole float %128, %131
  br i1 %132, label %137, label %133

133:                                              ; preds = %127, %124
  %134 = call i32 @b2InternalAssertFcn(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 841)
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %133
  call void @llvm.trap()
  br label %137

137:                                              ; preds = %136, %133, %127
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %10, align 4, !tbaa !18
  %141 = icmp sge i32 %140, 0
  br i1 %141, label %142, label %157

142:                                              ; preds = %139
  %143 = load float, ptr %8, align 4, !tbaa !15
  %144 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 2
  store float %143, ptr %144, align 4, !tbaa !22
  %145 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 0
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.b2Polygon, ptr %146, i32 0, i32 1
  %148 = load i32, ptr %10, align 4, !tbaa !18
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %147, i64 0, i64 %149
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %145, ptr align 4 %150, i64 8, i1 false), !tbaa.struct !14
  %151 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %152 = load float, ptr %8, align 4, !tbaa !15
  %153 = load <2 x float>, ptr %6, align 4
  %154 = load <2 x float>, ptr %7, align 4
  %155 = call <2 x float> @b2MulAdd(<2 x float> %153, float noundef %152, <2 x float> %154)
  store <2 x float> %155, ptr %16, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %151, ptr align 4 %16, i64 8, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  %156 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 4
  store i8 1, ptr %156, align 4, !tbaa !25
  br label %157

157:                                              ; preds = %142, %139
  store i32 1, ptr %12, align 4
  br label %158

158:                                              ; preds = %157, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, 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
  br label %183

159:                                              ; preds = %28
  call void @llvm.lifetime.start.p0(i64 192, ptr %17) #7
  %160 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 72, ptr %18) #7
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.b2Polygon, ptr %161, i32 0, i32 0
  %163 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %162, i64 0, i64 0
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.b2Polygon, ptr %164, i32 0, i32 4
  %166 = load i32, ptr %165, align 4, !tbaa !19
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.b2Polygon, ptr %167, i32 0, i32 3
  %169 = load float, ptr %168, align 4, !tbaa !9
  call void @b2MakeProxy(ptr dead_on_unwind writable sret(%struct.b2ShapeProxy) align 4 %18, ptr noundef %163, i32 noundef %166, float noundef %169)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %160, ptr align 4 %18, i64 72, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #7
  %170 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 72, ptr %19) #7
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.b2RayCastInput, ptr %171, i32 0, i32 0
  call void @b2MakeProxy(ptr dead_on_unwind writable sret(%struct.b2ShapeProxy) align 4 %19, ptr noundef %172, i32 noundef 1, float noundef 0.000000e+00)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %170, ptr align 4 %19, i64 72, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 72, ptr %19) #7
  %173 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %173, ptr align 4 @b2Transform_identity, i64 16, i1 false), !tbaa.struct !28
  %174 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %174, ptr align 4 @b2Transform_identity, i64 16, i1 false), !tbaa.struct !28
  %175 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 4
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.b2RayCastInput, ptr %176, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %175, ptr align 4 %177, i64 8, i1 false), !tbaa.struct !14
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.b2RayCastInput, ptr %178, i32 0, i32 2
  %180 = load float, ptr %179, align 4, !tbaa !16
  %181 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 5
  store float %180, ptr %181, align 4, !tbaa !29
  %182 = getelementptr inbounds %struct.b2ShapeCastPairInput, ptr %17, i32 0, i32 6
  store i8 0, ptr %182, align 4, !tbaa !34
  call void @b2ShapeCast(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef %17)
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 192, ptr %17) #7
  br label %183

183:                                              ; preds = %159, %158
  ret void
}

declare void @b2ShapeCast(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4, ptr noundef) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #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, !12, i64 136}
!10 = !{!"b2Polygon", !7, i64 0, !7, i64 64, !11, i64 128, !12, i64 136, !13, i64 140}
!11 = !{!"b2Vec2", !12, i64 0, !12, i64 4}
!12 = !{!"float", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{i64 0, i64 4, !15, i64 4, i64 4, !15}
!15 = !{!12, !12, i64 0}
!16 = !{!17, !12, i64 16}
!17 = !{!"b2RayCastInput", !11, i64 0, !11, i64 8, !12, i64 16}
!18 = !{!13, !13, i64 0}
!19 = !{!10, !13, i64 140}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !12, i64 16}
!23 = !{!"b2CastOutput", !11, i64 0, !11, i64 8, !12, i64 16, !13, i64 20, !24, i64 24}
!24 = !{!"_Bool", !7, i64 0}
!25 = !{!23, !24, i64 24}
!26 = !{i64 0, i64 64, !27, i64 64, i64 4, !18, i64 68, i64 4, !15}
!27 = !{!7, !7, i64 0}
!28 = !{i64 0, i64 4, !15, i64 4, i64 4, !15, i64 8, i64 4, !15, i64 12, i64 4, !15}
!29 = !{!30, !12, i64 184}
!30 = !{!"b2ShapeCastPairInput", !31, i64 0, !31, i64 72, !32, i64 144, !32, i64 160, !11, i64 176, !12, i64 184, !24, i64 188}
!31 = !{!"b2ShapeProxy", !7, i64 0, !13, i64 64, !12, i64 68}
!32 = !{!"b2Transform", !11, i64 0, !33, i64 8}
!33 = !{!"b2Rot", !12, i64 0, !12, i64 4}
!34 = !{!30, !24, i64 188}


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

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@b2Transform_identity = external hidden local_unnamed_addr constant %struct.b2Transform, align 4
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @b2IsValidRay(ptr noundef) local_unnamed_addr #0

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

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

declare i32 @b2InternalAssertFcn(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #3

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

; Function Attrs: mustprogress 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 nounwind uwtable
declare hidden <2 x float> @b2Sub(<2 x float>, <2 x float>) local_unnamed_addr #6

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

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

declare void @b2MakeProxy(ptr dead_on_unwind writable sret(%struct.b2ShapeProxy) align 4, ptr noundef, i32 noundef, float noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @b2RayCastPolygon(ptr dead_on_unwind noalias writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.b2ShapeCastPairInput, align 4
  %5 = alloca %struct.b2ShapeProxy, align 4
  %6 = tail call zeroext i1 @b2IsValidRay(ptr noundef %1)
  br i1 %6, label %10, label %7

7:                                                ; preds = %3
  %8 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 781) #7
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %10, label %9

9:                                                ; preds = %7
  tail call void @llvm.trap()
  unreachable

10:                                               ; preds = %3, %7
  %11 = getelementptr inbounds i8, ptr %2, i64 136
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fcmp oeq float %12, 0.000000e+00
  br i1 %13, label %14, label %68

14:                                               ; preds = %10
  %.sroa.033.0.copyload = load <2 x float>, ptr %1, align 4
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %.sroa.031.0.copyload = load <2 x float>, ptr %15, align 4
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load float, ptr %16, align 4, !tbaa !12
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %0, i8 0, i64 28, i1 false)
  %18 = getelementptr inbounds i8, ptr %2, i64 140
  %19 = load i32, ptr %18, align 4, !tbaa !14
  %.not6579 = icmp sgt i32 %19, 0
  br i1 %.not6579, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %14
  %20 = getelementptr inbounds i8, ptr %2, i64 64
  br label %24

21:                                               ; preds = %49
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr %18, align 4, !tbaa !14
  %23 = sext i32 %22 to i64
  %.not65 = icmp slt i64 %indvars.iv.next, %23
  br i1 %.not65, label %24, label %._crit_edge, !llvm.loop !15

24:                                               ; preds = %.lr.ph, %21
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %21 ]
  %.083 = phi float [ 0.000000e+00, %.lr.ph ], [ %.1, %21 ]
  %.05282 = phi float [ %17, %.lr.ph ], [ %.153, %21 ]
  %.05581 = phi i32 [ -1, %.lr.ph ], [ %.156, %21 ]
  %25 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %20, i64 0, i64 %indvars.iv
  %26 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %2, i64 0, i64 %indvars.iv
  %27 = load <2 x float>, ptr %26, align 4
  %28 = tail call <2 x float> @b2Sub(<2 x float> %27, <2 x float> %.sroa.033.0.copyload)
  %29 = load <2 x float>, ptr %25, align 4
  %30 = tail call float @b2Dot(<2 x float> %29, <2 x float> %28)
  %31 = load <2 x float>, ptr %25, align 4
  %32 = tail call float @b2Dot(<2 x float> %31, <2 x float> %.sroa.031.0.copyload)
  %33 = fcmp oeq float %32, 0.000000e+00
  br i1 %33, label %34, label %36

34:                                               ; preds = %24
  %35 = fcmp olt float %30, 0.000000e+00
  br i1 %35, label %.thread74, label %49

36:                                               ; preds = %24
  %37 = fcmp olt float %32, 0.000000e+00
  %38 = fmul float %.083, %32
  %39 = fcmp olt float %30, %38
  %or.cond = select i1 %37, i1 %39, i1 false
  br i1 %or.cond, label %40, label %43

40:                                               ; preds = %36
  %41 = fdiv float %30, %32
  %42 = trunc nuw nsw i64 %indvars.iv to i32
  br label %49

43:                                               ; preds = %36
  %44 = fcmp ogt float %32, 0.000000e+00
  %45 = fmul float %.05282, %32
  %46 = fcmp olt float %30, %45
  %or.cond69 = select i1 %44, i1 %46, i1 false
  br i1 %or.cond69, label %47, label %49

47:                                               ; preds = %43
  %48 = fdiv float %30, %32
  br label %49

49:                                               ; preds = %34, %43, %47, %40
  %.156 = phi i32 [ %.05581, %34 ], [ %42, %40 ], [ %.05581, %47 ], [ %.05581, %43 ]
  %.153 = phi float [ %.05282, %34 ], [ %.05282, %40 ], [ %48, %47 ], [ %.05282, %43 ]
  %.1 = phi float [ %.083, %34 ], [ %41, %40 ], [ %.083, %47 ], [ %.083, %43 ]
  %50 = fcmp uge float %.153, %.1
  br i1 %50, label %21, label %.thread74

._crit_edge:                                      ; preds = %21
  %51 = fcmp ult float %.1, 0.000000e+00
  br i1 %51, label %54, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %14, %._crit_edge
  %.0.lcssa93 = phi float [ %.1, %._crit_edge ], [ 0.000000e+00, %14 ]
  %.055.lcssa90 = phi i32 [ %.156, %._crit_edge ], [ -1, %14 ]
  %52 = load float, ptr %16, align 4, !tbaa !12
  %53 = fcmp ugt float %.0.lcssa93, %52
  br i1 %53, label %54, label %57

54:                                               ; preds = %._crit_edge.thread, %._crit_edge
  %.0.lcssa92 = phi float [ %.0.lcssa93, %._crit_edge.thread ], [ %.1, %._crit_edge ]
  %.055.lcssa89 = phi i32 [ %.055.lcssa90, %._crit_edge.thread ], [ %.156, %._crit_edge ]
  %55 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 841) #7
  %.not66 = icmp eq i32 %55, 0
  br i1 %.not66, label %57, label %56

56:                                               ; preds = %54
  tail call void @llvm.trap()
  unreachable

57:                                               ; preds = %54, %._crit_edge.thread
  %.0.lcssa91 = phi float [ %.0.lcssa92, %54 ], [ %.0.lcssa93, %._crit_edge.thread ]
  %.055.lcssa88 = phi i32 [ %.055.lcssa89, %54 ], [ %.055.lcssa90, %._crit_edge.thread ]
  %58 = icmp sgt i32 %.055.lcssa88, -1
  br i1 %58, label %59, label %.thread74

59:                                               ; preds = %57
  %60 = getelementptr inbounds i8, ptr %0, i64 16
  store float %.0.lcssa91, ptr %60, align 4, !tbaa !17
  %61 = getelementptr inbounds i8, ptr %2, i64 64
  %62 = zext nneg i32 %.055.lcssa88 to i64
  %63 = getelementptr inbounds [8 x %struct.b2Vec2], ptr %61, i64 0, i64 %62
  %64 = load i64, ptr %63, align 4
  store i64 %64, ptr %0, align 4
  %65 = getelementptr inbounds i8, ptr %0, i64 8
  %66 = tail call <2 x float> @b2MulAdd(<2 x float> %.sroa.033.0.copyload, float noundef %.0.lcssa91, <2 x float> %.sroa.031.0.copyload)
  store <2 x float> %66, ptr %65, align 4
  %67 = getelementptr inbounds i8, ptr %0, i64 24
  store i8 1, ptr %67, align 4, !tbaa !20
  br label %.thread74

68:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %4) #7
  %69 = getelementptr inbounds i8, ptr %2, i64 140
  %70 = load i32, ptr %69, align 4, !tbaa !14
  call void @b2MakeProxy(ptr dead_on_unwind nonnull writable sret(%struct.b2ShapeProxy) align 4 %4, ptr noundef nonnull %2, i32 noundef %70, float noundef %12) #7
  %71 = getelementptr inbounds i8, ptr %4, i64 72
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %5) #7
  call void @b2MakeProxy(ptr dead_on_unwind nonnull writable sret(%struct.b2ShapeProxy) align 4 %5, ptr noundef %1, i32 noundef 1, float noundef 0.000000e+00) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(72) %71, ptr noundef nonnull align 4 dereferenceable(72) %5, i64 72, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %5) #7
  %72 = getelementptr inbounds i8, ptr %4, i64 144
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %72, ptr noundef nonnull align 4 dereferenceable(16) @b2Transform_identity, i64 16, i1 false), !tbaa.struct !25
  %73 = getelementptr inbounds i8, ptr %4, i64 160
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %73, ptr noundef nonnull align 4 dereferenceable(16) @b2Transform_identity, i64 16, i1 false), !tbaa.struct !25
  %74 = getelementptr inbounds i8, ptr %4, i64 176
  %75 = getelementptr inbounds i8, ptr %1, i64 8
  %76 = load i64, ptr %75, align 4
  store i64 %76, ptr %74, align 4
  %77 = getelementptr inbounds i8, ptr %1, i64 16
  %78 = load float, ptr %77, align 4, !tbaa !12
  %79 = getelementptr inbounds i8, ptr %4, i64 184
  store float %78, ptr %79, align 4, !tbaa !26
  %80 = getelementptr inbounds i8, ptr %4, i64 188
  store i8 0, ptr %80, align 4, !tbaa !31
  call void @b2ShapeCast(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %4) #7
  br label %.thread74

.thread74:                                        ; preds = %34, %49, %59, %57, %68
  ret void
}

declare void @b2ShapeCast(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4, ptr noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { cold noreturn nounwind memory(inaccessiblemem: write) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #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, !10, i64 136}
!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 = !{!13, !10, i64 16}
!13 = !{!"b2RayCastInput", !9, i64 0, !9, i64 8, !10, i64 16}
!14 = !{!6, !11, i64 140}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !10, i64 16}
!18 = !{!"b2CastOutput", !9, i64 0, !9, i64 8, !10, i64 16, !11, i64 20, !19, i64 24}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{!18, !19, i64 24}
!21 = !{i64 0, i64 64, !22, i64 64, i64 4, !23, i64 68, i64 4, !24}
!22 = !{!7, !7, i64 0}
!23 = !{!11, !11, i64 0}
!24 = !{!10, !10, i64 0}
!25 = !{i64 0, i64 4, !24, i64 4, i64 4, !24, i64 8, i64 4, !24, i64 12, i64 4, !24}
!26 = !{!27, !10, i64 184}
!27 = !{!"b2ShapeCastPairInput", !28, i64 0, !28, i64 72, !29, i64 144, !29, i64 160, !9, i64 176, !10, i64 184, !19, i64 188}
!28 = !{!"b2ShapeProxy", !7, i64 0, !11, i64 64, !10, i64 68}
!29 = !{!"b2Transform", !9, i64 0, !30, i64 8}
!30 = !{!"b2Rot", !10, i64 0, !10, i64 4}
!31 = !{!27, !19, i64 188}


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