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

; 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.b2CastOutput = type { %struct.b2Vec2, %struct.b2Vec2, float, i32, i8 }
%struct.b2Vec2 = type { float, float }
%struct.b2ShapeId = type { i32, i16, i16 }
%struct.b2Transform = type { %struct.b2Vec2, %struct.b2Rot }
%struct.b2Rot = type { float, float }
%struct.b2RayCastInput = type { %struct.b2Vec2, %struct.b2Vec2, float }
%struct.b2Shape = type { i32, i32, i32, i32, i32, i32, float, float, float, float, float, i32, %struct.b2AABB, %struct.b2AABB, %struct.b2Vec2, i32, %struct.b2Filter, ptr, i32, %union.anon.0, i16, i8, i8, i8, i8, i8 }
%struct.b2AABB = type { %struct.b2Vec2, %struct.b2Vec2 }
%struct.b2Filter = type { i64, i64, i32 }
%union.anon.0 = type { %struct.b2Polygon }
%struct.b2Polygon = type { [8 x %struct.b2Vec2], [8 x %struct.b2Vec2], %struct.b2Vec2, float, i32 }
%struct.b2ChainSegment = type { %struct.b2Vec2, %struct.b2Segment, %struct.b2Vec2, i32 }
%struct.b2Segment = type { %struct.b2Vec2, %struct.b2Vec2 }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare hidden ptr @b2GetShape(ptr noundef, i64) #5

declare ptr @b2GetWorld(i32 noundef) #2

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

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

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

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

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

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

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

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

declare { <2 x float>, <2 x float> } @b2GetBodyTransform(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @b2Shape_RayCast(ptr dead_on_unwind noalias writable sret(%struct.b2CastOutput) align 4 %0, i64 %1, ptr noundef %2) #7 {
  %4 = alloca %struct.b2ShapeId, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.b2Transform, align 4
  %9 = alloca %struct.b2RayCastInput, align 4
  %10 = alloca %struct.b2Vec2, align 4
  %11 = alloca %struct.b2Vec2, align 4
  %12 = alloca %struct.b2CastOutput, align 4
  %13 = alloca %struct.b2CastOutput, align 4
  %14 = alloca %struct.b2CastOutput, align 4
  %15 = alloca %struct.b2CastOutput, align 4
  %16 = alloca %struct.b2CastOutput, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.b2Vec2, align 4
  %19 = alloca %struct.b2Vec2, align 4
  store i64 %1, ptr %4, align 4
  store ptr %2, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %20 = getelementptr inbounds %struct.b2ShapeId, ptr %4, i32 0, i32 1
  %21 = load i16, ptr %20, align 4, !tbaa !9
  %22 = zext i16 %21 to i32
  %23 = call ptr @b2GetWorld(i32 noundef %22)
  store ptr %23, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load i64, ptr %4, align 4
  %26 = call ptr @b2GetShape(ptr noundef %24, i64 %25)
  store ptr %26, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #8
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.b2Shape, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = call { <2 x float>, <2 x float> } @b2GetBodyTransform(ptr noundef %27, i32 noundef %30)
  %32 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %33 = extractvalue { <2 x float>, <2 x float> } %31, 0
  store <2 x float> %33, ptr %32, align 4
  %34 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %35 = extractvalue { <2 x float>, <2 x float> } %31, 1
  store <2 x float> %35, ptr %34, align 4
  call void @llvm.lifetime.start.p0(i64 20, ptr %9) #8
  %36 = getelementptr inbounds %struct.b2RayCastInput, ptr %9, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.b2RayCastInput, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %40 = load <2 x float>, ptr %39, align 4
  %41 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %42 = load <2 x float>, ptr %41, align 4
  %43 = load <2 x float>, ptr %38, align 4
  %44 = call <2 x float> @b2InvTransformPoint(<2 x float> %40, <2 x float> %42, <2 x float> %43)
  store <2 x float> %44, ptr %10, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %45 = getelementptr inbounds %struct.b2RayCastInput, ptr %9, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %46 = getelementptr inbounds %struct.b2Transform, ptr %8, i32 0, i32 1
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.b2RayCastInput, ptr %47, i32 0, i32 1
  %49 = load <2 x float>, ptr %46, align 4
  %50 = load <2 x float>, ptr %48, align 4
  %51 = call <2 x float> @b2InvRotateVector(<2 x float> %49, <2 x float> %50)
  store <2 x float> %51, ptr %11, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.b2RayCastInput, ptr %52, i32 0, i32 2
  %54 = load float, ptr %53, align 4, !tbaa !23
  %55 = getelementptr inbounds %struct.b2RayCastInput, ptr %9, i32 0, i32 2
  store float %54, ptr %55, align 4, !tbaa !23
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 28, i1 false)
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.b2Shape, ptr %56, i32 0, i32 5
  %58 = load i32, ptr %57, align 4, !tbaa !25
  switch i32 %58, label %75 [
    i32 1, label %59
    i32 0, label %62
    i32 2, label %65
    i32 3, label %68
    i32 4, label %71
  ]

59:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 28, ptr %12) #8
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.b2Shape, ptr %60, i32 0, i32 19
  call void @b2RayCastCapsule(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %12, ptr noundef %9, ptr noundef %61)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %12, i64 28, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 28, ptr %12) #8
  br label %83

62:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 28, ptr %13) #8
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.b2Shape, ptr %63, i32 0, i32 19
  call void @b2RayCastCircle(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %13, ptr noundef %9, ptr noundef %64)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %13, i64 28, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 28, ptr %13) #8
  br label %83

65:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 28, ptr %14) #8
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.b2Shape, ptr %66, i32 0, i32 19
  call void @b2RayCastSegment(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %14, ptr noundef %9, ptr noundef %67, i1 noundef zeroext false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %14, i64 28, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 28, ptr %14) #8
  br label %83

68:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 28, ptr %15) #8
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.b2Shape, ptr %69, i32 0, i32 19
  call void @b2RayCastPolygon(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %15, ptr noundef %9, ptr noundef %70)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %15, i64 28, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 28, ptr %15) #8
  br label %83

71:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 28, ptr %16) #8
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.b2Shape, ptr %72, i32 0, i32 19
  %74 = getelementptr inbounds %struct.b2ChainSegment, ptr %73, i32 0, i32 1
  call void @b2RayCastSegment(ptr dead_on_unwind writable sret(%struct.b2CastOutput) align 4 %16, ptr noundef %9, ptr noundef %74, i1 noundef zeroext true)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %16, i64 28, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 28, ptr %16) #8
  br label %83

75:                                               ; preds = %3
  br label %76

76:                                               ; preds = %75
  %77 = call i32 @b2InternalAssertFcn(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 1041)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %76
  call void @llvm.trap()
  br label %80

80:                                               ; preds = %79, %76
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  store i32 1, ptr %17, align 4
  br label %103

83:                                               ; preds = %71, %68, %65, %62, %59
  %84 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 4
  %85 = load i8, ptr %84, align 4, !tbaa !29, !range !31, !noundef !32
  %86 = trunc i8 %85 to i1
  br i1 %86, label %87, label %102

87:                                               ; preds = %83
  %88 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %89 = getelementptr inbounds %struct.b2Transform, ptr %8, i32 0, i32 1
  %90 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 0
  %91 = load <2 x float>, ptr %89, align 4
  %92 = load <2 x float>, ptr %90, align 4
  %93 = call <2 x float> @b2RotateVector(<2 x float> %91, <2 x float> %92)
  store <2 x float> %93, ptr %18, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %88, ptr align 4 %18, i64 8, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  %94 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %95 = getelementptr inbounds %struct.b2CastOutput, ptr %0, i32 0, i32 1
  %96 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 0
  %97 = load <2 x float>, ptr %96, align 4
  %98 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %8, i32 0, i32 1
  %99 = load <2 x float>, ptr %98, align 4
  %100 = load <2 x float>, ptr %95, align 4
  %101 = call <2 x float> @b2TransformPoint(<2 x float> %97, <2 x float> %99, <2 x float> %100)
  store <2 x float> %101, ptr %19, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %94, ptr align 4 %19, i64 8, i1 false), !tbaa.struct !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %102

102:                                              ; preds = %87, %83
  store i32 1, ptr %17, align 4
  br label %103

103:                                              ; preds = %102, %82
  call void @llvm.lifetime.end.p0(i64 20, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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: readwrite) }
attributes #5 = { 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 #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 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 4}
!10 = !{!"b2ShapeId", !11, i64 0, !12, i64 4, !12, i64 6}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !11, i64 4}
!14 = !{!"b2Shape", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !15, i64 40, !11, i64 44, !16, i64 48, !16, i64 64, !17, i64 80, !11, i64 88, !18, i64 96, !6, i64 120, !11, i64 128, !7, i64 132, !12, i64 276, !20, i64 278, !20, i64 279, !20, i64 280, !20, i64 281, !20, i64 282}
!15 = !{!"float", !7, i64 0}
!16 = !{!"b2AABB", !17, i64 0, !17, i64 8}
!17 = !{!"b2Vec2", !15, i64 0, !15, i64 4}
!18 = !{!"b2Filter", !19, i64 0, !19, i64 8, !11, i64 16}
!19 = !{!"long", !7, i64 0}
!20 = !{!"_Bool", !7, i64 0}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22}
!22 = !{!15, !15, i64 0}
!23 = !{!24, !15, i64 16}
!24 = !{!"b2RayCastInput", !17, i64 0, !17, i64 8, !15, i64 16}
!25 = !{!14, !11, i64 20}
!26 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 4, !22, i64 12, i64 4, !22, i64 16, i64 4, !22, i64 20, i64 4, !27, i64 24, i64 1, !28}
!27 = !{!11, !11, i64 0}
!28 = !{!20, !20, i64 0}
!29 = !{!30, !20, i64 24}
!30 = !{!"b2CastOutput", !17, i64 0, !17, i64 8, !15, i64 16, !11, i64 20, !20, i64 24}
!31 = !{i8 0, i8 2}
!32 = !{}


; 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.b2CastOutput = type { %struct.b2Vec2, %struct.b2Vec2, float, i32, i8 }
%struct.b2Vec2 = type { float, float }
%struct.b2RayCastInput = type { %struct.b2Vec2, %struct.b2Vec2, float }

@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; 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: 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: nounwind uwtable
declare hidden ptr @b2GetShape(ptr noundef, i64) local_unnamed_addr #4

declare ptr @b2GetWorld(i32 noundef) local_unnamed_addr #2

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

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

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

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

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

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

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

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

declare { <2 x float>, <2 x float> } @b2GetBodyTransform(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @b2Shape_RayCast(ptr dead_on_unwind noalias nocapture writable sret(%struct.b2CastOutput) align 4 %0, i64 %1, ptr nocapture noundef readonly %2) local_unnamed_addr #6 {
  %4 = alloca %struct.b2RayCastInput, align 8
  %.sroa.2.0.extract.shift = lshr i64 %1, 32
  %5 = trunc nuw i64 %.sroa.2.0.extract.shift to i32
  %6 = and i32 %5, 65535
  %7 = tail call ptr @b2GetWorld(i32 noundef %6) #7
  %8 = tail call ptr @b2GetShape(ptr noundef %7, i64 %1)
  %9 = getelementptr inbounds i8, ptr %8, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = tail call { <2 x float>, <2 x float> } @b2GetBodyTransform(ptr noundef %7, i32 noundef %10) #7
  %12 = extractvalue { <2 x float>, <2 x float> } %11, 0
  %13 = extractvalue { <2 x float>, <2 x float> } %11, 1
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #7
  %14 = load <2 x float>, ptr %2, align 4
  %15 = tail call <2 x float> @b2InvTransformPoint(<2 x float> %12, <2 x float> %13, <2 x float> %14)
  store <2 x float> %15, ptr %4, align 8
  %16 = getelementptr inbounds i8, ptr %4, i64 8
  %17 = getelementptr inbounds i8, ptr %2, i64 8
  %18 = load <2 x float>, ptr %17, align 4
  %19 = tail call <2 x float> @b2InvRotateVector(<2 x float> %13, <2 x float> %18)
  store <2 x float> %19, ptr %16, align 8
  %20 = getelementptr inbounds i8, ptr %2, i64 16
  %21 = load float, ptr %20, align 4, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %4, i64 16
  store float %21, ptr %22, align 8, !tbaa !18
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(28) %0, i8 0, i64 28, i1 false)
  %23 = getelementptr inbounds i8, ptr %8, i64 20
  %24 = load i32, ptr %23, align 4, !tbaa !20
  switch i32 %24, label %35 [
    i32 1, label %25
    i32 0, label %27
    i32 2, label %29
    i32 3, label %31
    i32 4, label %33
  ]

25:                                               ; preds = %3
  %26 = getelementptr inbounds i8, ptr %8, i64 132
  call void @b2RayCastCapsule(ptr dead_on_unwind nonnull writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef nonnull %4, ptr noundef nonnull %26) #7
  br label %38

27:                                               ; preds = %3
  %28 = getelementptr inbounds i8, ptr %8, i64 132
  call void @b2RayCastCircle(ptr dead_on_unwind nonnull writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef nonnull %4, ptr noundef nonnull %28) #7
  br label %38

29:                                               ; preds = %3
  %30 = getelementptr inbounds i8, ptr %8, i64 132
  call void @b2RayCastSegment(ptr dead_on_unwind nonnull writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef nonnull %4, ptr noundef nonnull %30, i1 noundef zeroext false) #7
  br label %38

31:                                               ; preds = %3
  %32 = getelementptr inbounds i8, ptr %8, i64 132
  call void @b2RayCastPolygon(ptr dead_on_unwind nonnull writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef nonnull %4, ptr noundef nonnull %32) #7
  br label %38

33:                                               ; preds = %3
  %34 = getelementptr inbounds i8, ptr %8, i64 140
  call void @b2RayCastSegment(ptr dead_on_unwind nonnull writable sret(%struct.b2CastOutput) align 4 %0, ptr noundef nonnull %4, ptr noundef nonnull %34, i1 noundef zeroext true) #7
  br label %38

35:                                               ; preds = %3
  %36 = tail call i32 @b2InternalAssertFcn(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 1041) #7
  %.not = icmp eq i32 %36, 0
  br i1 %.not, label %48, label %37

37:                                               ; preds = %35
  tail call void @llvm.trap()
  unreachable

38:                                               ; preds = %33, %31, %29, %27, %25
  %39 = getelementptr inbounds i8, ptr %0, i64 24
  %40 = load i8, ptr %39, align 4, !tbaa !21, !range !23, !noundef !24
  %41 = trunc nuw i8 %40 to i1
  br i1 %41, label %42, label %48

42:                                               ; preds = %38
  %43 = load <2 x float>, ptr %0, align 4
  %44 = call <2 x float> @b2RotateVector(<2 x float> %13, <2 x float> %43)
  store <2 x float> %44, ptr %0, align 4
  %45 = getelementptr inbounds i8, ptr %0, i64 8
  %46 = load <2 x float>, ptr %45, align 4
  %47 = call <2 x float> @b2TransformPoint(<2 x float> %12, <2 x float> %13, <2 x float> %46)
  store <2 x float> %47, ptr %45, align 4
  br label %48

48:                                               ; preds = %38, %42, %35
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #7
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = { 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, !7, i64 4}
!6 = !{!"b2Shape", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !7, i64 44, !11, i64 48, !11, i64 64, !12, i64 80, !7, i64 88, !13, i64 96, !15, i64 120, !7, i64 128, !8, i64 132, !16, i64 276, !17, i64 278, !17, i64 279, !17, i64 280, !17, i64 281, !17, i64 282}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"b2AABB", !12, i64 0, !12, i64 8}
!12 = !{!"b2Vec2", !10, i64 0, !10, i64 4}
!13 = !{!"b2Filter", !14, i64 0, !14, i64 8, !7, i64 16}
!14 = !{!"long", !8, i64 0}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{!19, !10, i64 16}
!19 = !{!"b2RayCastInput", !12, i64 0, !12, i64 8, !10, i64 16}
!20 = !{!6, !7, i64 20}
!21 = !{!22, !17, i64 24}
!22 = !{!"b2CastOutput", !12, i64 0, !12, i64 8, !10, i64 16, !7, i64 20, !17, i64 24}
!23 = !{i8 0, i8 2}
!24 = !{}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass