; LLVM IR from Mithreindeir/VelocityRaptor :: VelocityRaptor/src (vrShapeCreate)

; 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.vrTriangle = type { %struct.vrVec2, %struct.vrVec2, %struct.vrVec2 }
%struct.vrVec2 = type { float, float }
%struct.vrShapeMold = type { i32, %struct.vrVec2, %union.anon }
%union.anon = type { %struct.vrPolygonMold }
%struct.vrPolygonMold = type { ptr, i32, i32 }
%struct.vrShape = type { ptr, i32, ptr, ptr, ptr, ptr, %struct.vrOrientedBoundingBox }
%struct.vrOrientedBoundingBox = type { %struct.vrVec2, %struct.vrVec2 }
%struct.vrCircleShape = type { float, %struct.vrVec2 }
%struct.vrCircleMold = type { %struct.vrVec2, float }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @vrShapeMoldGetShape(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.vrTriangle, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %15 = call ptr (...) @vrArrayAlloc()
  %16 = call ptr @vrArrayInit(ptr noundef %15, i32 noundef 8)
  store ptr %16, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.vrShapeMold, ptr %17, i32 0, i32 0
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %44

21:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %22 = call ptr (...) @vrShapeAlloc()
  %23 = call ptr @vrShapeInit(ptr noundef %22)
  store ptr %23, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call ptr @vrShapeCircleInit(ptr noundef %24)
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.vrShape, ptr %26, i32 0, i32 0
  store ptr %25, ptr %27, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.vrShape, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  store ptr %30, ptr %5, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.vrCircleShape, ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.vrShapeMold, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds %struct.vrCircleMold, ptr %34, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 8 %35, i64 8, i1 false), !tbaa.struct !17
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.vrShapeMold, ptr %36, i32 0, i32 2
  %38 = getelementptr inbounds %struct.vrCircleMold, ptr %37, i32 0, i32 1
  %39 = load float, ptr %38, align 8, !tbaa !19
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.vrCircleShape, ptr %40, i32 0, i32 0
  store float %39, ptr %41, align 4, !tbaa !20
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  call void @vrArrayPush(ptr noundef %42, ptr noundef %43)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %158

44:                                               ; preds = %1
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.vrShapeMold, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !9
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %157

49:                                               ; preds = %44
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.vrShapeMold, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds %struct.vrPolygonMold, ptr %51, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !19
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %122

55:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.vrShapeMold, ptr %56, i32 0, i32 2
  %58 = getelementptr inbounds %struct.vrPolygonMold, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !19
  %60 = sext i32 %59 to i64
  %61 = mul i64 8, %60
  %62 = call noalias ptr @malloc(i64 noundef %61) #6
  store ptr %62, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !22
  br label %63

63:                                               ; preds = %83, %55
  %64 = load i32, ptr %8, align 4, !tbaa !22
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.vrShapeMold, ptr %65, i32 0, i32 2
  %67 = getelementptr inbounds %struct.vrPolygonMold, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 8, !tbaa !19
  %69 = icmp slt i32 %64, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %86

71:                                               ; preds = %63
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = load i32, ptr %8, align 4, !tbaa !22
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %struct.vrVec2, ptr %72, i64 %74
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.vrShapeMold, ptr %76, i32 0, i32 2
  %78 = getelementptr inbounds %struct.vrPolygonMold, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  %80 = load i32, ptr %8, align 4, !tbaa !22
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.vrVec2, ptr %79, i64 %81
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %75, ptr align 4 %82, i64 8, i1 false), !tbaa.struct !17
  br label %83

83:                                               ; preds = %71
  %84 = load i32, ptr %8, align 4, !tbaa !22
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !22
  br label %63, !llvm.loop !23

86:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.vrShapeMold, ptr %88, i32 0, i32 2
  %90 = getelementptr inbounds %struct.vrPolygonMold, ptr %89, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !19
  %92 = call ptr @vrEarClip(ptr noundef %87, i32 noundef %91, ptr noundef %6)
  store ptr %92, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !22
  br label %93

93:                                               ; preds = %118, %86
  %94 = load i32, ptr %10, align 4, !tbaa !22
  %95 = load i32, ptr %6, align 4, !tbaa !22
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %121

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !22
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds %struct.vrTriangle, ptr %99, i64 %101
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %102, i64 24, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %103 = call ptr (...) @vrShapeAlloc()
  %104 = call ptr @vrShapeInit(ptr noundef %103)
  store ptr %104, ptr %12, align 8, !tbaa !5
  %105 = load ptr, ptr %12, align 8, !tbaa !5
  %106 = call ptr @vrShapePolyInit(ptr noundef %105)
  store ptr %106, ptr %12, align 8, !tbaa !5
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.vrShape, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !14
  %110 = call ptr @vrPolyTriangleInit(ptr noundef %109, ptr noundef byval(%struct.vrTriangle) align 8 %11)
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.vrShape, ptr %111, i32 0, i32 0
  store ptr %110, ptr %112, align 8, !tbaa !14
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.vrShape, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !14
  call void @vrUpdatePolyAxes(ptr noundef %115)
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = load ptr, ptr %12, align 8, !tbaa !5
  call void @vrArrayPush(ptr noundef %116, ptr noundef %117)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  br label %118

118:                                              ; preds = %98
  %119 = load i32, ptr %10, align 4, !tbaa !22
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %10, align 4, !tbaa !22
  br label %93, !llvm.loop !26

121:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %156

122:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %123 = call ptr (...) @vrShapeAlloc()
  %124 = call ptr @vrShapeInit(ptr noundef %123)
  store ptr %124, ptr %13, align 8, !tbaa !5
  %125 = load ptr, ptr %13, align 8, !tbaa !5
  %126 = call ptr @vrShapePolyInit(ptr noundef %125)
  store ptr %126, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !22
  br label %127

127:                                              ; preds = %147, %122
  %128 = load i32, ptr %14, align 4, !tbaa !22
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.vrShapeMold, ptr %129, i32 0, i32 2
  %131 = getelementptr inbounds %struct.vrPolygonMold, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 8, !tbaa !19
  %133 = icmp slt i32 %128, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %150

135:                                              ; preds = %127
  %136 = load ptr, ptr %13, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.vrShape, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8, !tbaa !14
  %139 = load ptr, ptr %2, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.vrShapeMold, ptr %139, i32 0, i32 2
  %141 = getelementptr inbounds %struct.vrPolygonMold, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !19
  %143 = load i32, ptr %14, align 4, !tbaa !22
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds %struct.vrVec2, ptr %142, i64 %144
  %146 = load <2 x float>, ptr %145, align 4
  call void @vrAddVertexToPolyShape(ptr noundef %138, <2 x float> %146)
  br label %147

147:                                              ; preds = %135
  %148 = load i32, ptr %14, align 4, !tbaa !22
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %14, align 4, !tbaa !22
  br label %127, !llvm.loop !27

150:                                              ; preds = %134
  %151 = load ptr, ptr %13, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.vrShape, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !14
  call void @vrUpdatePolyAxes(ptr noundef %153)
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  call void @vrArrayPush(ptr noundef %154, ptr noundef %155)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %156

156:                                              ; preds = %150, %121
  br label %157

157:                                              ; preds = %156, %44
  br label %158

158:                                              ; preds = %157, %21
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret ptr %159
}

declare ptr @vrArrayInit(ptr noundef, i32 noundef) #4

declare ptr @vrArrayAlloc(...) #4

declare ptr @vrShapeInit(ptr noundef) #4

declare ptr @vrShapeAlloc(...) #4

declare ptr @vrShapeCircleInit(ptr noundef) #4

declare void @vrArrayPush(ptr noundef, ptr noundef) #4

declare ptr @vrEarClip(ptr noundef, i32 noundef, ptr noundef) #4

declare ptr @vrShapePolyInit(ptr noundef) #4

declare ptr @vrPolyTriangleInit(ptr noundef, ptr noundef byval(%struct.vrTriangle) align 8) #4

declare void @vrUpdatePolyAxes(ptr noundef) #4

declare void @vrAddVertexToPolyShape(ptr noundef, <2 x float>) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 #3 = { 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 = { "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 }
attributes #6 = { nounwind allocsize(0) }

!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, !11, i64 0}
!10 = !{!"vrShapeMold", !11, i64 0, !12, i64 4, !7, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!"vrVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"vrShape", !6, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !16, i64 48}
!16 = !{!"vrOrientedBoundingBox", !12, i64 0, !12, i64 8}
!17 = !{i64 0, i64 4, !18, i64 4, i64 4, !18}
!18 = !{!13, !13, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !13, i64 0}
!21 = !{!"vrCircleShape", !13, i64 0, !12, i64 4}
!22 = !{!11, !11, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{i64 0, i64 4, !18, i64 4, i64 4, !18, i64 8, i64 4, !18, i64 12, i64 4, !18, i64 16, i64 4, !18, i64 20, i64 4, !18}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.vrTriangle = type { %struct.vrVec2, %struct.vrVec2, %struct.vrVec2 }
%struct.vrVec2 = type { float, float }

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

; Function Attrs: mustprogress 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) #1

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @vrShapeMoldGetShape(ptr nocapture noundef readonly %0) local_unnamed_addr #3 {
  %2 = alloca i32, align 4
  %3 = alloca %struct.vrTriangle, align 8
  %4 = tail call ptr (...) @vrArrayAlloc() #5
  %5 = tail call ptr @vrArrayInit(ptr noundef %4, i32 noundef 8) #5
  %6 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %6, label %81 [
    i32 1, label %7
    i32 0, label %16
  ]

7:                                                ; preds = %1
  %8 = tail call ptr (...) @vrShapeAlloc() #5
  %9 = tail call ptr @vrShapeInit(ptr noundef %8) #5
  %10 = tail call ptr @vrShapeCircleInit(ptr noundef %9) #5
  store ptr %10, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %10, i64 4
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load i64, ptr %12, align 8
  store i64 %13, ptr %11, align 4
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load float, ptr %14, align 8, !tbaa !16
  store float %15, ptr %10, align 4, !tbaa !17
  tail call void @vrArrayPush(ptr noundef %5, ptr noundef nonnull %9) #5
  br label %81

16:                                               ; preds = %1
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = getelementptr inbounds i8, ptr %0, i64 28
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %66

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !19
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = load i32, ptr %22, align 8, !tbaa !16
  %24 = sext i32 %23 to i64
  %25 = shl nsw i64 %24, 3
  %26 = tail call noalias ptr @malloc(i64 noundef %25) #6
  %27 = icmp sgt i32 %23, 0
  br i1 %27, label %.lr.ph49, label %._crit_edge50

.lr.ph49:                                         ; preds = %21
  %28 = ptrtoint ptr %26 to i64
  %29 = load ptr, ptr %17, align 8, !tbaa !16
  %wide.trip.count = zext nneg i32 %23 to i64
  %min.iters.check = icmp ult i32 %23, 6
  %30 = ptrtoint ptr %29 to i64
  %31 = sub i64 %28, %30
  %diff.check = icmp ult i64 %31, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph49
  %indvars.iv56.ph = phi i64 [ 0, %.lr.ph49 ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %indvars.iv56.prol = phi i64 [ %indvars.iv.next57.prol, %scalar.ph.prol ], [ %indvars.iv56.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %32 = getelementptr inbounds %struct.vrVec2, ptr %26, i64 %indvars.iv56.prol
  %33 = getelementptr inbounds %struct.vrVec2, ptr %29, i64 %indvars.iv56.prol
  %34 = load i64, ptr %33, align 4
  store i64 %34, ptr %32, align 4
  %indvars.iv.next57.prol = add nuw nsw i64 %indvars.iv56.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !20

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %indvars.iv56.unr = phi i64 [ %indvars.iv56.ph, %scalar.ph.preheader ], [ %indvars.iv.next57.prol, %scalar.ph.prol ]
  %35 = sub nsw i64 %indvars.iv56.ph, %wide.trip.count
  %36 = icmp ugt i64 %35, -4
  br i1 %36, label %._crit_edge50, label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph49
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %37 = getelementptr inbounds %struct.vrVec2, ptr %26, i64 %index
  %38 = getelementptr inbounds %struct.vrVec2, ptr %29, i64 %index
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %wide.load = load <2 x i64>, ptr %38, align 4
  %wide.load62 = load <2 x i64>, ptr %39, align 4
  %40 = getelementptr inbounds i8, ptr %37, i64 16
  store <2 x i64> %wide.load, ptr %37, align 4
  store <2 x i64> %wide.load62, ptr %40, align 4
  %index.next = add nuw i64 %index, 4
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !22

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge50, label %scalar.ph.preheader

._crit_edge50:                                    ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block, %21
  %42 = call ptr @vrEarClip(ptr noundef %26, i32 noundef %23, ptr noundef nonnull %2) #5
  %43 = load i32, ptr %2, align 4, !tbaa !19
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph53, label %._crit_edge54

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %indvars.iv56 = phi i64 [ %indvars.iv.next57.3, %scalar.ph ], [ %indvars.iv56.unr, %scalar.ph.prol.loopexit ]
  %45 = getelementptr inbounds %struct.vrVec2, ptr %26, i64 %indvars.iv56
  %46 = getelementptr inbounds %struct.vrVec2, ptr %29, i64 %indvars.iv56
  %47 = load i64, ptr %46, align 4
  store i64 %47, ptr %45, align 4
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %48 = getelementptr inbounds %struct.vrVec2, ptr %26, i64 %indvars.iv.next57
  %49 = getelementptr inbounds %struct.vrVec2, ptr %29, i64 %indvars.iv.next57
  %50 = load i64, ptr %49, align 4
  store i64 %50, ptr %48, align 4
  %indvars.iv.next57.1 = add nuw nsw i64 %indvars.iv56, 2
  %51 = getelementptr inbounds %struct.vrVec2, ptr %26, i64 %indvars.iv.next57.1
  %52 = getelementptr inbounds %struct.vrVec2, ptr %29, i64 %indvars.iv.next57.1
  %53 = load i64, ptr %52, align 4
  store i64 %53, ptr %51, align 4
  %indvars.iv.next57.2 = add nuw nsw i64 %indvars.iv56, 3
  %54 = getelementptr inbounds %struct.vrVec2, ptr %26, i64 %indvars.iv.next57.2
  %55 = getelementptr inbounds %struct.vrVec2, ptr %29, i64 %indvars.iv.next57.2
  %56 = load i64, ptr %55, align 4
  store i64 %56, ptr %54, align 4
  %indvars.iv.next57.3 = add nuw nsw i64 %indvars.iv56, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next57.3, %wide.trip.count
  br i1 %exitcond.not.3, label %._crit_edge50, label %scalar.ph, !llvm.loop !26

._crit_edge54:                                    ; preds = %.lr.ph53, %._crit_edge50
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %81

.lr.ph53:                                         ; preds = %._crit_edge50, %.lr.ph53
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph53 ], [ 0, %._crit_edge50 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  %57 = getelementptr inbounds %struct.vrTriangle, ptr %42, i64 %indvars.iv59
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 4 dereferenceable(24) %57, i64 24, i1 false), !tbaa.struct !27
  %58 = call ptr (...) @vrShapeAlloc() #5
  %59 = call ptr @vrShapeInit(ptr noundef %58) #5
  %60 = call ptr @vrShapePolyInit(ptr noundef %59) #5
  %61 = load ptr, ptr %60, align 8, !tbaa !12
  %62 = call ptr @vrPolyTriangleInit(ptr noundef %61, ptr noundef nonnull byval(%struct.vrTriangle) align 8 %3) #5
  store ptr %62, ptr %60, align 8, !tbaa !12
  call void @vrUpdatePolyAxes(ptr noundef %62) #5
  call void @vrArrayPush(ptr noundef %5, ptr noundef nonnull %60) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %63 = load i32, ptr %2, align 4, !tbaa !19
  %64 = sext i32 %63 to i64
  %65 = icmp slt i64 %indvars.iv.next60, %64
  br i1 %65, label %.lr.ph53, label %._crit_edge54, !llvm.loop !29

66:                                               ; preds = %16
  %67 = tail call ptr (...) @vrShapeAlloc() #5
  %68 = tail call ptr @vrShapeInit(ptr noundef %67) #5
  %69 = tail call ptr @vrShapePolyInit(ptr noundef %68) #5
  %70 = getelementptr inbounds i8, ptr %0, i64 24
  %71 = load i32, ptr %70, align 8, !tbaa !16
  %72 = icmp sgt i32 %71, 0
  br i1 %72, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %66
  %73 = load ptr, ptr %69, align 8, !tbaa !12
  tail call void @vrUpdatePolyAxes(ptr noundef %73) #5
  tail call void @vrArrayPush(ptr noundef %5, ptr noundef nonnull %69) #5
  br label %81

.lr.ph:                                           ; preds = %66, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %66 ]
  %74 = load ptr, ptr %69, align 8, !tbaa !12
  %75 = load ptr, ptr %17, align 8, !tbaa !16
  %76 = getelementptr inbounds %struct.vrVec2, ptr %75, i64 %indvars.iv
  %77 = load <2 x float>, ptr %76, align 4
  tail call void @vrAddVertexToPolyShape(ptr noundef %74, <2 x float> %77) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %78 = load i32, ptr %70, align 8, !tbaa !16
  %79 = sext i32 %78 to i64
  %80 = icmp slt i64 %indvars.iv.next, %79
  br i1 %80, label %.lr.ph, label %._crit_edge, !llvm.loop !30

81:                                               ; preds = %1, %._crit_edge, %._crit_edge54, %7
  ret ptr %5
}

declare ptr @vrArrayInit(ptr noundef, i32 noundef) local_unnamed_addr #4

declare ptr @vrArrayAlloc(...) local_unnamed_addr #4

declare ptr @vrShapeInit(ptr noundef) local_unnamed_addr #4

declare ptr @vrShapeAlloc(...) local_unnamed_addr #4

declare ptr @vrShapeCircleInit(ptr noundef) local_unnamed_addr #4

declare void @vrArrayPush(ptr noundef, ptr noundef) local_unnamed_addr #4

declare ptr @vrEarClip(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare ptr @vrShapePolyInit(ptr noundef) local_unnamed_addr #4

declare ptr @vrPolyTriangleInit(ptr noundef, ptr noundef byval(%struct.vrTriangle) align 8) local_unnamed_addr #4

declare void @vrUpdatePolyAxes(ptr noundef) local_unnamed_addr #4

declare void @vrAddVertexToPolyShape(ptr noundef, <2 x float>) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { "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 }
attributes #6 = { nounwind allocsize(0) }

!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 0}
!6 = !{!"vrShapeMold", !7, i64 0, !10, i64 4, !8, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"vrVec2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !8, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"vrShape", !14, i64 0, !7, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !15, i64 48}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"vrOrientedBoundingBox", !10, i64 0, !10, i64 8}
!16 = !{!8, !8, i64 0}
!17 = !{!18, !11, i64 0}
!18 = !{!"vrCircleShape", !11, i64 0, !10, i64 4}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = distinct !{!22, !23, !24, !25}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = distinct !{!26, !23, !24}
!27 = !{i64 0, i64 4, !28, i64 4, i64 4, !28, i64 8, i64 4, !28, i64 12, i64 4, !28, i64 16, i64 4, !28, i64 20, i64 4, !28}
!28 = !{!11, !11, i64 0}
!29 = distinct !{!29, !23}
!30 = distinct !{!30, !23}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass