; 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.osub = type { ptr, i32 }
%struct.otri = 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 }
%struct.behavior = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8] }

@plus1mod3 = external dso_local global [3 x i32], align 4
@minus1mod3 = external dso_local global [3 x i32], align 4
@.str.1004 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1005 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1006 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.1007 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1008 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1009 = external hidden unnamed_addr constant [56 x i8], align 1

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

declare i32 @printf(ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare dso_local void @internalerror() #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @poolalloc(ptr noundef) #3

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

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

; Function Attrs: nounwind uwtable
define dso_local void @segmentintersection(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %struct.osub, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca i32, align 4
  %29 = alloca ptr, align 8
  %30 = 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 ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #4
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.otri, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.otri, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 8, !tbaa !12
  %37 = add nsw i32 %36, 3
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %33, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  store ptr %40, ptr %12, align 8, !tbaa !5
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.otri, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.otri, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !12
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = add nsw i32 %49, 3
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds ptr, ptr %43, i64 %51
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  store ptr %53, ptr %13, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.otri, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.otri, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !12
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = add nsw i32 %62, 3
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %56, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  store ptr %66, ptr %14, align 8, !tbaa !5
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = getelementptr inbounds double, ptr %67, i64 0
  %69 = load double, ptr %68, align 8, !tbaa !14
  %70 = load ptr, ptr %13, align 8, !tbaa !5
  %71 = getelementptr inbounds double, ptr %70, i64 0
  %72 = load double, ptr %71, align 8, !tbaa !14
  %73 = fsub double %69, %72
  store double %73, ptr %22, align 8, !tbaa !14
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = getelementptr inbounds double, ptr %74, i64 1
  %76 = load double, ptr %75, align 8, !tbaa !14
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = getelementptr inbounds double, ptr %77, i64 1
  %79 = load double, ptr %78, align 8, !tbaa !14
  %80 = fsub double %76, %79
  store double %80, ptr %23, align 8, !tbaa !14
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = getelementptr inbounds double, ptr %81, i64 0
  %83 = load double, ptr %82, align 8, !tbaa !14
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds double, ptr %84, i64 0
  %86 = load double, ptr %85, align 8, !tbaa !14
  %87 = fsub double %83, %86
  store double %87, ptr %20, align 8, !tbaa !14
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds double, ptr %88, i64 1
  %90 = load double, ptr %89, align 8, !tbaa !14
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds double, ptr %91, i64 1
  %93 = load double, ptr %92, align 8, !tbaa !14
  %94 = fsub double %90, %93
  store double %94, ptr %21, align 8, !tbaa !14
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = getelementptr inbounds double, ptr %95, i64 0
  %97 = load double, ptr %96, align 8, !tbaa !14
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = getelementptr inbounds double, ptr %98, i64 0
  %100 = load double, ptr %99, align 8, !tbaa !14
  %101 = fsub double %97, %100
  store double %101, ptr %24, align 8, !tbaa !14
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = getelementptr inbounds double, ptr %102, i64 1
  %104 = load double, ptr %103, align 8, !tbaa !14
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = getelementptr inbounds double, ptr %105, i64 1
  %107 = load double, ptr %106, align 8, !tbaa !14
  %108 = fsub double %104, %107
  store double %108, ptr %25, align 8, !tbaa !14
  %109 = load double, ptr %23, align 8, !tbaa !14
  %110 = load double, ptr %20, align 8, !tbaa !14
  %111 = load double, ptr %22, align 8, !tbaa !14
  %112 = load double, ptr %21, align 8, !tbaa !14
  %113 = fmul double %111, %112
  %114 = fneg double %113
  %115 = call double @llvm.fmuladd.f64(double %109, double %110, double %114)
  store double %115, ptr %27, align 8, !tbaa !14
  %116 = load double, ptr %27, align 8, !tbaa !14
  %117 = fcmp oeq double %116, 0.000000e+00
  br i1 %117, label %118, label %121

118:                                              ; preds = %5
  %119 = call i32 (ptr, ...) @printf(ptr noundef @.str.1004)
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.1005)
  call void @internalerror()
  br label %121

121:                                              ; preds = %118, %5
  %122 = load double, ptr %21, align 8, !tbaa !14
  %123 = load double, ptr %24, align 8, !tbaa !14
  %124 = load double, ptr %20, align 8, !tbaa !14
  %125 = load double, ptr %25, align 8, !tbaa !14
  %126 = fmul double %124, %125
  %127 = fneg double %126
  %128 = call double @llvm.fmuladd.f64(double %122, double %123, double %127)
  %129 = load double, ptr %27, align 8, !tbaa !14
  %130 = fdiv double %128, %129
  store double %130, ptr %26, align 8, !tbaa !14
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.mesh, ptr %131, i32 0, i32 2
  %133 = call ptr @poolalloc(ptr noundef %132)
  store ptr %133, ptr %17, align 8, !tbaa !5
  store i32 0, ptr %28, align 4, !tbaa !13
  br label %134

134:                                              ; preds = %164, %121
  %135 = load i32, ptr %28, align 4, !tbaa !13
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.mesh, ptr %136, i32 0, i32 26
  %138 = load i32, ptr %137, align 4, !tbaa !16
  %139 = add nsw i32 2, %138
  %140 = icmp slt i32 %135, %139
  br i1 %140, label %141, label %167

141:                                              ; preds = %134
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = load i32, ptr %28, align 4, !tbaa !13
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds double, ptr %142, i64 %144
  %146 = load double, ptr %145, align 8, !tbaa !14
  %147 = load double, ptr %26, align 8, !tbaa !14
  %148 = load ptr, ptr %14, align 8, !tbaa !5
  %149 = load i32, ptr %28, align 4, !tbaa !13
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds double, ptr %148, i64 %150
  %152 = load double, ptr %151, align 8, !tbaa !14
  %153 = load ptr, ptr %13, align 8, !tbaa !5
  %154 = load i32, ptr %28, align 4, !tbaa !13
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds double, ptr %153, i64 %155
  %157 = load double, ptr %156, align 8, !tbaa !14
  %158 = fsub double %152, %157
  %159 = call double @llvm.fmuladd.f64(double %147, double %158, double %146)
  %160 = load ptr, ptr %17, align 8, !tbaa !5
  %161 = load i32, ptr %28, align 4, !tbaa !13
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds double, ptr %160, i64 %162
  store double %159, ptr %163, align 8, !tbaa !14
  br label %164

164:                                              ; preds = %141
  %165 = load i32, ptr %28, align 4, !tbaa !13
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %28, align 4, !tbaa !13
  br label %134, !llvm.loop !20

167:                                              ; preds = %134
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.osub, ptr %168, i32 0, i32 0
  %170 = load ptr, ptr %169, align 8, !tbaa !22
  %171 = getelementptr inbounds ptr, ptr %170, i64 8
  %172 = load i32, ptr %171, align 4, !tbaa !13
  %173 = load ptr, ptr %17, align 8, !tbaa !5
  %174 = load ptr, ptr %6, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.mesh, ptr %174, i32 0, i32 30
  %176 = load i32, ptr %175, align 4, !tbaa !24
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i32, ptr %173, i64 %177
  store i32 %172, ptr %178, align 4, !tbaa !13
  %179 = load ptr, ptr %17, align 8, !tbaa !5
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.mesh, ptr %180, i32 0, i32 30
  %182 = load i32, ptr %181, align 4, !tbaa !24
  %183 = add nsw i32 %182, 1
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds i32, ptr %179, i64 %184
  store i32 0, ptr %185, align 4, !tbaa !13
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.behavior, ptr %186, i32 0, i32 29
  %188 = load i32, ptr %187, align 4, !tbaa !25
  %189 = icmp sgt i32 %188, 1
  br i1 %189, label %190, label %210

190:                                              ; preds = %167
  %191 = load ptr, ptr %13, align 8, !tbaa !5
  %192 = getelementptr inbounds double, ptr %191, i64 0
  %193 = load double, ptr %192, align 8, !tbaa !14
  %194 = load ptr, ptr %13, align 8, !tbaa !5
  %195 = getelementptr inbounds double, ptr %194, i64 1
  %196 = load double, ptr %195, align 8, !tbaa !14
  %197 = load ptr, ptr %14, align 8, !tbaa !5
  %198 = getelementptr inbounds double, ptr %197, i64 0
  %199 = load double, ptr %198, align 8, !tbaa !14
  %200 = load ptr, ptr %14, align 8, !tbaa !5
  %201 = getelementptr inbounds double, ptr %200, i64 1
  %202 = load double, ptr %201, align 8, !tbaa !14
  %203 = load ptr, ptr %17, align 8, !tbaa !5
  %204 = getelementptr inbounds double, ptr %203, i64 0
  %205 = load double, ptr %204, align 8, !tbaa !14
  %206 = load ptr, ptr %17, align 8, !tbaa !5
  %207 = getelementptr inbounds double, ptr %206, i64 1
  %208 = load double, ptr %207, align 8, !tbaa !14
  %209 = call i32 (ptr, ...) @printf(ptr noundef @.str.1006, double noundef %193, double noundef %196, double noundef %199, double noundef %202, double noundef %205, double noundef %208)
  br label %210

210:                                              ; preds = %190, %167
  %211 = load ptr, ptr %6, align 8, !tbaa !5
  %212 = load ptr, ptr %7, align 8, !tbaa !5
  %213 = load ptr, ptr %17, align 8, !tbaa !5
  %214 = load ptr, ptr %8, align 8, !tbaa !5
  %215 = load ptr, ptr %9, align 8, !tbaa !5
  %216 = call i32 @insertvertex(ptr noundef %211, ptr noundef %212, ptr noundef %213, ptr noundef %214, ptr noundef %215, i32 noundef 0, i32 noundef 0)
  store i32 %216, ptr %18, align 4, !tbaa !13
  %217 = load i32, ptr %18, align 4, !tbaa !13
  %218 = icmp ne i32 %217, 0
  br i1 %218, label %219, label %222

219:                                              ; preds = %210
  %220 = call i32 (ptr, ...) @printf(ptr noundef @.str.1007)
  %221 = call i32 (ptr, ...) @printf(ptr noundef @.str.1008)
  call void @internalerror()
  br label %222

222:                                              ; preds = %219, %210
  %223 = load ptr, ptr %8, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.otri, ptr %223, i32 0, i32 0
  %225 = load ptr, ptr %224, align 8, !tbaa !9
  %226 = ptrtoint ptr %225 to i64
  %227 = load ptr, ptr %8, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.otri, ptr %227, i32 0, i32 1
  %229 = load i32, ptr %228, align 8, !tbaa !12
  %230 = sext i32 %229 to i64
  %231 = or i64 %226, %230
  %232 = inttoptr i64 %231 to ptr
  %233 = load ptr, ptr %17, align 8, !tbaa !5
  %234 = load ptr, ptr %6, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.mesh, ptr %234, i32 0, i32 31
  %236 = load i32, ptr %235, align 8, !tbaa !27
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds ptr, ptr %233, i64 %237
  store ptr %232, ptr %238, align 8, !tbaa !5
  %239 = load ptr, ptr %6, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.mesh, ptr %239, i32 0, i32 29
  %241 = load i32, ptr %240, align 8, !tbaa !28
  %242 = icmp sgt i32 %241, 0
  br i1 %242, label %243, label %248

243:                                              ; preds = %222
  %244 = load ptr, ptr %6, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.mesh, ptr %244, i32 0, i32 29
  %246 = load i32, ptr %245, align 8, !tbaa !28
  %247 = add nsw i32 %246, -1
  store i32 %247, ptr %245, align 8, !tbaa !28
  br label %248

248:                                              ; preds = %243, %222
  %249 = load ptr, ptr %9, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.osub, ptr %249, i32 0, i32 1
  %251 = load i32, ptr %250, align 8, !tbaa !29
  %252 = sub nsw i32 1, %251
  %253 = load ptr, ptr %9, align 8, !tbaa !5
  %254 = getelementptr inbounds %struct.osub, ptr %253, i32 0, i32 1
  store i32 %252, ptr %254, align 8, !tbaa !29
  %255 = load ptr, ptr %9, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.osub, ptr %255, i32 0, i32 0
  %257 = load ptr, ptr %256, align 8, !tbaa !22
  %258 = load ptr, ptr %9, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct.osub, ptr %258, i32 0, i32 1
  %260 = load i32, ptr %259, align 8, !tbaa !29
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds ptr, ptr %257, i64 %261
  %263 = load ptr, ptr %262, align 8, !tbaa !5
  store ptr %263, ptr %30, align 8, !tbaa !5
  %264 = load ptr, ptr %30, align 8, !tbaa !5
  %265 = ptrtoint ptr %264 to i64
  %266 = and i64 %265, 1
  %267 = trunc i64 %266 to i32
  %268 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 1
  store i32 %267, ptr %268, align 8, !tbaa !29
  %269 = load ptr, ptr %30, align 8, !tbaa !5
  %270 = ptrtoint ptr %269 to i64
  %271 = and i64 %270, -4
  %272 = inttoptr i64 %271 to ptr
  %273 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 0
  store ptr %272, ptr %273, align 8, !tbaa !22
  %274 = load ptr, ptr %6, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.mesh, ptr %274, i32 0, i32 50
  %276 = load ptr, ptr %275, align 8, !tbaa !30
  %277 = load ptr, ptr %9, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.osub, ptr %277, i32 0, i32 0
  %279 = load ptr, ptr %278, align 8, !tbaa !22
  %280 = load ptr, ptr %9, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.osub, ptr %280, i32 0, i32 1
  %282 = load i32, ptr %281, align 8, !tbaa !29
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds ptr, ptr %279, i64 %283
  store ptr %276, ptr %284, align 8, !tbaa !5
  %285 = load ptr, ptr %6, align 8, !tbaa !5
  %286 = getelementptr inbounds %struct.mesh, ptr %285, i32 0, i32 50
  %287 = load ptr, ptr %286, align 8, !tbaa !30
  %288 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 0
  %289 = load ptr, ptr %288, align 8, !tbaa !22
  %290 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 1
  %291 = load i32, ptr %290, align 8, !tbaa !29
  %292 = sext i32 %291 to i64
  %293 = getelementptr inbounds ptr, ptr %289, i64 %292
  store ptr %287, ptr %293, align 8, !tbaa !5
  br label %294

294:                                              ; preds = %327, %248
  %295 = load ptr, ptr %17, align 8, !tbaa !5
  %296 = load ptr, ptr %9, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct.osub, ptr %296, i32 0, i32 0
  %298 = load ptr, ptr %297, align 8, !tbaa !22
  %299 = load ptr, ptr %9, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.osub, ptr %299, i32 0, i32 1
  %301 = load i32, ptr %300, align 8, !tbaa !29
  %302 = add nsw i32 4, %301
  %303 = sext i32 %302 to i64
  %304 = getelementptr inbounds ptr, ptr %298, i64 %303
  store ptr %295, ptr %304, align 8, !tbaa !5
  %305 = load ptr, ptr %9, align 8, !tbaa !5
  %306 = getelementptr inbounds %struct.osub, ptr %305, i32 0, i32 0
  %307 = load ptr, ptr %306, align 8, !tbaa !22
  %308 = load ptr, ptr %9, align 8, !tbaa !5
  %309 = getelementptr inbounds %struct.osub, ptr %308, i32 0, i32 1
  %310 = load i32, ptr %309, align 8, !tbaa !29
  %311 = sub nsw i32 1, %310
  %312 = sext i32 %311 to i64
  %313 = getelementptr inbounds ptr, ptr %307, i64 %312
  %314 = load ptr, ptr %313, align 8, !tbaa !5
  store ptr %314, ptr %30, align 8, !tbaa !5
  %315 = load ptr, ptr %30, align 8, !tbaa !5
  %316 = ptrtoint ptr %315 to i64
  %317 = and i64 %316, 1
  %318 = trunc i64 %317 to i32
  %319 = load ptr, ptr %9, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct.osub, ptr %319, i32 0, i32 1
  store i32 %318, ptr %320, align 8, !tbaa !29
  %321 = load ptr, ptr %30, align 8, !tbaa !5
  %322 = ptrtoint ptr %321 to i64
  %323 = and i64 %322, -4
  %324 = inttoptr i64 %323 to ptr
  %325 = load ptr, ptr %9, align 8, !tbaa !5
  %326 = getelementptr inbounds %struct.osub, ptr %325, i32 0, i32 0
  store ptr %324, ptr %326, align 8, !tbaa !22
  br label %327

327:                                              ; preds = %294
  %328 = load ptr, ptr %9, align 8, !tbaa !5
  %329 = getelementptr inbounds %struct.osub, ptr %328, i32 0, i32 0
  %330 = load ptr, ptr %329, align 8, !tbaa !22
  %331 = load ptr, ptr %6, align 8, !tbaa !5
  %332 = getelementptr inbounds %struct.mesh, ptr %331, i32 0, i32 50
  %333 = load ptr, ptr %332, align 8, !tbaa !30
  %334 = icmp ne ptr %330, %333
  br i1 %334, label %294, label %335, !llvm.loop !31

335:                                              ; preds = %327
  br label %336

336:                                              ; preds = %363, %335
  %337 = load ptr, ptr %17, align 8, !tbaa !5
  %338 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 0
  %339 = load ptr, ptr %338, align 8, !tbaa !22
  %340 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 1
  %341 = load i32, ptr %340, align 8, !tbaa !29
  %342 = add nsw i32 4, %341
  %343 = sext i32 %342 to i64
  %344 = getelementptr inbounds ptr, ptr %339, i64 %343
  store ptr %337, ptr %344, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 0
  %346 = load ptr, ptr %345, align 8, !tbaa !22
  %347 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 1
  %348 = load i32, ptr %347, align 8, !tbaa !29
  %349 = sub nsw i32 1, %348
  %350 = sext i32 %349 to i64
  %351 = getelementptr inbounds ptr, ptr %346, i64 %350
  %352 = load ptr, ptr %351, align 8, !tbaa !5
  store ptr %352, ptr %30, align 8, !tbaa !5
  %353 = load ptr, ptr %30, align 8, !tbaa !5
  %354 = ptrtoint ptr %353 to i64
  %355 = and i64 %354, 1
  %356 = trunc i64 %355 to i32
  %357 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 1
  store i32 %356, ptr %357, align 8, !tbaa !29
  %358 = load ptr, ptr %30, align 8, !tbaa !5
  %359 = ptrtoint ptr %358 to i64
  %360 = and i64 %359, -4
  %361 = inttoptr i64 %360 to ptr
  %362 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 0
  store ptr %361, ptr %362, align 8, !tbaa !22
  br label %363

363:                                              ; preds = %336
  %364 = getelementptr inbounds %struct.osub, ptr %11, i32 0, i32 0
  %365 = load ptr, ptr %364, align 8, !tbaa !22
  %366 = load ptr, ptr %6, align 8, !tbaa !5
  %367 = getelementptr inbounds %struct.mesh, ptr %366, i32 0, i32 50
  %368 = load ptr, ptr %367, align 8, !tbaa !30
  %369 = icmp ne ptr %365, %368
  br i1 %369, label %336, label %370, !llvm.loop !32

370:                                              ; preds = %363
  %371 = load ptr, ptr %6, align 8, !tbaa !5
  %372 = load ptr, ptr %7, align 8, !tbaa !5
  %373 = load ptr, ptr %8, align 8, !tbaa !5
  %374 = load ptr, ptr %12, align 8, !tbaa !5
  %375 = call i32 @finddirection(ptr noundef %371, ptr noundef %372, ptr noundef %373, ptr noundef %374)
  store i32 %375, ptr %19, align 4, !tbaa !13
  %376 = load ptr, ptr %8, align 8, !tbaa !5
  %377 = getelementptr inbounds %struct.otri, ptr %376, i32 0, i32 0
  %378 = load ptr, ptr %377, align 8, !tbaa !9
  %379 = load ptr, ptr %8, align 8, !tbaa !5
  %380 = getelementptr inbounds %struct.otri, ptr %379, i32 0, i32 1
  %381 = load i32, ptr %380, align 8, !tbaa !12
  %382 = sext i32 %381 to i64
  %383 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %382
  %384 = load i32, ptr %383, align 4, !tbaa !13
  %385 = add nsw i32 %384, 3
  %386 = sext i32 %385 to i64
  %387 = getelementptr inbounds ptr, ptr %378, i64 %386
  %388 = load ptr, ptr %387, align 8, !tbaa !5
  store ptr %388, ptr %16, align 8, !tbaa !5
  %389 = load ptr, ptr %8, align 8, !tbaa !5
  %390 = getelementptr inbounds %struct.otri, ptr %389, i32 0, i32 0
  %391 = load ptr, ptr %390, align 8, !tbaa !9
  %392 = load ptr, ptr %8, align 8, !tbaa !5
  %393 = getelementptr inbounds %struct.otri, ptr %392, i32 0, i32 1
  %394 = load i32, ptr %393, align 8, !tbaa !12
  %395 = add nsw i32 %394, 3
  %396 = sext i32 %395 to i64
  %397 = getelementptr inbounds ptr, ptr %391, i64 %396
  %398 = load ptr, ptr %397, align 8, !tbaa !5
  store ptr %398, ptr %15, align 8, !tbaa !5
  %399 = load ptr, ptr %15, align 8, !tbaa !5
  %400 = getelementptr inbounds double, ptr %399, i64 0
  %401 = load double, ptr %400, align 8, !tbaa !14
  %402 = load ptr, ptr %12, align 8, !tbaa !5
  %403 = getelementptr inbounds double, ptr %402, i64 0
  %404 = load double, ptr %403, align 8, !tbaa !14
  %405 = fcmp oeq double %401, %404
  br i1 %405, label %406, label %448

406:                                              ; preds = %370
  %407 = load ptr, ptr %15, align 8, !tbaa !5
  %408 = getelementptr inbounds double, ptr %407, i64 1
  %409 = load double, ptr %408, align 8, !tbaa !14
  %410 = load ptr, ptr %12, align 8, !tbaa !5
  %411 = getelementptr inbounds double, ptr %410, i64 1
  %412 = load double, ptr %411, align 8, !tbaa !14
  %413 = fcmp oeq double %409, %412
  br i1 %413, label %414, label %448

414:                                              ; preds = %406
  %415 = load ptr, ptr %8, align 8, !tbaa !5
  %416 = getelementptr inbounds %struct.otri, ptr %415, i32 0, i32 1
  %417 = load i32, ptr %416, align 8, !tbaa !12
  %418 = sext i32 %417 to i64
  %419 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %418
  %420 = load i32, ptr %419, align 4, !tbaa !13
  %421 = load ptr, ptr %8, align 8, !tbaa !5
  %422 = getelementptr inbounds %struct.otri, ptr %421, i32 0, i32 1
  store i32 %420, ptr %422, align 8, !tbaa !12
  %423 = load ptr, ptr %8, align 8, !tbaa !5
  %424 = getelementptr inbounds %struct.otri, ptr %423, i32 0, i32 0
  %425 = load ptr, ptr %424, align 8, !tbaa !9
  %426 = load ptr, ptr %8, align 8, !tbaa !5
  %427 = getelementptr inbounds %struct.otri, ptr %426, i32 0, i32 1
  %428 = load i32, ptr %427, align 8, !tbaa !12
  %429 = sext i32 %428 to i64
  %430 = getelementptr inbounds ptr, ptr %425, i64 %429
  %431 = load ptr, ptr %430, align 8, !tbaa !5
  store ptr %431, ptr %29, align 8, !tbaa !5
  %432 = load ptr, ptr %29, align 8, !tbaa !5
  %433 = ptrtoint ptr %432 to i64
  %434 = and i64 %433, 3
  %435 = trunc i64 %434 to i32
  %436 = load ptr, ptr %8, align 8, !tbaa !5
  %437 = getelementptr inbounds %struct.otri, ptr %436, i32 0, i32 1
  store i32 %435, ptr %437, align 8, !tbaa !12
  %438 = load ptr, ptr %29, align 8, !tbaa !5
  %439 = ptrtoint ptr %438 to i64
  %440 = load ptr, ptr %8, align 8, !tbaa !5
  %441 = getelementptr inbounds %struct.otri, ptr %440, i32 0, i32 1
  %442 = load i32, ptr %441, align 8, !tbaa !12
  %443 = sext i32 %442 to i64
  %444 = xor i64 %439, %443
  %445 = inttoptr i64 %444 to ptr
  %446 = load ptr, ptr %8, align 8, !tbaa !5
  %447 = getelementptr inbounds %struct.otri, ptr %446, i32 0, i32 0
  store ptr %445, ptr %447, align 8, !tbaa !9
  br label %468

448:                                              ; preds = %406, %370
  %449 = load ptr, ptr %16, align 8, !tbaa !5
  %450 = getelementptr inbounds double, ptr %449, i64 0
  %451 = load double, ptr %450, align 8, !tbaa !14
  %452 = load ptr, ptr %12, align 8, !tbaa !5
  %453 = getelementptr inbounds double, ptr %452, i64 0
  %454 = load double, ptr %453, align 8, !tbaa !14
  %455 = fcmp une double %451, %454
  br i1 %455, label %464, label %456

456:                                              ; preds = %448
  %457 = load ptr, ptr %16, align 8, !tbaa !5
  %458 = getelementptr inbounds double, ptr %457, i64 1
  %459 = load double, ptr %458, align 8, !tbaa !14
  %460 = load ptr, ptr %12, align 8, !tbaa !5
  %461 = getelementptr inbounds double, ptr %460, i64 1
  %462 = load double, ptr %461, align 8, !tbaa !14
  %463 = fcmp une double %459, %462
  br i1 %463, label %464, label %467

464:                                              ; preds = %456, %448
  %465 = call i32 (ptr, ...) @printf(ptr noundef @.str.1007)
  %466 = call i32 (ptr, ...) @printf(ptr noundef @.str.1009)
  call void @internalerror()
  br label %467

467:                                              ; preds = %464, %456
  br label %468

468:                                              ; preds = %467, %414
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = { 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, !6, i64 0}
!10 = !{!"otri", !6, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!17, !11, i64 82716}
!17 = !{!"mesh", !18, i64 0, !18, i64 88, !18, i64 176, !18, i64 264, !18, i64 352, !18, i64 440, !18, i64 528, !18, i64 616, !7, i64 704, !7, i64 33472, !7, i64 66240, !11, i64 82624, !6, i64 82632, !15, i64 82640, !15, i64 82648, !15, i64 82656, !15, i64 82664, !15, i64 82672, !11, i64 82680, !11, i64 82684, !11, i64 82688, !11, i64 82692, !11, i64 82696, !11, i64 82700, !19, i64 82704, !11, i64 82712, !11, i64 82716, !11, i64 82720, !19, i64 82728, !11, i64 82736, !11, i64 82740, !11, i64 82744, !11, i64 82748, !11, i64 82752, !11, i64 82756, !11, i64 82760, !11, i64 82764, !11, i64 82768, !19, i64 82776, !19, i64 82784, !19, i64 82792, !19, i64 82800, !19, i64 82808, !19, i64 82816, !19, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !6, i64 82872, !6, i64 82880, !10, i64 82888}
!18 = !{!"memorypool", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !19, i64 64, !19, i64 72, !11, i64 80, !11, i64 84}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !6, i64 0}
!23 = !{!"osub", !6, i64 0, !11, i64 8}
!24 = !{!17, !11, i64 82740}
!25 = !{!26, !11, i64 116}
!26 = !{!"behavior", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !15, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !7, i64 168, !7, i64 2216, !7, i64 4264, !7, i64 6312, !7, i64 8360, !7, i64 10408, !7, i64 12456, !7, i64 14504, !7, i64 16552, !7, i64 18600, !7, i64 20648, !7, i64 22696}
!27 = !{!17, !11, i64 82744}
!28 = !{!17, !11, i64 82736}
!29 = !{!23, !11, i64 8}
!30 = !{!17, !6, i64 82872}
!31 = distinct !{!31, !21}
!32 = distinct !{!32, !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"

@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
@.str.1004 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1005 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1006 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.1007 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1008 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.1009 = external hidden unnamed_addr constant [56 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @internalerror() local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @poolalloc(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @segmentintersection(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef readonly %4) local_unnamed_addr #2 {
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !11
  %9 = sext i32 %8 to i64
  %10 = getelementptr ptr, ptr %6, i64 %9
  %11 = getelementptr i8, ptr %10, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %9
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = sext i32 %14 to i64
  %16 = getelementptr ptr, ptr %6, i64 %15
  %17 = getelementptr i8, ptr %16, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = ptrtoint ptr %18 to i64
  %20 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %9
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %22 = sext i32 %21 to i64
  %23 = getelementptr ptr, ptr %6, i64 %22
  %24 = getelementptr i8, ptr %23, i64 24
  %25 = load ptr, ptr %24, align 8, !tbaa !12
  %26 = ptrtoint ptr %25 to i64
  %27 = load double, ptr %25, align 8, !tbaa !14
  %28 = load double, ptr %18, align 8, !tbaa !14
  %29 = fsub double %27, %28
  %30 = getelementptr inbounds i8, ptr %25, i64 8
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = getelementptr inbounds i8, ptr %18, i64 8
  %33 = load double, ptr %32, align 8, !tbaa !14
  %34 = fsub double %31, %33
  %35 = load double, ptr %4, align 8, !tbaa !14
  %36 = load double, ptr %12, align 8, !tbaa !14
  %37 = fsub double %35, %36
  %38 = getelementptr inbounds i8, ptr %4, i64 8
  %39 = load double, ptr %38, align 8, !tbaa !14
  %40 = getelementptr inbounds i8, ptr %12, i64 8
  %41 = load double, ptr %40, align 8, !tbaa !14
  %42 = fsub double %39, %41
  %43 = fsub double %28, %35
  %44 = fsub double %33, %39
  %45 = fneg double %29
  %46 = fmul double %42, %45
  %47 = tail call double @llvm.fmuladd.f64(double %34, double %37, double %46)
  %48 = fcmp oeq double %47, 0.000000e+00
  br i1 %48, label %49, label %52

49:                                               ; preds = %5
  %50 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1004)
  %51 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1005)
  tail call void @internalerror()
  br label %52

52:                                               ; preds = %49, %5
  %53 = fneg double %37
  %54 = fmul double %44, %53
  %55 = tail call double @llvm.fmuladd.f64(double %42, double %43, double %54)
  %56 = fdiv double %55, %47
  %57 = getelementptr inbounds i8, ptr %0, i64 176
  %58 = tail call ptr @poolalloc(ptr noundef nonnull %57)
  %59 = ptrtoint ptr %58 to i64
  %60 = getelementptr inbounds i8, ptr %0, i64 82716
  %61 = load i32, ptr %60, align 4, !tbaa !16
  %62 = icmp sgt i32 %61, -2
  br i1 %62, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %52
  %63 = add i32 %61, 2
  %wide.trip.count = zext i32 %63 to i64
  %min.iters.check = icmp ult i32 %63, 6
  br i1 %min.iters.check, label %.lr.ph.preheader129, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %64 = sub i64 %59, %19
  %diff.check = icmp ult i64 %64, 32
  %65 = sub i64 %59, %26
  %diff.check125 = icmp ult i64 %65, 32
  %conflict.rdx = or i1 %diff.check, %diff.check125
  br i1 %conflict.rdx, label %.lr.ph.preheader129, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %wide.trip.count, 4294967292
  %broadcast.splatinsert = insertelement <2 x double> poison, double %56, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %66 = getelementptr inbounds double, ptr %18, i64 %index
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  %wide.load = load <2 x double>, ptr %66, align 8, !tbaa !14
  %wide.load126 = load <2 x double>, ptr %67, align 8, !tbaa !14
  %68 = getelementptr inbounds double, ptr %25, i64 %index
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  %wide.load127 = load <2 x double>, ptr %68, align 8, !tbaa !14
  %wide.load128 = load <2 x double>, ptr %69, align 8, !tbaa !14
  %70 = fsub <2 x double> %wide.load127, %wide.load
  %71 = fsub <2 x double> %wide.load128, %wide.load126
  %72 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %70, <2 x double> %wide.load)
  %73 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> %71, <2 x double> %wide.load126)
  %74 = getelementptr inbounds double, ptr %58, i64 %index
  %75 = getelementptr inbounds i8, ptr %74, i64 16
  store <2 x double> %72, ptr %74, align 8, !tbaa !14
  store <2 x double> %73, ptr %75, align 8, !tbaa !14
  %index.next = add nuw i64 %index, 4
  %76 = icmp eq i64 %index.next, %n.vec
  br i1 %76, label %middle.block, label %vector.body, !llvm.loop !20

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

.lr.ph.preheader129:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader129
  %77 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.ph
  %78 = load double, ptr %77, align 8, !tbaa !14
  %79 = getelementptr inbounds double, ptr %25, i64 %indvars.iv.ph
  %80 = load double, ptr %79, align 8, !tbaa !14
  %81 = fsub double %80, %78
  %82 = tail call double @llvm.fmuladd.f64(double %56, double %81, double %78)
  %83 = getelementptr inbounds double, ptr %58, i64 %indvars.iv.ph
  store double %82, ptr %83, align 8, !tbaa !14
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader129
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader129 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %84 = add nsw i64 %wide.trip.count, -1
  %85 = icmp eq i64 %indvars.iv.ph, %84
  br i1 %85, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %86 = getelementptr inbounds double, ptr %18, i64 %indvars.iv
  %87 = load double, ptr %86, align 8, !tbaa !14
  %88 = getelementptr inbounds double, ptr %25, i64 %indvars.iv
  %89 = load double, ptr %88, align 8, !tbaa !14
  %90 = fsub double %89, %87
  %91 = tail call double @llvm.fmuladd.f64(double %56, double %90, double %87)
  %92 = getelementptr inbounds double, ptr %58, i64 %indvars.iv
  store double %91, ptr %92, align 8, !tbaa !14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %93 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.next
  %94 = load double, ptr %93, align 8, !tbaa !14
  %95 = getelementptr inbounds double, ptr %25, i64 %indvars.iv.next
  %96 = load double, ptr %95, align 8, !tbaa !14
  %97 = fsub double %96, %94
  %98 = tail call double @llvm.fmuladd.f64(double %56, double %97, double %94)
  %99 = getelementptr inbounds double, ptr %58, i64 %indvars.iv.next
  store double %98, ptr %99, align 8, !tbaa !14
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.1 = icmp eq i64 %indvars.iv.next.1, %wide.trip.count
  br i1 %exitcond.1, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %52
  %100 = load ptr, ptr %3, align 8, !tbaa !25
  %101 = getelementptr inbounds i8, ptr %100, i64 64
  %102 = load i32, ptr %101, align 4, !tbaa !13
  %103 = getelementptr inbounds i8, ptr %0, i64 82740
  %104 = load i32, ptr %103, align 4, !tbaa !27
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i32, ptr %58, i64 %105
  store i32 %102, ptr %106, align 4, !tbaa !13
  %107 = load i32, ptr %103, align 4, !tbaa !27
  %108 = sext i32 %107 to i64
  %109 = getelementptr i32, ptr %58, i64 %108
  %110 = getelementptr i8, ptr %109, i64 4
  store i32 0, ptr %110, align 4, !tbaa !13
  %111 = getelementptr inbounds i8, ptr %1, i64 116
  %112 = load i32, ptr %111, align 4, !tbaa !28
  %113 = icmp sgt i32 %112, 1
  br i1 %113, label %114, label %123

114:                                              ; preds = %._crit_edge
  %115 = load double, ptr %18, align 8, !tbaa !14
  %116 = load double, ptr %32, align 8, !tbaa !14
  %117 = load double, ptr %25, align 8, !tbaa !14
  %118 = load double, ptr %30, align 8, !tbaa !14
  %119 = load double, ptr %58, align 8, !tbaa !14
  %120 = getelementptr inbounds i8, ptr %58, i64 8
  %121 = load double, ptr %120, align 8, !tbaa !14
  %122 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1006, double noundef %115, double noundef %116, double noundef %117, double noundef %118, double noundef %119, double noundef %121)
  br label %123

123:                                              ; preds = %114, %._crit_edge
  %124 = tail call i32 @insertvertex(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %58, ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef 0, i32 noundef 0)
  %.not = icmp eq i32 %124, 0
  br i1 %.not, label %128, label %125

125:                                              ; preds = %123
  %126 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1007)
  %127 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1008)
  tail call void @internalerror()
  br label %128

128:                                              ; preds = %125, %123
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = ptrtoint ptr %129 to i64
  %131 = load i32, ptr %7, align 8, !tbaa !11
  %132 = sext i32 %131 to i64
  %133 = or i64 %132, %130
  %134 = inttoptr i64 %133 to ptr
  %135 = getelementptr inbounds i8, ptr %0, i64 82744
  %136 = load i32, ptr %135, align 8, !tbaa !30
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds ptr, ptr %58, i64 %137
  store ptr %134, ptr %138, align 8, !tbaa !12
  %139 = getelementptr inbounds i8, ptr %0, i64 82736
  %140 = load i32, ptr %139, align 8, !tbaa !31
  %141 = icmp sgt i32 %140, 0
  br i1 %141, label %142, label %144

142:                                              ; preds = %128
  %143 = add nsw i32 %140, -1
  store i32 %143, ptr %139, align 8, !tbaa !31
  br label %144

144:                                              ; preds = %142, %128
  %145 = getelementptr inbounds i8, ptr %3, i64 8
  %146 = load i32, ptr %145, align 8, !tbaa !32
  %147 = sub nsw i32 1, %146
  %148 = load ptr, ptr %3, align 8, !tbaa !25
  %149 = sext i32 %147 to i64
  %150 = getelementptr inbounds ptr, ptr %148, i64 %149
  %151 = load ptr, ptr %150, align 8, !tbaa !12
  %152 = ptrtoint ptr %151 to i64
  %153 = and i64 %152, -4
  %154 = inttoptr i64 %153 to ptr
  %155 = getelementptr inbounds i8, ptr %0, i64 82872
  %156 = load ptr, ptr %155, align 8, !tbaa !33
  store ptr %156, ptr %150, align 8, !tbaa !12
  %157 = and i64 %152, 1
  %158 = getelementptr inbounds ptr, ptr %154, i64 %157
  store ptr %156, ptr %158, align 8, !tbaa !12
  %.pre = load ptr, ptr %3, align 8, !tbaa !25
  br label %159

159:                                              ; preds = %159, %144
  %160 = phi ptr [ %174, %159 ], [ %.pre, %144 ]
  %161 = phi i32 [ %172, %159 ], [ %147, %144 ]
  %162 = sext i32 %161 to i64
  %163 = getelementptr ptr, ptr %160, i64 %162
  %164 = getelementptr i8, ptr %163, i64 32
  store ptr %58, ptr %164, align 8, !tbaa !12
  %165 = load ptr, ptr %3, align 8, !tbaa !25
  %166 = sub nsw i32 1, %161
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds ptr, ptr %165, i64 %167
  %169 = load ptr, ptr %168, align 8, !tbaa !12
  %170 = ptrtoint ptr %169 to i64
  %171 = trunc i64 %170 to i32
  %172 = and i32 %171, 1
  %173 = and i64 %170, -4
  %174 = inttoptr i64 %173 to ptr
  store ptr %174, ptr %3, align 8, !tbaa !25
  %175 = load ptr, ptr %155, align 8, !tbaa !33
  %.not120 = icmp eq ptr %175, %174
  br i1 %.not120, label %.preheader, label %159, !llvm.loop !34

.preheader:                                       ; preds = %159
  store i32 %172, ptr %145, align 8, !tbaa !32
  br label %176

176:                                              ; preds = %.preheader, %176
  %.sroa.0.0 = phi ptr [ %186, %176 ], [ %154, %.preheader ]
  %.sroa.8.0.in.in = phi i64 [ %184, %176 ], [ %152, %.preheader ]
  %.sroa.8.0.in = trunc i64 %.sroa.8.0.in.in to i32
  %.sroa.8.0 = and i32 %.sroa.8.0.in, 1
  %177 = or disjoint i32 %.sroa.8.0, 4
  %178 = zext nneg i32 %177 to i64
  %179 = getelementptr inbounds ptr, ptr %.sroa.0.0, i64 %178
  store ptr %58, ptr %179, align 8, !tbaa !12
  %180 = xor i32 %.sroa.8.0, 1
  %181 = zext nneg i32 %180 to i64
  %182 = getelementptr inbounds ptr, ptr %.sroa.0.0, i64 %181
  %183 = load ptr, ptr %182, align 8, !tbaa !12
  %184 = ptrtoint ptr %183 to i64
  %185 = and i64 %184, -4
  %186 = inttoptr i64 %185 to ptr
  %187 = load ptr, ptr %155, align 8, !tbaa !33
  %.not121 = icmp eq ptr %187, %186
  br i1 %.not121, label %188, label %176, !llvm.loop !35

188:                                              ; preds = %176
  %189 = tail call i32 @finddirection(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %2, ptr noundef nonnull %12)
  %190 = load ptr, ptr %2, align 8, !tbaa !5
  %191 = load i32, ptr %7, align 8, !tbaa !11
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !13
  %195 = sext i32 %194 to i64
  %196 = getelementptr ptr, ptr %190, i64 %195
  %197 = getelementptr i8, ptr %196, i64 24
  %198 = load ptr, ptr %197, align 8, !tbaa !12
  %199 = getelementptr ptr, ptr %190, i64 %192
  %200 = getelementptr i8, ptr %199, i64 24
  %201 = load ptr, ptr %200, align 8, !tbaa !12
  %202 = load double, ptr %201, align 8, !tbaa !14
  %203 = load double, ptr %12, align 8, !tbaa !14
  %204 = fcmp oeq double %202, %203
  br i1 %204, label %205, label %217

205:                                              ; preds = %188
  %206 = getelementptr inbounds i8, ptr %201, i64 8
  %207 = load double, ptr %206, align 8, !tbaa !14
  %208 = load double, ptr %40, align 8, !tbaa !14
  %209 = fcmp oeq double %207, %208
  br i1 %209, label %210, label %217

210:                                              ; preds = %205
  %211 = load ptr, ptr %196, align 8, !tbaa !12
  %212 = ptrtoint ptr %211 to i64
  %213 = trunc i64 %212 to i32
  %214 = and i32 %213, 3
  store i32 %214, ptr %7, align 8, !tbaa !11
  %215 = and i64 %212, -4
  %216 = inttoptr i64 %215 to ptr
  store ptr %216, ptr %2, align 8, !tbaa !5
  br label %228

217:                                              ; preds = %205, %188
  %218 = load double, ptr %198, align 8, !tbaa !14
  %219 = fcmp une double %218, %203
  br i1 %219, label %225, label %220

220:                                              ; preds = %217
  %221 = getelementptr inbounds i8, ptr %198, i64 8
  %222 = load double, ptr %221, align 8, !tbaa !14
  %223 = load double, ptr %40, align 8, !tbaa !14
  %224 = fcmp une double %222, %223
  br i1 %224, label %225, label %228

225:                                              ; preds = %220, %217
  %226 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1007)
  %227 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1009)
  tail call void @internalerror()
  br label %228

228:                                              ; preds = %220, %225, %210
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3

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

!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 = !{!7, !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!17, !10, i64 82716}
!17 = !{!"mesh", !18, i64 0, !18, i64 88, !18, i64 176, !18, i64 264, !18, i64 352, !18, i64 440, !18, i64 528, !18, 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, !19, i64 82704, !10, i64 82712, !10, i64 82716, !10, i64 82720, !19, 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, !19, i64 82776, !19, i64 82784, !19, i64 82792, !19, i64 82800, !19, i64 82808, !19, i64 82816, !19, 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}
!18 = !{!"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, !19, i64 64, !19, i64 72, !10, i64 80, !10, i64 84}
!19 = !{!"long", !8, i64 0}
!20 = distinct !{!20, !21, !22, !23}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!"llvm.loop.isvectorized", i32 1}
!23 = !{!"llvm.loop.unroll.runtime.disable"}
!24 = distinct !{!24, !21, !22}
!25 = !{!26, !7, i64 0}
!26 = !{!"osub", !7, i64 0, !10, i64 8}
!27 = !{!17, !10, i64 82740}
!28 = !{!29, !10, i64 116}
!29 = !{!"behavior", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !15, i64 136, !15, i64 144, !15, i64 152, !15, i64 160, !8, i64 168, !8, i64 2216, !8, i64 4264, !8, i64 6312, !8, i64 8360, !8, i64 10408, !8, i64 12456, !8, i64 14504, !8, i64 16552, !8, i64 18600, !8, i64 20648, !8, i64 22696}
!30 = !{!17, !10, i64 82744}
!31 = !{!17, !10, i64 82736}
!32 = !{!26, !10, i64 8}
!33 = !{!17, !7, i64 82872}
!34 = distinct !{!34, !21}
!35 = distinct !{!35, !21}


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