; LLVM IR from ETH3D/dataset-pipeline :: thirdparty/cork/cork/isct (triangle)

; 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.otri = type { ptr, i32 }
%struct.osub = type { ptr, i32 }
%struct.mesh = type { %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, [4096 x ptr], [4096 x ptr], [4096 x i32], i32, ptr, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.otri }
%struct.memorypool = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i64, i64, i32, i32 }

@plus1mod3 = external dso_local global [3 x i32], align 4
@minus1mod3 = external dso_local global [3 x i32], align 4

; 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: nounwind uwtable
declare dso_local double @counterclockwise(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @insertsubseg(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @flip(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @segmentintersection(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @scoutsegment(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @delaunayfixup(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @constrainededge(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %struct.otri, align 8
  %12 = alloca %struct.otri, align 8
  %13 = alloca %struct.osub, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #2
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.otri, ptr %21, i32 0, i32 0
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.otri, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !13
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = add nsw i32 %29, 3
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds ptr, ptr %23, i64 %31
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  store ptr %33, ptr %14, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.otri, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  store ptr %36, ptr %37, align 8, !tbaa !11
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.otri, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !13
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  store i32 %43, ptr %44, align 8, !tbaa !13
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  call void @flip(ptr noundef %45, ptr noundef %46, ptr noundef %11)
  store i32 0, ptr %17, align 4, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %247, %5
  %48 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !11
  %50 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !13
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = add nsw i32 %54, 3
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds ptr, ptr %49, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  store ptr %58, ptr %15, align 8, !tbaa !5
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = getelementptr inbounds double, ptr %59, i64 0
  %61 = load double, ptr %60, align 8, !tbaa !14
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = getelementptr inbounds double, ptr %62, i64 0
  %64 = load double, ptr %63, align 8, !tbaa !14
  %65 = fcmp oeq double %61, %64
  br i1 %65, label %66, label %105

66:                                               ; preds = %47
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = getelementptr inbounds double, ptr %67, i64 1
  %69 = load double, ptr %68, align 8, !tbaa !14
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds double, ptr %70, i64 1
  %72 = load double, ptr %71, align 8, !tbaa !14
  %73 = fcmp oeq double %69, %72
  br i1 %73, label %74, label %105

74:                                               ; preds = %66
  %75 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !11
  %77 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %78 = load i32, ptr %77, align 8, !tbaa !13
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds ptr, ptr %76, i64 %79
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  store ptr %81, ptr %19, align 8, !tbaa !5
  %82 = load ptr, ptr %19, align 8, !tbaa !5
  %83 = ptrtoint ptr %82 to i64
  %84 = and i64 %83, 3
  %85 = trunc i64 %84 to i32
  %86 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 %85, ptr %86, align 8, !tbaa !13
  %87 = load ptr, ptr %19, align 8, !tbaa !5
  %88 = ptrtoint ptr %87 to i64
  %89 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %90 = load i32, ptr %89, align 8, !tbaa !13
  %91 = sext i32 %90 to i64
  %92 = xor i64 %88, %91
  %93 = inttoptr i64 %92 to ptr
  %94 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %93, ptr %94, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %96 = load i32, ptr %95, align 8, !tbaa !13
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !9
  %100 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 %99, ptr %100, align 8, !tbaa !13
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  call void @delaunayfixup(ptr noundef %101, ptr noundef %102, ptr noundef %11, i32 noundef 0)
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  call void @delaunayfixup(ptr noundef %103, ptr noundef %104, ptr noundef %12, i32 noundef 1)
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %246

105:                                              ; preds = %66, %47
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = load ptr, ptr %15, align 8, !tbaa !5
  %111 = call double @counterclockwise(ptr noundef %106, ptr noundef %107, ptr noundef %108, ptr noundef %109, ptr noundef %110)
  store double %111, ptr %16, align 8, !tbaa !14
  %112 = load double, ptr %16, align 8, !tbaa !14
  %113 = fcmp oeq double %112, 0.000000e+00
  br i1 %113, label %114, label %145

114:                                              ; preds = %105
  store i32 1, ptr %17, align 4, !tbaa !9
  %115 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !11
  %117 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %118 = load i32, ptr %117, align 8, !tbaa !13
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds ptr, ptr %116, i64 %119
  %121 = load ptr, ptr %120, align 8, !tbaa !5
  store ptr %121, ptr %19, align 8, !tbaa !5
  %122 = load ptr, ptr %19, align 8, !tbaa !5
  %123 = ptrtoint ptr %122 to i64
  %124 = and i64 %123, 3
  %125 = trunc i64 %124 to i32
  %126 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 %125, ptr %126, align 8, !tbaa !13
  %127 = load ptr, ptr %19, align 8, !tbaa !5
  %128 = ptrtoint ptr %127 to i64
  %129 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %130 = load i32, ptr %129, align 8, !tbaa !13
  %131 = sext i32 %130 to i64
  %132 = xor i64 %128, %131
  %133 = inttoptr i64 %132 to ptr
  %134 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %133, ptr %134, align 8, !tbaa !11
  %135 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %136 = load i32, ptr %135, align 8, !tbaa !13
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !9
  %140 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 %139, ptr %140, align 8, !tbaa !13
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  call void @delaunayfixup(ptr noundef %141, ptr noundef %142, ptr noundef %11, i32 noundef 0)
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  call void @delaunayfixup(ptr noundef %143, ptr noundef %144, ptr noundef %12, i32 noundef 1)
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %245

145:                                              ; preds = %105
  %146 = load double, ptr %16, align 8, !tbaa !14
  %147 = fcmp ogt double %146, 0.000000e+00
  br i1 %147, label %148, label %183

148:                                              ; preds = %145
  %149 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !11
  %151 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %152 = load i32, ptr %151, align 8, !tbaa !13
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds ptr, ptr %150, i64 %153
  %155 = load ptr, ptr %154, align 8, !tbaa !5
  store ptr %155, ptr %19, align 8, !tbaa !5
  %156 = load ptr, ptr %19, align 8, !tbaa !5
  %157 = ptrtoint ptr %156 to i64
  %158 = and i64 %157, 3
  %159 = trunc i64 %158 to i32
  %160 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 %159, ptr %160, align 8, !tbaa !13
  %161 = load ptr, ptr %19, align 8, !tbaa !5
  %162 = ptrtoint ptr %161 to i64
  %163 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %164 = load i32, ptr %163, align 8, !tbaa !13
  %165 = sext i32 %164 to i64
  %166 = xor i64 %162, %165
  %167 = inttoptr i64 %166 to ptr
  %168 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %167, ptr %168, align 8, !tbaa !11
  %169 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %170 = load i32, ptr %169, align 8, !tbaa !13
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !9
  %174 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 %173, ptr %174, align 8, !tbaa !13
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = load ptr, ptr %7, align 8, !tbaa !5
  call void @delaunayfixup(ptr noundef %175, ptr noundef %176, ptr noundef %12, i32 noundef 1)
  %177 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %178 = load i32, ptr %177, align 8, !tbaa !13
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !9
  %182 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  store i32 %181, ptr %182, align 8, !tbaa !13
  br label %212

183:                                              ; preds = %145
  %184 = load ptr, ptr %6, align 8, !tbaa !5
  %185 = load ptr, ptr %7, align 8, !tbaa !5
  call void @delaunayfixup(ptr noundef %184, ptr noundef %185, ptr noundef %11, i32 noundef 0)
  %186 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !11
  %188 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %189 = load i32, ptr %188, align 8, !tbaa !13
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds ptr, ptr %187, i64 %190
  %192 = load ptr, ptr %191, align 8, !tbaa !5
  store ptr %192, ptr %19, align 8, !tbaa !5
  %193 = load ptr, ptr %19, align 8, !tbaa !5
  %194 = ptrtoint ptr %193 to i64
  %195 = and i64 %194, 3
  %196 = trunc i64 %195 to i32
  %197 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  store i32 %196, ptr %197, align 8, !tbaa !13
  %198 = load ptr, ptr %19, align 8, !tbaa !5
  %199 = ptrtoint ptr %198 to i64
  %200 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %201 = load i32, ptr %200, align 8, !tbaa !13
  %202 = sext i32 %201 to i64
  %203 = xor i64 %199, %202
  %204 = inttoptr i64 %203 to ptr
  %205 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  store ptr %204, ptr %205, align 8, !tbaa !11
  %206 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %207 = load i32, ptr %206, align 8, !tbaa !13
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !9
  %211 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  store i32 %210, ptr %211, align 8, !tbaa !13
  br label %212

212:                                              ; preds = %183, %148
  %213 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 0
  %214 = load ptr, ptr %213, align 8, !tbaa !11
  %215 = getelementptr inbounds %struct.otri, ptr %11, i32 0, i32 1
  %216 = load i32, ptr %215, align 8, !tbaa !13
  %217 = add nsw i32 6, %216
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds ptr, ptr %214, i64 %218
  %220 = load ptr, ptr %219, align 8, !tbaa !5
  store ptr %220, ptr %20, align 8, !tbaa !5
  %221 = load ptr, ptr %20, align 8, !tbaa !5
  %222 = ptrtoint ptr %221 to i64
  %223 = and i64 %222, 1
  %224 = trunc i64 %223 to i32
  %225 = getelementptr inbounds %struct.osub, ptr %13, i32 0, i32 1
  store i32 %224, ptr %225, align 8, !tbaa !16
  %226 = load ptr, ptr %20, align 8, !tbaa !5
  %227 = ptrtoint ptr %226 to i64
  %228 = and i64 %227, -4
  %229 = inttoptr i64 %228 to ptr
  %230 = getelementptr inbounds %struct.osub, ptr %13, i32 0, i32 0
  store ptr %229, ptr %230, align 8, !tbaa !18
  %231 = getelementptr inbounds %struct.osub, ptr %13, i32 0, i32 0
  %232 = load ptr, ptr %231, align 8, !tbaa !18
  %233 = load ptr, ptr %6, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.mesh, ptr %233, i32 0, i32 50
  %235 = load ptr, ptr %234, align 8, !tbaa !19
  %236 = icmp eq ptr %232, %235
  br i1 %236, label %237, label %240

237:                                              ; preds = %212
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = load ptr, ptr %7, align 8, !tbaa !5
  call void @flip(ptr noundef %238, ptr noundef %239, ptr noundef %11)
  br label %244

240:                                              ; preds = %212
  store i32 1, ptr %17, align 4, !tbaa !9
  %241 = load ptr, ptr %6, align 8, !tbaa !5
  %242 = load ptr, ptr %7, align 8, !tbaa !5
  %243 = load ptr, ptr %9, align 8, !tbaa !5
  call void @segmentintersection(ptr noundef %241, ptr noundef %242, ptr noundef %11, ptr noundef %13, ptr noundef %243)
  store i32 1, ptr %18, align 4, !tbaa !9
  br label %244

244:                                              ; preds = %240, %237
  br label %245

245:                                              ; preds = %244, %114
  br label %246

246:                                              ; preds = %245, %74
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %18, align 4, !tbaa !9
  %249 = icmp ne i32 %248, 0
  %250 = xor i1 %249, true
  br i1 %250, label %47, label %251, !llvm.loop !23

251:                                              ; preds = %247
  %252 = load ptr, ptr %6, align 8, !tbaa !5
  %253 = load ptr, ptr %7, align 8, !tbaa !5
  %254 = load i32, ptr %10, align 4, !tbaa !9
  call void @insertsubseg(ptr noundef %252, ptr noundef %253, ptr noundef %11, i32 noundef %254)
  %255 = load i32, ptr %17, align 4, !tbaa !9
  %256 = icmp ne i32 %255, 0
  br i1 %256, label %257, label %270

257:                                              ; preds = %251
  %258 = load ptr, ptr %6, align 8, !tbaa !5
  %259 = load ptr, ptr %7, align 8, !tbaa !5
  %260 = load ptr, ptr %9, align 8, !tbaa !5
  %261 = load i32, ptr %10, align 4, !tbaa !9
  %262 = call i32 @scoutsegment(ptr noundef %258, ptr noundef %259, ptr noundef %11, ptr noundef %260, i32 noundef %261)
  %263 = icmp ne i32 %262, 0
  br i1 %263, label %269, label %264

264:                                              ; preds = %257
  %265 = load ptr, ptr %6, align 8, !tbaa !5
  %266 = load ptr, ptr %7, align 8, !tbaa !5
  %267 = load ptr, ptr %9, align 8, !tbaa !5
  %268 = load i32, ptr %10, align 4, !tbaa !9
  call void @constrainededge(ptr noundef %265, ptr noundef %266, ptr noundef %11, ptr noundef %267, i32 noundef %268)
  br label %269

269:                                              ; preds = %264, %257
  br label %270

270:                                              ; preds = %269, %251
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #2
  ret void
}

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"otri", !6, i64 0, !10, i64 8}
!13 = !{!12, !10, i64 8}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"osub", !6, i64 0, !10, i64 8}
!18 = !{!17, !6, i64 0}
!19 = !{!20, !6, i64 82872}
!20 = !{!"mesh", !21, i64 0, !21, i64 88, !21, i64 176, !21, i64 264, !21, i64 352, !21, i64 440, !21, i64 528, !21, i64 616, !7, i64 704, !7, i64 33472, !7, i64 66240, !10, i64 82624, !6, i64 82632, !15, i64 82640, !15, i64 82648, !15, i64 82656, !15, i64 82664, !15, i64 82672, !10, i64 82680, !10, i64 82684, !10, i64 82688, !10, i64 82692, !10, i64 82696, !10, i64 82700, !22, i64 82704, !10, i64 82712, !10, i64 82716, !10, i64 82720, !22, i64 82728, !10, i64 82736, !10, i64 82740, !10, i64 82744, !10, i64 82748, !10, i64 82752, !10, i64 82756, !10, i64 82760, !10, i64 82764, !10, i64 82768, !22, i64 82776, !22, i64 82784, !22, i64 82792, !22, i64 82800, !22, i64 82808, !22, i64 82816, !22, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !6, i64 82872, !6, i64 82880, !12, i64 82888}
!21 = !{!"memorypool", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !22, i64 64, !22, i64 72, !10, i64 80, !10, i64 84}
!22 = !{!"long", !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; 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.otri = type { ptr, i32 }
%struct.osub = type { ptr, i32 }

@plus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4
@minus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4

; 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: nounwind uwtable
declare dso_local double @counterclockwise(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @insertsubseg(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @flip(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @segmentintersection(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @scoutsegment(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @delaunayfixup(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @constrainededge(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #1 {
  %6 = alloca %struct.otri, align 8
  %7 = alloca %struct.otri, align 8
  %8 = alloca %struct.osub, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #2
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = sext i32 %14 to i64
  %16 = getelementptr ptr, ptr %9, i64 %15
  %17 = getelementptr i8, ptr %16, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !13
  store ptr %9, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 %14, ptr %19, align 8, !tbaa !11
  call void @flip(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6)
  %20 = getelementptr inbounds i8, ptr %3, i64 8
  %21 = getelementptr inbounds i8, ptr %7, i64 8
  %22 = getelementptr inbounds i8, ptr %8, i64 8
  %23 = getelementptr inbounds i8, ptr %0, i64 82872
  br label %24

24:                                               ; preds = %99, %5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load i32, ptr %19, align 8, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !12
  %30 = sext i32 %29 to i64
  %31 = getelementptr ptr, ptr %25, i64 %30
  %32 = getelementptr i8, ptr %31, i64 24
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = load double, ptr %33, align 8, !tbaa !14
  %35 = load double, ptr %3, align 8, !tbaa !14
  %36 = fcmp oeq double %34, %35
  br i1 %36, label %37, label %42

37:                                               ; preds = %24
  %38 = getelementptr inbounds i8, ptr %33, i64 8
  %39 = load double, ptr %38, align 8, !tbaa !14
  %40 = load double, ptr %20, align 8, !tbaa !14
  %41 = fcmp oeq double %39, %40
  br i1 %41, label %101, label %42

42:                                               ; preds = %37, %24
  %43 = call double @counterclockwise(ptr noundef %0, ptr noundef %1, ptr noundef %18, ptr noundef nonnull %3, ptr noundef nonnull %33)
  %44 = fcmp oeq double %43, 0.000000e+00
  br i1 %44, label %45, label %57

45:                                               ; preds = %42
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load i32, ptr %19, align 8, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds ptr, ptr %46, i64 %48
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = ptrtoint ptr %50 to i64
  %52 = and i64 %51, -4
  %53 = inttoptr i64 %52 to ptr
  store ptr %53, ptr %7, align 8, !tbaa !5
  %54 = and i64 %51, 3
  %55 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !12
  store i32 %56, ptr %21, align 8, !tbaa !11
  call void @delaunayfixup(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, i32 noundef 0)
  call void @delaunayfixup(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %7, i32 noundef 1)
  br label %.thread67

57:                                               ; preds = %42
  %58 = fcmp ogt double %43, 0.000000e+00
  br i1 %58, label %59, label %74

59:                                               ; preds = %57
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load i32, ptr %19, align 8, !tbaa !11
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !13
  %65 = ptrtoint ptr %64 to i64
  %66 = and i64 %65, -4
  %67 = inttoptr i64 %66 to ptr
  store ptr %67, ptr %7, align 8, !tbaa !5
  %68 = and i64 %65, 3
  %69 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !12
  store i32 %70, ptr %21, align 8, !tbaa !11
  call void @delaunayfixup(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %7, i32 noundef 1)
  %71 = load i32, ptr %19, align 8, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %72
  %.pre = load ptr, ptr %6, align 8, !tbaa !5
  br label %85

74:                                               ; preds = %57
  call void @delaunayfixup(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, i32 noundef 0)
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = load i32, ptr %19, align 8, !tbaa !11
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds ptr, ptr %75, i64 %77
  %79 = load ptr, ptr %78, align 8, !tbaa !13
  %80 = ptrtoint ptr %79 to i64
  %81 = and i64 %80, -4
  %82 = inttoptr i64 %81 to ptr
  store ptr %82, ptr %6, align 8, !tbaa !5
  %83 = and i64 %80, 3
  %84 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %83
  br label %85

85:                                               ; preds = %74, %59
  %86 = phi ptr [ %82, %74 ], [ %.pre, %59 ]
  %storemerge.in = phi ptr [ %84, %74 ], [ %73, %59 ]
  %storemerge = load i32, ptr %storemerge.in, align 4, !tbaa !12
  store i32 %storemerge, ptr %19, align 8, !tbaa !11
  %87 = sext i32 %storemerge to i64
  %88 = getelementptr ptr, ptr %86, i64 %87
  %89 = getelementptr i8, ptr %88, i64 48
  %90 = load ptr, ptr %89, align 8, !tbaa !13
  %91 = ptrtoint ptr %90 to i64
  %92 = trunc i64 %91 to i32
  %93 = and i32 %92, 1
  store i32 %93, ptr %22, align 8, !tbaa !16
  %94 = and i64 %91, -4
  %95 = inttoptr i64 %94 to ptr
  store ptr %95, ptr %8, align 8, !tbaa !18
  %96 = load ptr, ptr %23, align 8, !tbaa !19
  %97 = icmp eq ptr %96, %95
  br i1 %97, label %99, label %98

98:                                               ; preds = %85
  call void @segmentintersection(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %6, ptr noundef nonnull %8, ptr noundef nonnull %3)
  br label %.thread67

99:                                               ; preds = %85
  call void @flip(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %6)
  br label %24, !llvm.loop !23

.thread67:                                        ; preds = %98, %45
  call void @insertsubseg(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, i32 noundef %4)
  %100 = call i32 @scoutsegment(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, ptr noundef nonnull %3, i32 noundef %4)
  %.not61 = icmp eq i32 %100, 0
  br i1 %.not61, label %110, label %111

101:                                              ; preds = %37
  %102 = getelementptr inbounds ptr, ptr %25, i64 %27
  %103 = load ptr, ptr %102, align 8, !tbaa !13
  %104 = ptrtoint ptr %103 to i64
  %105 = and i64 %104, -4
  %106 = inttoptr i64 %105 to ptr
  store ptr %106, ptr %7, align 8, !tbaa !5
  %107 = and i64 %104, 3
  %108 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !12
  store i32 %109, ptr %21, align 8, !tbaa !11
  call void @delaunayfixup(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, i32 noundef 0)
  call void @delaunayfixup(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %7, i32 noundef 1)
  call void @insertsubseg(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, i32 noundef %4)
  br label %111

110:                                              ; preds = %.thread67
  call void @constrainededge(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %6, ptr noundef nonnull %3, i32 noundef %4)
  br label %111

111:                                              ; preds = %101, %.thread67, %110
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #2
  ret void
}

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"otri", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!10, !10, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!17, !10, i64 8}
!17 = !{!"osub", !7, i64 0, !10, i64 8}
!18 = !{!17, !7, i64 0}
!19 = !{!20, !7, i64 82872}
!20 = !{!"mesh", !21, i64 0, !21, i64 88, !21, i64 176, !21, i64 264, !21, i64 352, !21, i64 440, !21, i64 528, !21, i64 616, !8, i64 704, !8, i64 33472, !8, i64 66240, !10, i64 82624, !7, i64 82632, !15, i64 82640, !15, i64 82648, !15, i64 82656, !15, i64 82664, !15, i64 82672, !10, i64 82680, !10, i64 82684, !10, i64 82688, !10, i64 82692, !10, i64 82696, !10, i64 82700, !22, i64 82704, !10, i64 82712, !10, i64 82716, !10, i64 82720, !22, i64 82728, !10, i64 82736, !10, i64 82740, !10, i64 82744, !10, i64 82748, !10, i64 82752, !10, i64 82756, !10, i64 82760, !10, i64 82764, !10, i64 82768, !22, i64 82776, !22, i64 82784, !22, i64 82792, !22, i64 82800, !22, i64 82808, !22, i64 82816, !22, i64 82824, !7, i64 82832, !7, i64 82840, !7, i64 82848, !7, i64 82856, !7, i64 82864, !7, i64 82872, !7, i64 82880, !6, i64 82888}
!21 = !{!"memorypool", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !22, i64 64, !22, i64 72, !10, i64 80, !10, i64 84}
!22 = !{!"long", !8, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass