; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Polygon.ll (ZN9R2Polygon4ClipERK6R2Line)

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

%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }
%class.R2Vector = type { [2 x double] }
%class.R2Halfspace = type { %class.R2Line }
%class.R2Line = type { %class.R2Vector, %class.R2Vector, double }
%class.R2Polygon = type <{ %class.R2Solid, ptr, i32, [4 x i8], %class.R2Box, i32, [4 x i8] }>

@R2null_box = external global %class.R2Box, align 8
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) #3

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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

declare void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #3

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #5 align 2

declare noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) #2

declare void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9R2Polygon4ClipERK6R2Line(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %class.R2Halfspace, align 8
  %6 = alloca i32, align 4
  %7 = alloca %class.R2Halfspace, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca %class.R2Point, align 8
  %19 = alloca %class.R2Vector, align 8
  %20 = alloca %class.R2Vector, align 8
  %21 = alloca double, align 8
  %22 = alloca %class.R2Point, align 8
  %23 = alloca %class.R2Vector, align 8
  %24 = alloca %class.R2Vector, align 8
  %25 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %26 = load ptr, ptr %3, align 8
  %27 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %2
  br label %248

31:                                               ; preds = %2
  %32 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %33 = load i32, ptr %32, align 8, !tbaa !9
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %35, label %53

35:                                               ; preds = %31
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = getelementptr inbounds %class.R2Point, ptr %38, i64 0
  %40 = call noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %36, ptr noundef nonnull align 8 dereferenceable(16) %39)
  %41 = fcmp olt double %40, 0.000000e+00
  br i1 %41, label %42, label %52

42:                                               ; preds = %35
  %43 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 4
  %44 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %43, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
  %45 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !16
  %47 = icmp eq ptr %46, null
  br i1 %47, label %49, label %48

48:                                               ; preds = %42
  call void @_ZdaPv(ptr noundef %46) #7
  br label %49

49:                                               ; preds = %48, %42
  %50 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  store ptr null, ptr %50, align 8, !tbaa !16
  %51 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  store i32 0, ptr %51, align 8, !tbaa !9
  br label %52

52:                                               ; preds = %49, %35
  br label %247

53:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 40, ptr %5) #8
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN11R2HalfspaceC1ERK6R2Linei(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(40) %54, i32 noundef 0)
  %55 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 4
  %56 = call noundef i32 @_Z10R2ContainsRK11R2HalfspaceRK5R2Box(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(40) %55)
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %53
  store i32 1, ptr %6, align 4
  br label %243

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #8
  call void @_ZNK11R2HalfspacengEv(ptr dead_on_unwind writable sret(%class.R2Halfspace) align 8 %7, ptr noundef nonnull align 8 dereferenceable(40) %5)
  %60 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 4
  %61 = call noundef i32 @_Z10R2ContainsRK11R2HalfspaceRK5R2Box(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull align 8 dereferenceable(40) %60)
  %62 = icmp ne i32 %61, 0
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #8
  br i1 %62, label %63, label %73

63:                                               ; preds = %59
  %64 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 4
  %65 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %64, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
  %66 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = icmp eq ptr %67, null
  br i1 %68, label %70, label %69

69:                                               ; preds = %63
  call void @_ZdaPv(ptr noundef %67) #7
  br label %70

70:                                               ; preds = %69, %63
  %71 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  store ptr null, ptr %71, align 8, !tbaa !16
  %72 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  store i32 0, ptr %72, align 8, !tbaa !9
  store i32 1, ptr %6, align 4
  br label %243

73:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %74 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %75 = load i32, ptr %74, align 8, !tbaa !9
  %76 = mul nsw i32 4, %75
  %77 = sext i32 %76 to i64
  %78 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %77, i64 16)
  %79 = extractvalue { i64, i1 } %78, 1
  %80 = extractvalue { i64, i1 } %78, 0
  %81 = select i1 %79, i64 -1, i64 %80
  %82 = call noalias noundef nonnull ptr @_Znam(i64 noundef %81) #9
  %83 = icmp eq i64 %77, 0
  br i1 %83, label %91, label %84

84:                                               ; preds = %73
  %85 = getelementptr inbounds %class.R2Point, ptr %82, i64 %77
  br label %86

86:                                               ; preds = %88, %84
  %87 = phi ptr [ %82, %84 ], [ %89, %88 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %87)
          to label %88 unwind label %95

88:                                               ; preds = %86
  %89 = getelementptr inbounds %class.R2Point, ptr %87, i64 1
  %90 = icmp eq ptr %89, %85
  br i1 %90, label %91, label %86

91:                                               ; preds = %88, %73
  store ptr %82, ptr %9, align 8, !tbaa !5
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %99, label %94

94:                                               ; preds = %91
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.1)
  br label %99

95:                                               ; preds = %86
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %10, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %11, align 4
  call void @_ZdaPvm(ptr noundef %82, i64 noundef %81) #7
  br label %246

99:                                               ; preds = %94, %91
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %100 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %101 = load ptr, ptr %100, align 8, !tbaa !16
  %102 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %103 = load i32, ptr %102, align 8, !tbaa !9
  %104 = sub nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %class.R2Point, ptr %101, i64 %105
  store ptr %106, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = load ptr, ptr %12, align 8, !tbaa !5
  %109 = call noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %107, ptr noundef nonnull align 8 dereferenceable(16) %108)
  store double %109, ptr %13, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !17
  br label %110

110:                                              ; preds = %177, %99
  %111 = load i32, ptr %14, align 4, !tbaa !17
  %112 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %113 = load i32, ptr %112, align 8, !tbaa !9
  %114 = icmp slt i32 %111, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %110
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %180

116:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %117 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %118 = load ptr, ptr %117, align 8, !tbaa !16
  %119 = load i32, ptr %14, align 4, !tbaa !17
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds %class.R2Point, ptr %118, i64 %120
  store ptr %121, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = load ptr, ptr %15, align 8, !tbaa !5
  %124 = call noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %122, ptr noundef nonnull align 8 dereferenceable(16) %123)
  store double %124, ptr %16, align 8, !tbaa !18
  %125 = load double, ptr %16, align 8, !tbaa !18
  %126 = fcmp oge double %125, 0.000000e+00
  br i1 %126, label %127, label %154

127:                                              ; preds = %116
  %128 = load double, ptr %13, align 8, !tbaa !18
  %129 = fcmp olt double %128, 0.000000e+00
  br i1 %129, label %130, label %146

130:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %131 = load double, ptr %16, align 8, !tbaa !18
  %132 = load double, ptr %16, align 8, !tbaa !18
  %133 = load double, ptr %13, align 8, !tbaa !18
  %134 = fsub double %132, %133
  %135 = fdiv double %131, %134
  store double %135, ptr %17, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #8
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #8
  %137 = load double, ptr %17, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #8
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  %139 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %20, ptr noundef nonnull align 8 dereferenceable(16) %138, ptr noundef nonnull align 8 dereferenceable(16) %139)
  call void @_ZmldRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %19, double noundef %137, ptr noundef nonnull align 8 dereferenceable(16) %20)
  call void @_ZplRK7R2PointRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Point) align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %136, ptr noundef nonnull align 8 dereferenceable(16) %19)
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load i32, ptr %8, align 4, !tbaa !17
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %8, align 4, !tbaa !17
  %143 = sext i32 %141 to i64
  %144 = getelementptr inbounds %class.R2Point, ptr %140, i64 %143
  %145 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %144, ptr noundef nonnull align 8 dereferenceable(16) %18)
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %146

146:                                              ; preds = %130, %127
  %147 = load ptr, ptr %15, align 8, !tbaa !5
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  %149 = load i32, ptr %8, align 4, !tbaa !17
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %8, align 4, !tbaa !17
  %151 = sext i32 %149 to i64
  %152 = getelementptr inbounds %class.R2Point, ptr %148, i64 %151
  %153 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %152, ptr noundef nonnull align 8 dereferenceable(16) %147)
  br label %174

154:                                              ; preds = %116
  %155 = load double, ptr %13, align 8, !tbaa !18
  %156 = fcmp oge double %155, 0.000000e+00
  br i1 %156, label %157, label %173

157:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %158 = load double, ptr %13, align 8, !tbaa !18
  %159 = load double, ptr %13, align 8, !tbaa !18
  %160 = load double, ptr %16, align 8, !tbaa !18
  %161 = fsub double %159, %160
  %162 = fdiv double %158, %161
  store double %162, ptr %21, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #8
  %163 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #8
  %164 = load double, ptr %21, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #8
  %165 = load ptr, ptr %15, align 8, !tbaa !5
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %24, ptr noundef nonnull align 8 dereferenceable(16) %165, ptr noundef nonnull align 8 dereferenceable(16) %166)
  call void @_ZmldRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %23, double noundef %164, ptr noundef nonnull align 8 dereferenceable(16) %24)
  call void @_ZplRK7R2PointRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Point) align 8 %22, ptr noundef nonnull align 8 dereferenceable(16) %163, ptr noundef nonnull align 8 dereferenceable(16) %23)
  %167 = load ptr, ptr %9, align 8, !tbaa !5
  %168 = load i32, ptr %8, align 4, !tbaa !17
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %8, align 4, !tbaa !17
  %170 = sext i32 %168 to i64
  %171 = getelementptr inbounds %class.R2Point, ptr %167, i64 %170
  %172 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %171, ptr noundef nonnull align 8 dereferenceable(16) %22)
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %173

173:                                              ; preds = %157, %154
  br label %174

174:                                              ; preds = %173, %146
  %175 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %175, ptr %12, align 8, !tbaa !5
  %176 = load double, ptr %16, align 8, !tbaa !18
  store double %176, ptr %13, align 8, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %177

177:                                              ; preds = %174
  %178 = load i32, ptr %14, align 4, !tbaa !17
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %14, align 4, !tbaa !17
  br label %110, !llvm.loop !20

180:                                              ; preds = %115
  %181 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 4
  %182 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %181, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
  %183 = load i32, ptr %8, align 4, !tbaa !17
  %184 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  store i32 %183, ptr %184, align 8, !tbaa !9
  %185 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %186 = load ptr, ptr %185, align 8, !tbaa !16
  %187 = icmp eq ptr %186, null
  br i1 %187, label %189, label %188

188:                                              ; preds = %180
  call void @_ZdaPv(ptr noundef %186) #7
  br label %189

189:                                              ; preds = %188, %180
  %190 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %191 = load i32, ptr %190, align 8, !tbaa !9
  %192 = sext i32 %191 to i64
  %193 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %192, i64 16)
  %194 = extractvalue { i64, i1 } %193, 1
  %195 = extractvalue { i64, i1 } %193, 0
  %196 = select i1 %194, i64 -1, i64 %195
  %197 = call noalias noundef nonnull ptr @_Znam(i64 noundef %196) #9
  %198 = icmp eq i64 %192, 0
  br i1 %198, label %206, label %199

199:                                              ; preds = %189
  %200 = getelementptr inbounds %class.R2Point, ptr %197, i64 %192
  br label %201

201:                                              ; preds = %203, %199
  %202 = phi ptr [ %197, %199 ], [ %204, %203 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %202)
          to label %203 unwind label %214

203:                                              ; preds = %201
  %204 = getelementptr inbounds %class.R2Point, ptr %202, i64 1
  %205 = icmp eq ptr %204, %200
  br i1 %205, label %206, label %201

206:                                              ; preds = %203, %189
  %207 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  store ptr %197, ptr %207, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  store i32 0, ptr %25, align 4, !tbaa !17
  br label %208

208:                                              ; preds = %235, %206
  %209 = load i32, ptr %25, align 4, !tbaa !17
  %210 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 2
  %211 = load i32, ptr %210, align 8, !tbaa !9
  %212 = icmp slt i32 %209, %211
  br i1 %212, label %218, label %213

213:                                              ; preds = %208
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %238

214:                                              ; preds = %201
  %215 = landingpad { ptr, i32 }
          cleanup
  %216 = extractvalue { ptr, i32 } %215, 0
  store ptr %216, ptr %10, align 8
  %217 = extractvalue { ptr, i32 } %215, 1
  store i32 %217, ptr %11, align 4
  call void @_ZdaPvm(ptr noundef %197, i64 noundef %196) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %246

218:                                              ; preds = %208
  %219 = load ptr, ptr %9, align 8, !tbaa !5
  %220 = load i32, ptr %25, align 4, !tbaa !17
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds %class.R2Point, ptr %219, i64 %221
  %223 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %224 = load ptr, ptr %223, align 8, !tbaa !16
  %225 = load i32, ptr %25, align 4, !tbaa !17
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds %class.R2Point, ptr %224, i64 %226
  %228 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %227, ptr noundef nonnull align 8 dereferenceable(16) %222)
  %229 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 4
  %230 = getelementptr inbounds %class.R2Polygon, ptr %26, i32 0, i32 1
  %231 = load ptr, ptr %230, align 8, !tbaa !16
  %232 = load i32, ptr %25, align 4, !tbaa !17
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds %class.R2Point, ptr %231, i64 %233
  call void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %229, ptr noundef nonnull align 8 dereferenceable(16) %234)
  br label %235

235:                                              ; preds = %218
  %236 = load i32, ptr %25, align 4, !tbaa !17
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %25, align 4, !tbaa !17
  br label %208, !llvm.loop !22

238:                                              ; preds = %213
  %239 = load ptr, ptr %9, align 8, !tbaa !5
  %240 = icmp eq ptr %239, null
  br i1 %240, label %242, label %241

241:                                              ; preds = %238
  call void @_ZdaPv(ptr noundef %239) #7
  br label %242

242:                                              ; preds = %241, %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  store i32 0, ptr %6, align 4
  br label %243

243:                                              ; preds = %242, %70, %58
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #8
  %244 = load i32, ptr %6, align 4
  switch i32 %244, label %254 [
    i32 0, label %245
    i32 1, label %248
  ]

245:                                              ; preds = %243
  br label %247

246:                                              ; preds = %214, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #8
  br label %249

247:                                              ; preds = %245, %52
  br label %248

248:                                              ; preds = %247, %243, %30
  ret void

249:                                              ; preds = %246
  %250 = load ptr, ptr %10, align 8
  %251 = load i32, ptr %11, align 4
  %252 = insertvalue { ptr, i32 } poison, ptr %250, 0
  %253 = insertvalue { ptr, i32 } %252, i32 %251, 1
  resume { ptr, i32 } %253

254:                                              ; preds = %243
  unreachable
}

declare void @_ZN11R2HalfspaceC1ERK6R2Linei(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) unnamed_addr #2

declare noundef i32 @_Z10R2ContainsRK11R2HalfspaceRK5R2Box(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK11R2HalfspacengEv(ptr dead_on_unwind noalias writable sret(%class.R2Halfspace) align 8, ptr noundef nonnull align 8 dereferenceable(40)) #5 align 2

declare void @_ZplRK7R2PointRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Point) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmldRK8R2Vector(ptr dead_on_unwind noalias writable sret(%class.R2Vector) align 8, double noundef, ptr noundef nonnull align 8 dereferenceable(16)) #5

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nobuiltin 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 #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 = { nobuiltin nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint 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 #6 = { 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 #7 = { builtin nounwind }
attributes #8 = { nounwind }
attributes #9 = { builtin 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++ TBAA"}
!9 = !{!10, !13, i64 16}
!10 = !{!"_ZTS9R2Polygon", !11, i64 0, !6, i64 8, !13, i64 16, !14, i64 24, !13, i64 64}
!11 = !{!"_ZTS7R2Solid", !12, i64 0}
!12 = !{!"_ZTS7R2Shape"}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS5R2Box", !11, i64 0, !15, i64 8, !15, i64 24}
!15 = !{!"_ZTS7R2Point", !7, i64 0}
!16 = !{!10, !6, i64 8}
!17 = !{!13, !13, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


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

%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }
%class.R2Vector = type { [2 x double] }
%class.R2Halfspace = type { %class.R2Line }
%class.R2Line = type { %class.R2Vector, %class.R2Vector, double }

@R2null_box = external global %class.R2Box, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

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

declare void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4 align 2

declare noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare void @_ZmiRK7R2PointS1_(ptr dead_on_unwind writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9R2Polygon4ClipERK6R2Line(ptr noundef nonnull align 8 dereferenceable(68) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.R2Halfspace, align 8
  %4 = alloca %class.R2Halfspace, align 8
  %5 = alloca %class.R2Point, align 8
  %6 = alloca %class.R2Vector, align 8
  %7 = alloca %class.R2Vector, align 8
  %8 = alloca %class.R2Point, align 8
  %9 = alloca %class.R2Vector, align 8
  %10 = alloca %class.R2Vector, align 8
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !5
  switch i32 %12, label %25 [
    i32 0, label %128
    i32 1, label %13
  ]

13:                                               ; preds = %2
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = tail call noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %17 = fcmp olt double %16, 0.000000e+00
  br i1 %17, label %18, label %128

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  %20 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
  %21 = load ptr, ptr %14, align 8, !tbaa !15
  %22 = icmp eq ptr %21, null
  br i1 %22, label %24, label %23

23:                                               ; preds = %18
  tail call void @_ZdaPv(ptr noundef nonnull %21) #6
  br label %24

24:                                               ; preds = %23, %18
  store ptr null, ptr %14, align 8, !tbaa !15
  store i32 0, ptr %11, align 8, !tbaa !5
  br label %128

25:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #7
  call void @_ZN11R2HalfspaceC1ERK6R2Linei(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(40) %1, i32 noundef 0)
  %26 = getelementptr inbounds i8, ptr %0, i64 24
  %27 = call noundef i32 @_Z10R2ContainsRK11R2HalfspaceRK5R2Box(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(40) %26)
  %.not = icmp eq i32 %27, 0
  br i1 %.not, label %28, label %126

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #7
  call void @_ZNK11R2HalfspacengEv(ptr dead_on_unwind nonnull writable sret(%class.R2Halfspace) align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %3)
  %29 = call noundef i32 @_Z10R2ContainsRK11R2HalfspaceRK5R2Box(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %26)
  %.not62 = icmp eq i32 %29, 0
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br i1 %.not62, label %37, label %30

30:                                               ; preds = %28
  %31 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %26, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
  %32 = getelementptr inbounds i8, ptr %0, i64 8
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = icmp eq ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  call void @_ZdaPv(ptr noundef nonnull %33) #6
  br label %36

36:                                               ; preds = %35, %30
  store ptr null, ptr %32, align 8, !tbaa !15
  store i32 0, ptr %11, align 8, !tbaa !5
  br label %126

37:                                               ; preds = %28
  %38 = load i32, ptr %11, align 8, !tbaa !5
  %39 = shl nsw i32 %38, 2
  %40 = sext i32 %39 to i64
  %41 = icmp slt i32 %38, 0
  %42 = shl nsw i64 %40, 4
  %43 = select i1 %41, i64 -1, i64 %42
  %44 = call noalias noundef nonnull ptr @_Znam(i64 noundef %43) #8
  %45 = icmp eq i32 %38, 0
  br i1 %45, label %.loopexit64, label %46

46:                                               ; preds = %37
  %47 = getelementptr inbounds %class.R2Point, ptr %44, i64 %40
  br label %48

48:                                               ; preds = %50, %46
  %49 = phi ptr [ %44, %46 ], [ %51, %50 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %49)
          to label %50 unwind label %53

50:                                               ; preds = %48
  %51 = getelementptr inbounds i8, ptr %49, i64 16
  %52 = icmp eq ptr %51, %47
  br i1 %52, label %.loopexit64.loopexit, label %48

53:                                               ; preds = %48
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdaPvm(ptr noundef nonnull %44, i64 noundef %43) #6
  br label %127

.loopexit64.loopexit:                             ; preds = %50
  %.pre = load i32, ptr %11, align 8, !tbaa !5
  %55 = sext i32 %.pre to i64
  br label %.loopexit64

.loopexit64:                                      ; preds = %.loopexit64.loopexit, %37
  %56 = phi i64 [ %55, %.loopexit64.loopexit ], [ 0, %37 ]
  %57 = getelementptr inbounds i8, ptr %0, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !15
  %59 = getelementptr %class.R2Point, ptr %58, i64 %56
  %60 = getelementptr i8, ptr %59, i64 -16
  %61 = call noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(16) %60)
  %62 = load i32, ptr %11, align 8, !tbaa !5
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %94, %.loopexit64
  %.046.lcssa = phi i32 [ 0, %.loopexit64 ], [ %.2, %94 ]
  %64 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN5R2BoxaSERKS_(ptr noundef nonnull align 8 dereferenceable(40) %26, ptr noundef nonnull align 8 dereferenceable(40) @R2null_box)
  store i32 %.046.lcssa, ptr %11, align 8, !tbaa !5
  %65 = load ptr, ptr %57, align 8, !tbaa !15
  %66 = icmp eq ptr %65, null
  br i1 %66, label %99, label %98

.lr.ph:                                           ; preds = %.loopexit64, %94
  %indvars.iv = phi i64 [ %indvars.iv.next, %94 ], [ 0, %.loopexit64 ]
  %.04668 = phi i32 [ %.2, %94 ], [ 0, %.loopexit64 ]
  %.05066 = phi double [ %69, %94 ], [ %61, %.loopexit64 ]
  %.05165 = phi ptr [ %68, %94 ], [ %60, %.loopexit64 ]
  %67 = load ptr, ptr %57, align 8, !tbaa !15
  %68 = getelementptr inbounds %class.R2Point, ptr %67, i64 %indvars.iv
  %69 = call noundef double @_Z16R2SignedDistanceRK6R2LineRK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(16) %68)
  %70 = fcmp ult double %69, 0.000000e+00
  br i1 %70, label %85, label %71

71:                                               ; preds = %.lr.ph
  %72 = fcmp olt double %.05066, 0.000000e+00
  br i1 %72, label %73, label %80

73:                                               ; preds = %71
  %74 = fsub double %69, %.05066
  %75 = fdiv double %69, %74
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %.05165, ptr noundef nonnull align 8 dereferenceable(16) %68)
  call void @_ZmldRK8R2Vector(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %6, double noundef %75, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @_ZplRK7R2PointRK8R2Vector(ptr dead_on_unwind nonnull writable sret(%class.R2Point) align 8 %5, ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %76 = add nsw i32 %.04668, 1
  %77 = sext i32 %.04668 to i64
  %78 = getelementptr inbounds %class.R2Point, ptr %44, i64 %77
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  br label %80

80:                                               ; preds = %73, %71
  %.1 = phi i32 [ %76, %73 ], [ %.04668, %71 ]
  %81 = add nsw i32 %.1, 1
  %82 = sext i32 %.1 to i64
  %83 = getelementptr inbounds %class.R2Point, ptr %44, i64 %82
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %83, ptr noundef nonnull align 8 dereferenceable(16) %68)
  br label %94

85:                                               ; preds = %.lr.ph
  %86 = fcmp ult double %.05066, 0.000000e+00
  br i1 %86, label %94, label %87

87:                                               ; preds = %85
  %88 = fsub double %.05066, %69
  %89 = fdiv double %.05066, %88
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #7
  call void @_ZmiRK7R2PointS1_(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %10, ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 8 dereferenceable(16) %.05165)
  call void @_ZmldRK8R2Vector(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %9, double noundef %89, ptr noundef nonnull align 8 dereferenceable(16) %10)
  call void @_ZplRK7R2PointRK8R2Vector(ptr dead_on_unwind nonnull writable sret(%class.R2Point) align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %.05165, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %90 = add nsw i32 %.04668, 1
  %91 = sext i32 %.04668 to i64
  %92 = getelementptr inbounds %class.R2Point, ptr %44, i64 %91
  %93 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %92, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  br label %94

94:                                               ; preds = %85, %87, %80
  %.2 = phi i32 [ %81, %80 ], [ %90, %87 ], [ %.04668, %85 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %95 = load i32, ptr %11, align 8, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = icmp slt i64 %indvars.iv.next, %96
  br i1 %97, label %.lr.ph, label %._crit_edge, !llvm.loop !16

98:                                               ; preds = %._crit_edge
  call void @_ZdaPv(ptr noundef nonnull %65) #6
  %.pr = load i32, ptr %11, align 8, !tbaa !5
  br label %99

99:                                               ; preds = %98, %._crit_edge
  %100 = phi i32 [ %.pr, %98 ], [ %.046.lcssa, %._crit_edge ]
  %101 = sext i32 %100 to i64
  %102 = icmp slt i32 %100, 0
  %103 = shl nsw i64 %101, 4
  %104 = select i1 %102, i64 -1, i64 %103
  %105 = call noalias noundef nonnull ptr @_Znam(i64 noundef %104) #8
  %106 = icmp eq i32 %100, 0
  br i1 %106, label %.loopexit.thread, label %107

.loopexit.thread:                                 ; preds = %99
  store ptr %105, ptr %57, align 8, !tbaa !15
  br label %._crit_edge72

107:                                              ; preds = %99
  %108 = getelementptr inbounds %class.R2Point, ptr %105, i64 %101
  br label %109

109:                                              ; preds = %111, %107
  %110 = phi ptr [ %105, %107 ], [ %112, %111 ]
  invoke void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %110)
          to label %111 unwind label %115

111:                                              ; preds = %109
  %112 = getelementptr inbounds i8, ptr %110, i64 16
  %113 = icmp eq ptr %112, %108
  br i1 %113, label %.loopexit, label %109

.loopexit:                                        ; preds = %111
  %.pre77 = load i32, ptr %11, align 8, !tbaa !5
  %114 = icmp sgt i32 %.pre77, 0
  store ptr %105, ptr %57, align 8, !tbaa !15
  br i1 %114, label %.lr.ph71, label %._crit_edge72

115:                                              ; preds = %109
  %116 = landingpad { ptr, i32 }
          cleanup
  call void @_ZdaPvm(ptr noundef nonnull %105, i64 noundef %104) #6
  br label %127

.lr.ph71:                                         ; preds = %.loopexit, %.lr.ph71
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph71 ], [ 0, %.loopexit ]
  %117 = getelementptr inbounds %class.R2Point, ptr %44, i64 %indvars.iv74
  %118 = load ptr, ptr %57, align 8, !tbaa !15
  %119 = getelementptr inbounds %class.R2Point, ptr %118, i64 %indvars.iv74
  %120 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7R2PointaSERKS_(ptr noundef nonnull align 8 dereferenceable(16) %119, ptr noundef nonnull align 8 dereferenceable(16) %117)
  %121 = load ptr, ptr %57, align 8, !tbaa !15
  %122 = getelementptr inbounds %class.R2Point, ptr %121, i64 %indvars.iv74
  call void @_ZN5R2Box5UnionERK7R2Point(ptr noundef nonnull align 8 dereferenceable(40) %26, ptr noundef nonnull align 8 dereferenceable(16) %122)
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %123 = load i32, ptr %11, align 8, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = icmp slt i64 %indvars.iv.next75, %124
  br i1 %125, label %.lr.ph71, label %._crit_edge72, !llvm.loop !18

._crit_edge72:                                    ; preds = %.lr.ph71, %.loopexit.thread, %.loopexit
  call void @_ZdaPv(ptr noundef nonnull %44) #6
  br label %126

126:                                              ; preds = %25, %._crit_edge72, %36
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #7
  br label %128

127:                                              ; preds = %115, %53
  %.pn = phi { ptr, i32 } [ %116, %115 ], [ %54, %53 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn

128:                                              ; preds = %2, %126, %24, %13
  ret void
}

declare void @_ZN11R2HalfspaceC1ERK6R2Linei(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) unnamed_addr #1

declare noundef i32 @_Z10R2ContainsRK11R2HalfspaceRK5R2Box(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK11R2HalfspacengEv(ptr dead_on_unwind noalias writable sret(%class.R2Halfspace) align 8, ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4 align 2

declare void @_ZplRK7R2PointRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Point) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZmldRK8R2Vector(ptr dead_on_unwind noalias writable sret(%class.R2Vector) align 8, double noundef, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4

attributes #0 = { nobuiltin 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 #1 = { "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 = { nobuiltin nounwind "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { builtin nounwind }
attributes #7 = { nounwind }
attributes #8 = { builtin 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, !12, i64 16}
!6 = !{!"_ZTS9R2Polygon", !7, i64 0, !9, i64 8, !12, i64 16, !13, i64 24, !12, i64 64}
!7 = !{!"_ZTS7R2Solid", !8, i64 0}
!8 = !{!"_ZTS7R2Shape"}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"_ZTS5R2Box", !7, i64 0, !14, i64 8, !14, i64 24}
!14 = !{!"_ZTS7R2Point", !10, i64 0}
!15 = !{!6, !9, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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