; LLVM IR from NavInfoNC/nc-geo :: src/polygon_marker.ll (ZN13PolygonMarker20searchCandidateCellsER6VectorIPNS_4CellEES4_)

; 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.Point = type { i32, i32 }
%"struct.PolygonMarker::Cell" = type { %struct.Point, i32, i32, i32 }
%class.PolygonMarker = type { %class.Vector, %class.Vector, ptr, i32, %class.SmallObjectAllocator }
%class.Vector = type { ptr, i64, i64 }
%class.SmallObjectAllocator = type { ptr, i64, %class.Vector, %class.Vector }

; 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: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20), i64, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13PolygonMarker20searchCandidateCellsER6VectorIPNS_4CellEES4_(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca [4 x ptr], align 16
  %11 = alloca i32, align 4
  %12 = alloca %struct.Point, align 4
  %13 = alloca %struct.Point, align 4
  %14 = alloca %struct.Point, align 4
  %15 = alloca %struct.Point, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  call void @_ZN2cq18sortWithComparatorIPN13PolygonMarker4CellEEEvPT_S5_PFbRKS4_S7_E(ptr noundef %19, ptr noundef %21, ptr noundef @_ZL14cellComparatorIPN13PolygonMarker4CellEEbRKT_S5_)
  br label %22

22:                                               ; preds = %157, %155, %3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call noundef zeroext i1 @_ZNK6VectorIPN13PolygonMarker4CellEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %23)
  %25 = xor i1 %24, true
  br i1 %25, label %26, label %158

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6VectorIPN13PolygonMarker4CellEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %27)
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %29, ptr %7, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN6VectorIPN13PolygonMarker4CellEE7popBackEv(ptr noundef nonnull align 8 dereferenceable(24) %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %31, i32 0, i32 1
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  %35 = sdiv i32 %34, 2
  store i32 %35, ptr %8, align 4, !tbaa !13
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %36, i32 0, i32 3
  %38 = load i32, ptr %37, align 4, !tbaa !14
  %39 = getelementptr inbounds %class.PolygonMarker, ptr %17, i32 0, i32 2
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 4, !tbaa !20
  %43 = sub nsw i32 %38, %42
  %44 = getelementptr inbounds %class.PolygonMarker, ptr %17, i32 0, i32 3
  %45 = load i32, ptr %44, align 8, !tbaa !21
  %46 = icmp sle i32 %43, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %26
  store i32 2, ptr %9, align 4
  br label %155, !llvm.loop !22

48:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !13
  br label %49

49:                                               ; preds = %58, %48
  %50 = load i32, ptr %11, align 4, !tbaa !13
  %51 = icmp slt i32 %50, 4
  br i1 %51, label %53, label %52

52:                                               ; preds = %49
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %61

53:                                               ; preds = %49
  %54 = call noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128) %17)
  %55 = load i32, ptr %11, align 4, !tbaa !13
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 %56
  store ptr %54, ptr %57, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %53
  %59 = load i32, ptr %11, align 4, !tbaa !13
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %11, align 4, !tbaa !13
  br label %49, !llvm.loop !24

61:                                               ; preds = %52
  %62 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 0
  %63 = load ptr, ptr %62, align 16, !tbaa !5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds %struct.Point, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 4, !tbaa !25
  %68 = load i32, ptr %8, align 4, !tbaa !13
  %69 = sub nsw i32 %67, %68
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.Point, ptr %71, i32 0, i32 1
  %73 = load i32, ptr %72, align 4, !tbaa !26
  %74 = load i32, ptr %8, align 4, !tbaa !13
  %75 = sub nsw i32 %73, %74
  %76 = call i64 @_ZL10Point_makeii(i32 noundef %69, i32 noundef %75)
  store i64 %76, ptr %12, align 4
  %77 = load i32, ptr %8, align 4, !tbaa !13
  %78 = load i64, ptr %12, align 4
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %63, i64 %78, i32 noundef %77)
  %79 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 1
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %struct.Point, ptr %82, i32 0, i32 0
  %84 = load i32, ptr %83, align 4, !tbaa !25
  %85 = load i32, ptr %8, align 4, !tbaa !13
  %86 = add nsw i32 %84, %85
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %struct.Point, ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !26
  %91 = load i32, ptr %8, align 4, !tbaa !13
  %92 = sub nsw i32 %90, %91
  %93 = call i64 @_ZL10Point_makeii(i32 noundef %86, i32 noundef %92)
  store i64 %93, ptr %13, align 4
  %94 = load i32, ptr %8, align 4, !tbaa !13
  %95 = load i64, ptr %13, align 4
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %80, i64 %95, i32 noundef %94)
  %96 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 2
  %97 = load ptr, ptr %96, align 16, !tbaa !5
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds %struct.Point, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 4, !tbaa !25
  %102 = load i32, ptr %8, align 4, !tbaa !13
  %103 = add nsw i32 %101, %102
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %104, i32 0, i32 0
  %106 = getelementptr inbounds %struct.Point, ptr %105, i32 0, i32 1
  %107 = load i32, ptr %106, align 4, !tbaa !26
  %108 = load i32, ptr %8, align 4, !tbaa !13
  %109 = add nsw i32 %107, %108
  %110 = call i64 @_ZL10Point_makeii(i32 noundef %103, i32 noundef %109)
  store i64 %110, ptr %14, align 4
  %111 = load i32, ptr %8, align 4, !tbaa !13
  %112 = load i64, ptr %14, align 4
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %97, i64 %112, i32 noundef %111)
  %113 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 3
  %114 = load ptr, ptr %113, align 8, !tbaa !5
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %115, i32 0, i32 0
  %117 = getelementptr inbounds %struct.Point, ptr %116, i32 0, i32 0
  %118 = load i32, ptr %117, align 4, !tbaa !25
  %119 = load i32, ptr %8, align 4, !tbaa !13
  %120 = sub nsw i32 %118, %119
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %121, i32 0, i32 0
  %123 = getelementptr inbounds %struct.Point, ptr %122, i32 0, i32 1
  %124 = load i32, ptr %123, align 4, !tbaa !26
  %125 = load i32, ptr %8, align 4, !tbaa !13
  %126 = add nsw i32 %124, %125
  %127 = call i64 @_ZL10Point_makeii(i32 noundef %120, i32 noundef %126)
  store i64 %127, ptr %15, align 4
  %128 = load i32, ptr %8, align 4, !tbaa !13
  %129 = load i64, ptr %15, align 4
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %114, i64 %129, i32 noundef %128)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !13
  br label %130

130:                                              ; preds = %139, %61
  %131 = load i32, ptr %16, align 4, !tbaa !13
  %132 = icmp slt i32 %131, 4
  br i1 %132, label %134, label %133

133:                                              ; preds = %130
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %142

134:                                              ; preds = %130
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = load i32, ptr %16, align 4, !tbaa !13
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [4 x ptr], ptr %10, i64 0, i64 %137
  call void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %135, ptr noundef nonnull align 8 dereferenceable(8) %138)
  br label %139

139:                                              ; preds = %134
  %140 = load i32, ptr %16, align 4, !tbaa !13
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %16, align 4, !tbaa !13
  br label %130, !llvm.loop !27

142:                                              ; preds = %133
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %143, i32 0, i32 2
  %145 = load i32, ptr %144, align 4, !tbaa !20
  %146 = getelementptr inbounds %class.PolygonMarker, ptr %17, i32 0, i32 2
  %147 = load ptr, ptr %146, align 8, !tbaa !15
  %148 = getelementptr inbounds %"struct.PolygonMarker::Cell", ptr %147, i32 0, i32 2
  %149 = load i32, ptr %148, align 4, !tbaa !20
  %150 = icmp sgt i32 %145, %149
  br i1 %150, label %151, label %154

151:                                              ; preds = %142
  %152 = load ptr, ptr %7, align 8, !tbaa !5
  %153 = getelementptr inbounds %class.PolygonMarker, ptr %17, i32 0, i32 2
  store ptr %152, ptr %153, align 8, !tbaa !15
  br label %154

154:                                              ; preds = %151, %142
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  store i32 0, ptr %9, align 4
  br label %155

155:                                              ; preds = %154, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %156 = load i32, ptr %9, align 4
  switch i32 %156, label %159 [
    i32 0, label %157
    i32 2, label %22
  ]

157:                                              ; preds = %155
  br label %22, !llvm.loop !22

158:                                              ; preds = %22
  ret void

159:                                              ; preds = %155
  unreachable
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN2cq18sortWithComparatorIPN13PolygonMarker4CellEEEvPT_S5_PFbRKS4_S7_E(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL14cellComparatorIPN13PolygonMarker4CellEEbRKT_S5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6VectorIPN13PolygonMarker4CellEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6VectorIPN13PolygonMarker4CellEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6VectorIPN13PolygonMarker4CellEE7popBackEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden i64 @_ZL10Point_makeii(i32 noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline mustprogress 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 #2 = { mustprogress 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 #3 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { 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++ TBAA"}
!9 = !{!10, !12, i64 8}
!10 = !{!"_ZTSN13PolygonMarker4CellE", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!11 = !{!"_ZTS5Point", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !12, i64 16}
!15 = !{!16, !6, i64 48}
!16 = !{!"_ZTS13PolygonMarker", !17, i64 0, !17, i64 24, !6, i64 48, !12, i64 56, !19, i64 64}
!17 = !{!"_ZTS6VectorIPN13PolygonMarker4CellEE", !6, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTS20SmallObjectAllocatorIN13PolygonMarker4CellEE", !18, i64 8, !17, i64 16, !17, i64 40}
!20 = !{!10, !12, i64 12}
!21 = !{!16, !12, i64 56}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!10, !12, i64 0}
!26 = !{!10, !12, i64 4}
!27 = distinct !{!27, !23}


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

; Function Attrs: 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20), i64, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13PolygonMarker20searchCandidateCellsER6VectorIPNS_4CellEES4_(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #2 align 2 {
  %4 = alloca [4 x ptr], align 16
  %5 = tail call noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %6 = tail call noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  tail call void @_ZN2cq18sortWithComparatorIPN13PolygonMarker4CellEEEvPT_S5_PFbRKS4_S7_E(ptr noundef %5, ptr noundef %6, ptr noundef nonnull @_ZL14cellComparatorIPN13PolygonMarker4CellEEbRKT_S5_)
  %7 = tail call noundef zeroext i1 @_ZNK6VectorIPN13PolygonMarker4CellEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %7, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = getelementptr inbounds i8, ptr %0, i64 56
  %10 = getelementptr inbounds i8, ptr %4, i64 8
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  %12 = getelementptr inbounds i8, ptr %4, i64 24
  br label %13

13:                                               ; preds = %.lr.ph, %65
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6VectorIPN13PolygonMarker4CellEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN6VectorIPN13PolygonMarker4CellEE7popBackEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = load ptr, ptr %8, align 8, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %18, i64 12
  %20 = load i32, ptr %19, align 4, !tbaa !18
  %21 = sub nsw i32 %17, %20
  %22 = load i32, ptr %9, align 8, !tbaa !19
  %.not = icmp sgt i32 %21, %22
  br i1 %.not, label %23, label %65, !llvm.loop !20

23:                                               ; preds = %13
  %24 = getelementptr inbounds i8, ptr %15, i64 8
  %25 = load i32, ptr %24, align 4, !tbaa !22
  %26 = add nsw i32 %25, 1
  %27 = sdiv i32 %26, 2
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  %28 = call noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  store ptr %28, ptr %4, align 16, !tbaa !5
  %29 = call noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  store ptr %29, ptr %10, align 8, !tbaa !5
  %30 = call noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  store ptr %30, ptr %11, align 16, !tbaa !5
  %31 = call noundef ptr @_ZN13PolygonMarker9allocCellEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  store ptr %31, ptr %12, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 16, !tbaa !5
  %33 = load i32, ptr %15, align 4, !tbaa !23
  %34 = sub nsw i32 %33, %27
  %35 = getelementptr inbounds i8, ptr %15, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !24
  %37 = sub nsw i32 %36, %27
  %38 = call i64 @_ZL10Point_makeii(i32 noundef %34, i32 noundef %37)
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %32, i64 %38, i32 noundef %27)
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = load i32, ptr %15, align 4, !tbaa !23
  %41 = add nsw i32 %40, %27
  %42 = load i32, ptr %35, align 4, !tbaa !24
  %43 = sub nsw i32 %42, %27
  %44 = call i64 @_ZL10Point_makeii(i32 noundef %41, i32 noundef %43)
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %39, i64 %44, i32 noundef %27)
  %45 = load ptr, ptr %11, align 16, !tbaa !5
  %46 = load i32, ptr %15, align 4, !tbaa !23
  %47 = add nsw i32 %46, %27
  %48 = load i32, ptr %35, align 4, !tbaa !24
  %49 = add nsw i32 %48, %27
  %50 = call i64 @_ZL10Point_makeii(i32 noundef %47, i32 noundef %49)
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %45, i64 %50, i32 noundef %27)
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = load i32, ptr %15, align 4, !tbaa !23
  %53 = sub nsw i32 %52, %27
  %54 = load i32, ptr %35, align 4, !tbaa !24
  %55 = add nsw i32 %54, %27
  %56 = call i64 @_ZL10Point_makeii(i32 noundef %53, i32 noundef %55)
  call void @_ZN13PolygonMarker4Cell4initE5Pointi(ptr noundef nonnull align 4 dereferenceable(20) %51, i64 %56, i32 noundef %27)
  call void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @_ZN6VectorIPN13PolygonMarker4CellEE6appendERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %57 = getelementptr inbounds i8, ptr %15, i64 12
  %58 = load i32, ptr %57, align 4, !tbaa !18
  %59 = load ptr, ptr %8, align 8, !tbaa !13
  %60 = getelementptr inbounds i8, ptr %59, i64 12
  %61 = load i32, ptr %60, align 4, !tbaa !18
  %62 = icmp sgt i32 %58, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %23
  store ptr %15, ptr %8, align 8, !tbaa !13
  br label %64

64:                                               ; preds = %63, %23
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %65

65:                                               ; preds = %13, %64
  %66 = call noundef zeroext i1 @_ZNK6VectorIPN13PolygonMarker4CellEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %66, label %._crit_edge, label %13

._crit_edge:                                      ; preds = %65, %3
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN2cq18sortWithComparatorIPN13PolygonMarker4CellEEEvPT_S5_PFbRKS4_S7_E(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6VectorIPN13PolygonMarker4CellEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL14cellComparatorIPN13PolygonMarker4CellEEbRKT_S5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6VectorIPN13PolygonMarker4CellEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK6VectorIPN13PolygonMarker4CellEE4backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6VectorIPN13PolygonMarker4CellEE7popBackEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare hidden i64 @_ZL10Point_makeii(i32 noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { alwaysinline mustprogress 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 #2 = { mustprogress 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 #3 = { alwaysinline mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { 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++ TBAA"}
!9 = !{!10, !12, i64 16}
!10 = !{!"_ZTSN13PolygonMarker4CellE", !11, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!11 = !{!"_ZTS5Point", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 48}
!14 = !{!"_ZTS13PolygonMarker", !15, i64 0, !15, i64 24, !6, i64 48, !12, i64 56, !17, i64 64}
!15 = !{!"_ZTS6VectorIPN13PolygonMarker4CellEE", !6, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTS20SmallObjectAllocatorIN13PolygonMarker4CellEE", !16, i64 8, !15, i64 16, !15, i64 40}
!18 = !{!10, !12, i64 12}
!19 = !{!14, !12, i64 56}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !12, i64 8}
!23 = !{!10, !12, i64 0}
!24 = !{!10, !12, i64 4}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass