; LLVM IR from bbenligiray/stag :: src/ED/LineSegment.ll (Z24TryToJoinTwoLineSegmentsP11LineSegmentS0_dd)

; 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.LineSegment = type { double, double, i32, double, double, double, double, i32, i32, i32 }

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z33ComputeMinDistanceBetweenTwoLinesP11LineSegmentS0_Pi(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z24TryToJoinTwoLineSegmentsP11LineSegmentS0_dd(ptr noundef %0, ptr noundef %1, double noundef %2, double noundef %3) #4 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = call noundef double @_Z33ComputeMinDistanceBetweenTwoLinesP11LineSegmentS0_Pi(ptr noundef %21, ptr noundef %22, ptr noundef %10)
  store double %23, ptr %11, align 8, !tbaa !9
  %24 = load double, ptr %11, align 8, !tbaa !9
  %25 = load double, ptr %8, align 8, !tbaa !9
  %26 = fcmp ogt double %24, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %4
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %352

28:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.LineSegment, ptr %29, i32 0, i32 3
  %31 = load double, ptr %30, align 8, !tbaa !11
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.LineSegment, ptr %32, i32 0, i32 5
  %34 = load double, ptr %33, align 8, !tbaa !14
  %35 = fsub double %31, %34
  store double %35, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.LineSegment, ptr %36, i32 0, i32 4
  %38 = load double, ptr %37, align 8, !tbaa !15
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.LineSegment, ptr %39, i32 0, i32 6
  %41 = load double, ptr %40, align 8, !tbaa !16
  %42 = fsub double %38, %41
  store double %42, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %43 = load double, ptr %13, align 8, !tbaa !9
  %44 = load double, ptr %13, align 8, !tbaa !9
  %45 = load double, ptr %14, align 8, !tbaa !9
  %46 = load double, ptr %14, align 8, !tbaa !9
  %47 = fmul double %45, %46
  %48 = call double @llvm.fmuladd.f64(double %43, double %44, double %47)
  %49 = call double @sqrt(double noundef %48) #5
  store double %49, ptr %15, align 8, !tbaa !9
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.LineSegment, ptr %50, i32 0, i32 3
  %52 = load double, ptr %51, align 8, !tbaa !11
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.LineSegment, ptr %53, i32 0, i32 5
  %55 = load double, ptr %54, align 8, !tbaa !14
  %56 = fsub double %52, %55
  store double %56, ptr %13, align 8, !tbaa !9
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.LineSegment, ptr %57, i32 0, i32 4
  %59 = load double, ptr %58, align 8, !tbaa !15
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.LineSegment, ptr %60, i32 0, i32 6
  %62 = load double, ptr %61, align 8, !tbaa !16
  %63 = fsub double %59, %62
  store double %63, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %64 = load double, ptr %13, align 8, !tbaa !9
  %65 = load double, ptr %13, align 8, !tbaa !9
  %66 = load double, ptr %14, align 8, !tbaa !9
  %67 = load double, ptr %14, align 8, !tbaa !9
  %68 = fmul double %66, %67
  %69 = call double @llvm.fmuladd.f64(double %64, double %65, double %68)
  %70 = call double @sqrt(double noundef %69) #5
  store double %70, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %71, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %72, ptr %18, align 8, !tbaa !5
  %73 = load double, ptr %15, align 8, !tbaa !9
  %74 = load double, ptr %16, align 8, !tbaa !9
  %75 = fcmp ogt double %73, %74
  br i1 %75, label %76, label %79

76:                                               ; preds = %28
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %77, ptr %17, align 8, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %78, ptr %18, align 8, !tbaa !5
  br label %79

79:                                               ; preds = %76, %28
  %80 = load ptr, ptr %17, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.LineSegment, ptr %80, i32 0, i32 3
  %82 = load double, ptr %81, align 8, !tbaa !11
  %83 = load ptr, ptr %17, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.LineSegment, ptr %83, i32 0, i32 4
  %85 = load double, ptr %84, align 8, !tbaa !15
  %86 = load ptr, ptr %18, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.LineSegment, ptr %86, i32 0, i32 0
  %88 = load double, ptr %87, align 8, !tbaa !17
  %89 = load ptr, ptr %18, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.LineSegment, ptr %89, i32 0, i32 1
  %91 = load double, ptr %90, align 8, !tbaa !18
  %92 = load ptr, ptr %18, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.LineSegment, ptr %92, i32 0, i32 2
  %94 = load i32, ptr %93, align 8, !tbaa !19
  %95 = call noundef double @_Z18ComputeMinDistanceddddi(double noundef %82, double noundef %85, double noundef %88, double noundef %91, i32 noundef %94)
  store double %95, ptr %11, align 8, !tbaa !9
  %96 = load ptr, ptr %17, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.LineSegment, ptr %96, i32 0, i32 3
  %98 = load double, ptr %97, align 8, !tbaa !11
  %99 = load ptr, ptr %17, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.LineSegment, ptr %99, i32 0, i32 5
  %101 = load double, ptr %100, align 8, !tbaa !14
  %102 = fadd double %98, %101
  %103 = fdiv double %102, 2.000000e+00
  %104 = load ptr, ptr %17, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.LineSegment, ptr %104, i32 0, i32 4
  %106 = load double, ptr %105, align 8, !tbaa !15
  %107 = load ptr, ptr %17, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.LineSegment, ptr %107, i32 0, i32 6
  %109 = load double, ptr %108, align 8, !tbaa !16
  %110 = fadd double %106, %109
  %111 = fdiv double %110, 2.000000e+00
  %112 = load ptr, ptr %18, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.LineSegment, ptr %112, i32 0, i32 0
  %114 = load double, ptr %113, align 8, !tbaa !17
  %115 = load ptr, ptr %18, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.LineSegment, ptr %115, i32 0, i32 1
  %117 = load double, ptr %116, align 8, !tbaa !18
  %118 = load ptr, ptr %18, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.LineSegment, ptr %118, i32 0, i32 2
  %120 = load i32, ptr %119, align 8, !tbaa !19
  %121 = call noundef double @_Z18ComputeMinDistanceddddi(double noundef %103, double noundef %111, double noundef %114, double noundef %117, i32 noundef %120)
  %122 = load double, ptr %11, align 8, !tbaa !9
  %123 = fadd double %122, %121
  store double %123, ptr %11, align 8, !tbaa !9
  %124 = load ptr, ptr %17, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.LineSegment, ptr %124, i32 0, i32 5
  %126 = load double, ptr %125, align 8, !tbaa !14
  %127 = load ptr, ptr %17, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.LineSegment, ptr %127, i32 0, i32 6
  %129 = load double, ptr %128, align 8, !tbaa !16
  %130 = load ptr, ptr %18, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.LineSegment, ptr %130, i32 0, i32 0
  %132 = load double, ptr %131, align 8, !tbaa !17
  %133 = load ptr, ptr %18, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.LineSegment, ptr %133, i32 0, i32 1
  %135 = load double, ptr %134, align 8, !tbaa !18
  %136 = load ptr, ptr %18, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.LineSegment, ptr %136, i32 0, i32 2
  %138 = load i32, ptr %137, align 8, !tbaa !19
  %139 = call noundef double @_Z18ComputeMinDistanceddddi(double noundef %126, double noundef %129, double noundef %132, double noundef %135, i32 noundef %138)
  %140 = load double, ptr %11, align 8, !tbaa !9
  %141 = fadd double %140, %139
  store double %141, ptr %11, align 8, !tbaa !9
  %142 = load double, ptr %11, align 8, !tbaa !9
  %143 = fdiv double %142, 3.000000e+00
  store double %143, ptr %11, align 8, !tbaa !9
  %144 = load double, ptr %11, align 8, !tbaa !9
  %145 = load double, ptr %9, align 8, !tbaa !9
  %146 = fcmp ogt double %144, %145
  br i1 %146, label %147, label %148

147:                                              ; preds = %79
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %351

148:                                              ; preds = %79
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.LineSegment, ptr %149, i32 0, i32 3
  %151 = load double, ptr %150, align 8, !tbaa !11
  %152 = load ptr, ptr %7, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.LineSegment, ptr %152, i32 0, i32 3
  %154 = load double, ptr %153, align 8, !tbaa !11
  %155 = fsub double %151, %154
  %156 = call double @llvm.fabs.f64(double %155)
  store double %156, ptr %13, align 8, !tbaa !9
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.LineSegment, ptr %157, i32 0, i32 4
  %159 = load double, ptr %158, align 8, !tbaa !15
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.LineSegment, ptr %160, i32 0, i32 4
  %162 = load double, ptr %161, align 8, !tbaa !15
  %163 = fsub double %159, %162
  %164 = call double @llvm.fabs.f64(double %163)
  store double %164, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %165 = load double, ptr %13, align 8, !tbaa !9
  %166 = load double, ptr %14, align 8, !tbaa !9
  %167 = fadd double %165, %166
  store double %167, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %168 = load double, ptr %19, align 8, !tbaa !9
  store double %168, ptr %20, align 8, !tbaa !9
  store i32 1, ptr %10, align 4, !tbaa !20
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.LineSegment, ptr %169, i32 0, i32 3
  %171 = load double, ptr %170, align 8, !tbaa !11
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.LineSegment, ptr %172, i32 0, i32 5
  %174 = load double, ptr %173, align 8, !tbaa !14
  %175 = fsub double %171, %174
  %176 = call double @llvm.fabs.f64(double %175)
  store double %176, ptr %13, align 8, !tbaa !9
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.LineSegment, ptr %177, i32 0, i32 4
  %179 = load double, ptr %178, align 8, !tbaa !15
  %180 = load ptr, ptr %7, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.LineSegment, ptr %180, i32 0, i32 6
  %182 = load double, ptr %181, align 8, !tbaa !16
  %183 = fsub double %179, %182
  %184 = call double @llvm.fabs.f64(double %183)
  store double %184, ptr %14, align 8, !tbaa !9
  %185 = load double, ptr %13, align 8, !tbaa !9
  %186 = load double, ptr %14, align 8, !tbaa !9
  %187 = fadd double %185, %186
  store double %187, ptr %19, align 8, !tbaa !9
  %188 = load double, ptr %19, align 8, !tbaa !9
  %189 = load double, ptr %20, align 8, !tbaa !9
  %190 = fcmp ogt double %188, %189
  br i1 %190, label %191, label %193

191:                                              ; preds = %148
  %192 = load double, ptr %19, align 8, !tbaa !9
  store double %192, ptr %20, align 8, !tbaa !9
  store i32 2, ptr %10, align 4, !tbaa !20
  br label %193

193:                                              ; preds = %191, %148
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.LineSegment, ptr %194, i32 0, i32 5
  %196 = load double, ptr %195, align 8, !tbaa !14
  %197 = load ptr, ptr %7, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.LineSegment, ptr %197, i32 0, i32 3
  %199 = load double, ptr %198, align 8, !tbaa !11
  %200 = fsub double %196, %199
  %201 = call double @llvm.fabs.f64(double %200)
  store double %201, ptr %13, align 8, !tbaa !9
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.LineSegment, ptr %202, i32 0, i32 6
  %204 = load double, ptr %203, align 8, !tbaa !16
  %205 = load ptr, ptr %7, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.LineSegment, ptr %205, i32 0, i32 4
  %207 = load double, ptr %206, align 8, !tbaa !15
  %208 = fsub double %204, %207
  %209 = call double @llvm.fabs.f64(double %208)
  store double %209, ptr %14, align 8, !tbaa !9
  %210 = load double, ptr %13, align 8, !tbaa !9
  %211 = load double, ptr %14, align 8, !tbaa !9
  %212 = fadd double %210, %211
  store double %212, ptr %19, align 8, !tbaa !9
  %213 = load double, ptr %19, align 8, !tbaa !9
  %214 = load double, ptr %20, align 8, !tbaa !9
  %215 = fcmp ogt double %213, %214
  br i1 %215, label %216, label %218

216:                                              ; preds = %193
  %217 = load double, ptr %19, align 8, !tbaa !9
  store double %217, ptr %20, align 8, !tbaa !9
  store i32 3, ptr %10, align 4, !tbaa !20
  br label %218

218:                                              ; preds = %216, %193
  %219 = load ptr, ptr %6, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.LineSegment, ptr %219, i32 0, i32 5
  %221 = load double, ptr %220, align 8, !tbaa !14
  %222 = load ptr, ptr %7, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.LineSegment, ptr %222, i32 0, i32 5
  %224 = load double, ptr %223, align 8, !tbaa !14
  %225 = fsub double %221, %224
  %226 = call double @llvm.fabs.f64(double %225)
  store double %226, ptr %13, align 8, !tbaa !9
  %227 = load ptr, ptr %6, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.LineSegment, ptr %227, i32 0, i32 6
  %229 = load double, ptr %228, align 8, !tbaa !16
  %230 = load ptr, ptr %7, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.LineSegment, ptr %230, i32 0, i32 6
  %232 = load double, ptr %231, align 8, !tbaa !16
  %233 = fsub double %229, %232
  %234 = call double @llvm.fabs.f64(double %233)
  store double %234, ptr %14, align 8, !tbaa !9
  %235 = load double, ptr %13, align 8, !tbaa !9
  %236 = load double, ptr %14, align 8, !tbaa !9
  %237 = fadd double %235, %236
  store double %237, ptr %19, align 8, !tbaa !9
  %238 = load double, ptr %19, align 8, !tbaa !9
  %239 = load double, ptr %20, align 8, !tbaa !9
  %240 = fcmp ogt double %238, %239
  br i1 %240, label %241, label %243

241:                                              ; preds = %218
  %242 = load double, ptr %19, align 8, !tbaa !9
  store double %242, ptr %20, align 8, !tbaa !9
  store i32 4, ptr %10, align 4, !tbaa !20
  br label %243

243:                                              ; preds = %241, %218
  %244 = load i32, ptr %10, align 4, !tbaa !20
  %245 = icmp eq i32 %244, 1
  br i1 %245, label %246, label %257

246:                                              ; preds = %243
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.LineSegment, ptr %247, i32 0, i32 3
  %249 = load double, ptr %248, align 8, !tbaa !11
  %250 = load ptr, ptr %6, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.LineSegment, ptr %250, i32 0, i32 5
  store double %249, ptr %251, align 8, !tbaa !14
  %252 = load ptr, ptr %7, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.LineSegment, ptr %252, i32 0, i32 4
  %254 = load double, ptr %253, align 8, !tbaa !15
  %255 = load ptr, ptr %6, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.LineSegment, ptr %255, i32 0, i32 6
  store double %254, ptr %256, align 8, !tbaa !16
  br label %308

257:                                              ; preds = %243
  %258 = load i32, ptr %10, align 4, !tbaa !20
  %259 = icmp eq i32 %258, 2
  br i1 %259, label %260, label %271

260:                                              ; preds = %257
  %261 = load ptr, ptr %7, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.LineSegment, ptr %261, i32 0, i32 5
  %263 = load double, ptr %262, align 8, !tbaa !14
  %264 = load ptr, ptr %6, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.LineSegment, ptr %264, i32 0, i32 5
  store double %263, ptr %265, align 8, !tbaa !14
  %266 = load ptr, ptr %7, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.LineSegment, ptr %266, i32 0, i32 6
  %268 = load double, ptr %267, align 8, !tbaa !16
  %269 = load ptr, ptr %6, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.LineSegment, ptr %269, i32 0, i32 6
  store double %268, ptr %270, align 8, !tbaa !16
  br label %307

271:                                              ; preds = %257
  %272 = load i32, ptr %10, align 4, !tbaa !20
  %273 = icmp eq i32 %272, 3
  br i1 %273, label %274, label %285

274:                                              ; preds = %271
  %275 = load ptr, ptr %7, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.LineSegment, ptr %275, i32 0, i32 3
  %277 = load double, ptr %276, align 8, !tbaa !11
  %278 = load ptr, ptr %6, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.LineSegment, ptr %278, i32 0, i32 3
  store double %277, ptr %279, align 8, !tbaa !11
  %280 = load ptr, ptr %7, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.LineSegment, ptr %280, i32 0, i32 4
  %282 = load double, ptr %281, align 8, !tbaa !15
  %283 = load ptr, ptr %6, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.LineSegment, ptr %283, i32 0, i32 4
  store double %282, ptr %284, align 8, !tbaa !15
  br label %306

285:                                              ; preds = %271
  %286 = load ptr, ptr %6, align 8, !tbaa !5
  %287 = getelementptr inbounds %struct.LineSegment, ptr %286, i32 0, i32 5
  %288 = load double, ptr %287, align 8, !tbaa !14
  %289 = load ptr, ptr %6, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.LineSegment, ptr %289, i32 0, i32 3
  store double %288, ptr %290, align 8, !tbaa !11
  %291 = load ptr, ptr %6, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct.LineSegment, ptr %291, i32 0, i32 6
  %293 = load double, ptr %292, align 8, !tbaa !16
  %294 = load ptr, ptr %6, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.LineSegment, ptr %294, i32 0, i32 4
  store double %293, ptr %295, align 8, !tbaa !15
  %296 = load ptr, ptr %7, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct.LineSegment, ptr %296, i32 0, i32 5
  %298 = load double, ptr %297, align 8, !tbaa !14
  %299 = load ptr, ptr %6, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.LineSegment, ptr %299, i32 0, i32 5
  store double %298, ptr %300, align 8, !tbaa !14
  %301 = load ptr, ptr %7, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.LineSegment, ptr %301, i32 0, i32 6
  %303 = load double, ptr %302, align 8, !tbaa !16
  %304 = load ptr, ptr %6, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.LineSegment, ptr %304, i32 0, i32 6
  store double %303, ptr %305, align 8, !tbaa !16
  br label %306

306:                                              ; preds = %285, %274
  br label %307

307:                                              ; preds = %306, %260
  br label %308

308:                                              ; preds = %307, %246
  %309 = load ptr, ptr %6, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.LineSegment, ptr %309, i32 0, i32 8
  %311 = load i32, ptr %310, align 4, !tbaa !21
  %312 = load ptr, ptr %6, align 8, !tbaa !5
  %313 = getelementptr inbounds %struct.LineSegment, ptr %312, i32 0, i32 9
  %314 = load i32, ptr %313, align 8, !tbaa !22
  %315 = add nsw i32 %311, %314
  %316 = add nsw i32 %315, 5
  %317 = load ptr, ptr %7, align 8, !tbaa !5
  %318 = getelementptr inbounds %struct.LineSegment, ptr %317, i32 0, i32 8
  %319 = load i32, ptr %318, align 4, !tbaa !21
  %320 = icmp sge i32 %316, %319
  br i1 %320, label %321, label %329

321:                                              ; preds = %308
  %322 = load ptr, ptr %7, align 8, !tbaa !5
  %323 = getelementptr inbounds %struct.LineSegment, ptr %322, i32 0, i32 9
  %324 = load i32, ptr %323, align 8, !tbaa !22
  %325 = load ptr, ptr %6, align 8, !tbaa !5
  %326 = getelementptr inbounds %struct.LineSegment, ptr %325, i32 0, i32 9
  %327 = load i32, ptr %326, align 8, !tbaa !22
  %328 = add nsw i32 %327, %324
  store i32 %328, ptr %326, align 8, !tbaa !22
  br label %349

329:                                              ; preds = %308
  %330 = load ptr, ptr %7, align 8, !tbaa !5
  %331 = getelementptr inbounds %struct.LineSegment, ptr %330, i32 0, i32 9
  %332 = load i32, ptr %331, align 8, !tbaa !22
  %333 = load ptr, ptr %6, align 8, !tbaa !5
  %334 = getelementptr inbounds %struct.LineSegment, ptr %333, i32 0, i32 9
  %335 = load i32, ptr %334, align 8, !tbaa !22
  %336 = icmp sgt i32 %332, %335
  br i1 %336, label %337, label %348

337:                                              ; preds = %329
  %338 = load ptr, ptr %7, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct.LineSegment, ptr %338, i32 0, i32 8
  %340 = load i32, ptr %339, align 4, !tbaa !21
  %341 = load ptr, ptr %6, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.LineSegment, ptr %341, i32 0, i32 8
  store i32 %340, ptr %342, align 4, !tbaa !21
  %343 = load ptr, ptr %7, align 8, !tbaa !5
  %344 = getelementptr inbounds %struct.LineSegment, ptr %343, i32 0, i32 9
  %345 = load i32, ptr %344, align 8, !tbaa !22
  %346 = load ptr, ptr %6, align 8, !tbaa !5
  %347 = getelementptr inbounds %struct.LineSegment, ptr %346, i32 0, i32 9
  store i32 %345, ptr %347, align 8, !tbaa !22
  br label %348

348:                                              ; preds = %337, %329
  br label %349

349:                                              ; preds = %348, %321
  %350 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_Z20UpdateLineParametersP11LineSegment(ptr noundef %350)
  store i1 true, ptr %5, align 1
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %351

351:                                              ; preds = %349, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %352

352:                                              ; preds = %351, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %353 = load i1, ptr %5, align 1
  ret i1 %353
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z18ComputeMinDistanceddddi(double noundef, double noundef, double noundef, double noundef, i32 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z20UpdateLineParametersP11LineSegment(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !10, i64 24}
!12 = !{!"_ZTS11LineSegment", !10, i64 0, !10, i64 8, !13, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !13, i64 56, !13, i64 60, !13, i64 64}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !10, i64 40}
!15 = !{!12, !10, i64 32}
!16 = !{!12, !10, i64 48}
!17 = !{!12, !10, i64 0}
!18 = !{!12, !10, i64 8}
!19 = !{!12, !13, i64 16}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !13, i64 60}
!22 = !{!12, !13, i64 64}


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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z33ComputeMinDistanceBetweenTwoLinesP11LineSegmentS0_Pi(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z24TryToJoinTwoLineSegmentsP11LineSegmentS0_dd(ptr noundef %0, ptr noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #1 {
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  %6 = call noundef double @_Z33ComputeMinDistanceBetweenTwoLinesP11LineSegmentS0_Pi(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %5)
  %7 = fcmp ogt double %6, %2
  br i1 %7, label %126, label %8

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load double, ptr %11, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = load double, ptr %13, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %0, i64 48
  %16 = load double, ptr %15, align 8, !tbaa !13
  %17 = getelementptr inbounds i8, ptr %1, i64 24
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %1, i64 40
  %20 = load double, ptr %19, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %1, i64 32
  %22 = load double, ptr %21, align 8, !tbaa !12
  %23 = getelementptr inbounds i8, ptr %1, i64 48
  %24 = load double, ptr %23, align 8, !tbaa !13
  %25 = insertelement <2 x double> poison, double %10, i64 0
  %26 = insertelement <2 x double> %25, double %18, i64 1
  %27 = insertelement <2 x double> poison, double %12, i64 0
  %28 = insertelement <2 x double> %27, double %20, i64 1
  %29 = fsub <2 x double> %26, %28
  %30 = insertelement <2 x double> poison, double %14, i64 0
  %31 = insertelement <2 x double> %30, double %22, i64 1
  %32 = insertelement <2 x double> poison, double %16, i64 0
  %33 = insertelement <2 x double> %32, double %24, i64 1
  %34 = fsub <2 x double> %31, %33
  %35 = fmul <2 x double> %34, %34
  %36 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %29, <2 x double> %29, <2 x double> %35)
  %37 = call <2 x double> @llvm.sqrt.v2f64(<2 x double> %36)
  %38 = extractelement <2 x double> %37, i64 0
  %39 = extractelement <2 x double> %37, i64 1
  %40 = fcmp ogt double %38, %39
  %.0116 = select i1 %40, ptr %1, ptr %0
  %.0115 = select i1 %40, ptr %0, ptr %1
  %41 = getelementptr inbounds i8, ptr %.0116, i64 24
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %.0116, i64 32
  %44 = load double, ptr %43, align 8, !tbaa !12
  %45 = load double, ptr %.0115, align 8, !tbaa !14
  %46 = getelementptr inbounds i8, ptr %.0115, i64 8
  %47 = load double, ptr %46, align 8, !tbaa !15
  %48 = getelementptr inbounds i8, ptr %.0115, i64 16
  %49 = load i32, ptr %48, align 8, !tbaa !16
  %50 = call noundef double @_Z18ComputeMinDistanceddddi(double noundef %42, double noundef %44, double noundef %45, double noundef %47, i32 noundef %49)
  %51 = load double, ptr %41, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %.0116, i64 40
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = fadd double %51, %53
  %55 = fmul double %54, 5.000000e-01
  %56 = load double, ptr %43, align 8, !tbaa !12
  %57 = getelementptr inbounds i8, ptr %.0116, i64 48
  %58 = load double, ptr %57, align 8, !tbaa !13
  %59 = fadd double %56, %58
  %60 = fmul double %59, 5.000000e-01
  %61 = load double, ptr %.0115, align 8, !tbaa !14
  %62 = load double, ptr %46, align 8, !tbaa !15
  %63 = load i32, ptr %48, align 8, !tbaa !16
  %64 = call noundef double @_Z18ComputeMinDistanceddddi(double noundef %55, double noundef %60, double noundef %61, double noundef %62, i32 noundef %63)
  %65 = fadd double %50, %64
  %66 = load double, ptr %52, align 8, !tbaa !11
  %67 = load double, ptr %57, align 8, !tbaa !13
  %68 = load double, ptr %.0115, align 8, !tbaa !14
  %69 = load double, ptr %46, align 8, !tbaa !15
  %70 = load i32, ptr %48, align 8, !tbaa !16
  %71 = call noundef double @_Z18ComputeMinDistanceddddi(double noundef %66, double noundef %67, double noundef %68, double noundef %69, i32 noundef %70)
  %72 = fadd double %65, %71
  %73 = fdiv double %72, 3.000000e+00
  %74 = fcmp ule double %73, %3
  br i1 %74, label %75, label %126

75:                                               ; preds = %8
  %76 = load <2 x double>, ptr %17, align 8, !tbaa !17
  %77 = load <2 x double>, ptr %9, align 8, !tbaa !17
  %78 = fsub <2 x double> %77, %76
  %79 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %78)
  store i32 1, ptr %5, align 4, !tbaa !18
  %80 = load <2 x double>, ptr %19, align 8, !tbaa !17
  %81 = fsub <2 x double> %77, %80
  %82 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %81)
  %83 = shufflevector <2 x double> %82, <2 x double> %79, <2 x i32> <i32 0, i32 2>
  %84 = shufflevector <2 x double> %82, <2 x double> %79, <2 x i32> <i32 1, i32 3>
  %85 = fadd <2 x double> %83, %84
  %86 = extractelement <2 x double> %85, i64 0
  %87 = extractelement <2 x double> %85, i64 1
  %88 = fcmp ogt double %86, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %75
  store i32 2, ptr %5, align 4, !tbaa !18
  br label %90

90:                                               ; preds = %89, %75
  %.pr126 = phi i32 [ 2, %89 ], [ 1, %75 ]
  %.0 = phi double [ %86, %89 ], [ %87, %75 ]
  %91 = load <2 x double>, ptr %11, align 8, !tbaa !17
  %92 = fsub <2 x double> %91, %76
  %93 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %92)
  %shift = shufflevector <2 x double> %93, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %94 = fadd <2 x double> %93, %shift
  %95 = extractelement <2 x double> %94, i64 0
  %96 = fcmp ogt double %95, %.0
  br i1 %96, label %97, label %98

97:                                               ; preds = %90
  store i32 3, ptr %5, align 4, !tbaa !18
  br label %98

98:                                               ; preds = %97, %90
  %.pr = phi i32 [ 3, %97 ], [ %.pr126, %90 ]
  %.1 = phi double [ %95, %97 ], [ %.0, %90 ]
  %99 = fsub <2 x double> %91, %80
  %100 = call <2 x double> @llvm.fabs.v2f64(<2 x double> %99)
  %shift127 = shufflevector <2 x double> %100, <2 x double> poison, <2 x i32> <i32 1, i32 poison>
  %101 = fadd <2 x double> %100, %shift127
  %102 = extractelement <2 x double> %101, i64 0
  %103 = fcmp ogt double %102, %.1
  br i1 %103, label %108, label %104

104:                                              ; preds = %98
  switch i32 %.pr, label %default.unreachable [
    i32 1, label %105
    i32 2, label %106
    i32 3, label %107
  ]

105:                                              ; preds = %104
  store <2 x double> %76, ptr %11, align 8, !tbaa !17
  br label %109

106:                                              ; preds = %104
  store <2 x double> %80, ptr %11, align 8, !tbaa !17
  br label %109

107:                                              ; preds = %104
  store <2 x double> %76, ptr %9, align 8, !tbaa !17
  br label %109

default.unreachable:                              ; preds = %104
  unreachable

108:                                              ; preds = %98
  store i32 4, ptr %5, align 4, !tbaa !18
  store <2 x double> %91, ptr %9, align 8, !tbaa !17
  store <2 x double> %80, ptr %11, align 8, !tbaa !17
  br label %109

109:                                              ; preds = %106, %108, %107, %105
  %110 = getelementptr inbounds i8, ptr %0, i64 60
  %111 = load i32, ptr %110, align 4, !tbaa !19
  %112 = getelementptr inbounds i8, ptr %0, i64 64
  %113 = load i32, ptr %112, align 8, !tbaa !20
  %114 = add i32 %111, 5
  %115 = add i32 %114, %113
  %116 = getelementptr inbounds i8, ptr %1, i64 60
  %117 = load i32, ptr %116, align 4, !tbaa !19
  %.not = icmp slt i32 %115, %117
  %118 = getelementptr inbounds i8, ptr %1, i64 64
  %119 = load i32, ptr %118, align 8, !tbaa !20
  br i1 %.not, label %122, label %120

120:                                              ; preds = %109
  %121 = add nsw i32 %119, %113
  br label %.sink.split

122:                                              ; preds = %109
  %123 = icmp sgt i32 %119, %113
  br i1 %123, label %124, label %125

124:                                              ; preds = %122
  store i32 %117, ptr %110, align 4, !tbaa !19
  br label %.sink.split

.sink.split:                                      ; preds = %120, %124
  %.sink = phi i32 [ %119, %124 ], [ %121, %120 ]
  store i32 %.sink, ptr %112, align 8, !tbaa !20
  br label %125

125:                                              ; preds = %.sink.split, %122
  call void @_Z20UpdateLineParametersP11LineSegment(ptr noundef nonnull %0)
  br label %126

126:                                              ; preds = %125, %8, %4
  %.1118 = phi i1 [ false, %4 ], [ false, %8 ], [ true, %125 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  ret i1 %.1118
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z18ComputeMinDistanceddddi(double noundef, double noundef, double noundef, double noundef, i32 noundef) local_unnamed_addr #1

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

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

; 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>) #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 24}
!6 = !{!"_ZTS11LineSegment", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 60, !10, i64 64}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 40}
!12 = !{!6, !7, i64 32}
!13 = !{!6, !7, i64 48}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !10, i64 16}
!17 = !{!7, !7, i64 0}
!18 = !{!10, !10, i64 0}
!19 = !{!6, !10, i64 60}
!20 = !{!6, !10, i64 64}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass