; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_geometry)

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

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@__func__.Math_sqrDistLinesegLineseg_old = external hidden unnamed_addr constant [31 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [56 x i8], align 1
@RcsLogLevel = external global i32, align 4
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [11 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

declare void @Vec3d_sub(ptr noundef, ptr noundef, ptr noundef) #1

declare double @Vec3d_innerProduct(ptr noundef, ptr noundef) #1

declare void @Vec3d_constMulAndAdd(ptr noundef, ptr noundef, ptr noundef, double noundef) #1

declare double @Vec3d_sqrDistance(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local double @Math_sqrDistPointLineseg(ptr noundef, ptr noundef, ptr noundef, double noundef, ptr noundef) #2

declare double @Math_clip(double noundef, double noundef, double noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
declare dso_local double @Math_sqrDistLineLine(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local double @Math_sqrDistLinesegLineseg_old(ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef %3, ptr noundef %4, double noundef %5, ptr noundef %6, ptr noundef %7) #2 {
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca double, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca [2 x double], align 16
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca [3 x double], align 16
  %22 = alloca double, align 8
  %23 = alloca i32, align 4
  %24 = alloca [9 x double], align 16
  %25 = alloca [9 x [3 x double]], align 16
  %26 = alloca [9 x [3 x double]], align 16
  %27 = alloca [3 x double], align 16
  %28 = alloca [3 x double], align 16
  %29 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store double %2, ptr %12, align 8, !tbaa !9
  store ptr %3, ptr %13, align 8, !tbaa !5
  store ptr %4, ptr %14, align 8, !tbaa !5
  store double %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  %33 = load ptr, ptr %14, align 8, !tbaa !5
  %34 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  %35 = call double @Math_sqrDistLineLine(ptr noundef %30, ptr noundef %31, ptr noundef %32, ptr noundef %33, ptr noundef %34)
  store double %35, ptr %19, align 8, !tbaa !9
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  %40 = load double, ptr %39, align 16, !tbaa !9
  %41 = load double, ptr %12, align 8, !tbaa !9
  %42 = call double @Math_clip(double noundef %40, double noundef 0.000000e+00, double noundef %41)
  call void @Vec3d_constMulAndAdd(ptr noundef %36, ptr noundef %37, ptr noundef %38, double noundef %42)
  %43 = load ptr, ptr %17, align 8, !tbaa !5
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 1
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = load double, ptr %15, align 8, !tbaa !9
  %49 = call double @Math_clip(double noundef %47, double noundef 0.000000e+00, double noundef %48)
  call void @Vec3d_constMulAndAdd(ptr noundef %43, ptr noundef %44, ptr noundef %45, double noundef %49)
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %50 = load ptr, ptr %16, align 8, !tbaa !5
  %51 = load ptr, ptr %17, align 8, !tbaa !5
  %52 = call double @Vec3d_sqrDistance(ptr noundef %50, ptr noundef %51)
  store double %52, ptr %20, align 8, !tbaa !9
  %53 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  %54 = load double, ptr %53, align 16, !tbaa !9
  %55 = fcmp oge double %54, 0.000000e+00
  br i1 %55, label %56, label %138

56:                                               ; preds = %8
  %57 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  %58 = load double, ptr %57, align 16, !tbaa !9
  %59 = load double, ptr %12, align 8, !tbaa !9
  %60 = fcmp ole double %58, %59
  br i1 %60, label %61, label %138

61:                                               ; preds = %56
  %62 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 1
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = fcmp oge double %63, 0.000000e+00
  br i1 %64, label %65, label %138

65:                                               ; preds = %61
  %66 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 1
  %67 = load double, ptr %66, align 8, !tbaa !9
  %68 = load double, ptr %15, align 8, !tbaa !9
  %69 = fcmp ole double %67, %68
  br i1 %69, label %70, label %138

70:                                               ; preds = %65
  %71 = load double, ptr %19, align 8, !tbaa !9
  %72 = fcmp oeq double %71, 0.000000e+00
  br i1 %72, label %73, label %117

73:                                               ; preds = %70
  br label %74

74:                                               ; preds = %73
  %75 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %76 = icmp ne ptr %75, null
  br i1 %76, label %77, label %83

77:                                               ; preds = %74
  %78 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %79 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  %80 = load double, ptr %79, align 16, !tbaa !9
  %81 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 1
  %82 = load double, ptr %81, align 8, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %78(i32 noundef 1, ptr noundef @.str.1, ptr noundef @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 620, ptr noundef @.str.5, double noundef %80, double noundef %82)
  br label %83

83:                                               ; preds = %77, %74
  %84 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %85 = icmp sle i32 1, %84
  br i1 %85, label %86, label %97

86:                                               ; preds = %83
  %87 = load ptr, ptr @stderr, align 8, !tbaa !5
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef @.str.6, ptr noundef @.str.1, ptr noundef @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 620) #4
  %89 = load ptr, ptr @stderr, align 8, !tbaa !5
  %90 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 0
  %91 = load double, ptr %90, align 16, !tbaa !9
  %92 = getelementptr inbounds [2 x double], ptr %18, i64 0, i64 1
  %93 = load double, ptr %92, align 8, !tbaa !9
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.5, double noundef %91, double noundef %93) #4
  %95 = load ptr, ptr @stderr, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef @.str.4) #4
  br label %97

97:                                               ; preds = %86, %83
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #4
  %100 = getelementptr inbounds [3 x double], ptr %21, i64 0, i64 0
  %101 = load ptr, ptr %13, align 8, !tbaa !5
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Vec3d_sub(ptr noundef %100, ptr noundef %101, ptr noundef %102)
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %103 = getelementptr inbounds [3 x double], ptr %21, i64 0, i64 0
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  %105 = call double @Vec3d_innerProduct(ptr noundef %103, ptr noundef %104)
  store double %105, ptr %22, align 8, !tbaa !9
  %106 = load double, ptr %22, align 8, !tbaa !9
  %107 = fcmp oge double %106, 0.000000e+00
  br i1 %107, label %108, label %115

108:                                              ; preds = %99
  %109 = load double, ptr %22, align 8, !tbaa !9
  %110 = load double, ptr %12, align 8, !tbaa !9
  %111 = fcmp oge double %109, %110
  br i1 %111, label %112, label %113

112:                                              ; preds = %108
  br label %114

113:                                              ; preds = %108
  br label %114

114:                                              ; preds = %113, %112
  br label %116

115:                                              ; preds = %99
  br label %116

116:                                              ; preds = %115, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #4
  br label %136

117:                                              ; preds = %70
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %123

121:                                              ; preds = %118
  %122 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %122(i32 noundef 1, ptr noundef @.str.1, ptr noundef @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 641, ptr noundef @.str.7)
  br label %123

123:                                              ; preds = %121, %118
  %124 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %125 = icmp sle i32 1, %124
  br i1 %125, label %126, label %133

126:                                              ; preds = %123
  %127 = load ptr, ptr @stderr, align 8, !tbaa !5
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef @.str.6, ptr noundef @.str.1, ptr noundef @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 641) #4
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.7) #4
  %131 = load ptr, ptr @stderr, align 8, !tbaa !5
  %132 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef @.str.4) #4
  br label %133

133:                                              ; preds = %126, %123
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135, %116
  %137 = load double, ptr %20, align 8, !tbaa !9
  store double %137, ptr %9, align 8
  store i32 1, ptr %23, align 4
  br label %255

138:                                              ; preds = %65, %61, %56, %8
  call void @llvm.lifetime.start.p0(i64 72, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 216, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 216, ptr %26) #4
  %139 = load double, ptr %20, align 8, !tbaa !9
  %140 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 0
  store double %139, ptr %140, align 16, !tbaa !9
  %141 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 0
  %142 = getelementptr inbounds [3 x double], ptr %141, i64 0, i64 0
  %143 = load ptr, ptr %16, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %142, ptr noundef %143)
  %144 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 1
  %145 = getelementptr inbounds [3 x double], ptr %144, i64 0, i64 0
  %146 = load ptr, ptr %17, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %145, ptr noundef %146)
  call void @llvm.lifetime.start.p0(i64 24, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %28) #4
  %147 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = load ptr, ptr %14, align 8, !tbaa !5
  %150 = load double, ptr %15, align 8, !tbaa !9
  call void @Vec3d_constMulAndAdd(ptr noundef %147, ptr noundef %148, ptr noundef %149, double noundef %150)
  %151 = getelementptr inbounds [3 x double], ptr %27, i64 0, i64 0
  %152 = load ptr, ptr %10, align 8, !tbaa !5
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = load double, ptr %12, align 8, !tbaa !9
  call void @Vec3d_constMulAndAdd(ptr noundef %151, ptr noundef %152, ptr noundef %153, double noundef %154)
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  %156 = load ptr, ptr %10, align 8, !tbaa !5
  %157 = load ptr, ptr %11, align 8, !tbaa !5
  %158 = load double, ptr %12, align 8, !tbaa !9
  %159 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 1
  %160 = getelementptr inbounds [3 x double], ptr %159, i64 0, i64 0
  %161 = call double @Math_sqrDistPointLineseg(ptr noundef %155, ptr noundef %156, ptr noundef %157, double noundef %158, ptr noundef %160)
  %162 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 1
  store double %161, ptr %162, align 8, !tbaa !9
  %163 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 1
  %164 = getelementptr inbounds [3 x double], ptr %163, i64 0, i64 0
  %165 = load ptr, ptr %13, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %164, ptr noundef %165)
  %166 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  %169 = load double, ptr %12, align 8, !tbaa !9
  %170 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 2
  %171 = getelementptr inbounds [3 x double], ptr %170, i64 0, i64 0
  %172 = call double @Math_sqrDistPointLineseg(ptr noundef %166, ptr noundef %167, ptr noundef %168, double noundef %169, ptr noundef %171)
  %173 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 2
  store double %172, ptr %173, align 16, !tbaa !9
  %174 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 2
  %175 = getelementptr inbounds [3 x double], ptr %174, i64 0, i64 0
  %176 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %175, ptr noundef %176)
  %177 = load ptr, ptr %10, align 8, !tbaa !5
  %178 = load ptr, ptr %13, align 8, !tbaa !5
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  %180 = load double, ptr %15, align 8, !tbaa !9
  %181 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 3
  %182 = getelementptr inbounds [3 x double], ptr %181, i64 0, i64 0
  %183 = call double @Math_sqrDistPointLineseg(ptr noundef %177, ptr noundef %178, ptr noundef %179, double noundef %180, ptr noundef %182)
  %184 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 3
  store double %183, ptr %184, align 8, !tbaa !9
  %185 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 3
  %186 = getelementptr inbounds [3 x double], ptr %185, i64 0, i64 0
  %187 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %186, ptr noundef %187)
  %188 = load ptr, ptr %10, align 8, !tbaa !5
  %189 = load ptr, ptr %13, align 8, !tbaa !5
  %190 = call double @Vec3d_sqrDistance(ptr noundef %188, ptr noundef %189)
  %191 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 4
  store double %190, ptr %191, align 16, !tbaa !9
  %192 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 4
  %193 = getelementptr inbounds [3 x double], ptr %192, i64 0, i64 0
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %193, ptr noundef %194)
  %195 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 4
  %196 = getelementptr inbounds [3 x double], ptr %195, i64 0, i64 0
  %197 = load ptr, ptr %13, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %196, ptr noundef %197)
  %198 = load ptr, ptr %10, align 8, !tbaa !5
  %199 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  %200 = call double @Vec3d_sqrDistance(ptr noundef %198, ptr noundef %199)
  %201 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 5
  store double %200, ptr %201, align 8, !tbaa !9
  %202 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 5
  %203 = getelementptr inbounds [3 x double], ptr %202, i64 0, i64 0
  %204 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %203, ptr noundef %204)
  %205 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 5
  %206 = getelementptr inbounds [3 x double], ptr %205, i64 0, i64 0
  %207 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %206, ptr noundef %207)
  %208 = load ptr, ptr %10, align 8, !tbaa !5
  %209 = load ptr, ptr %13, align 8, !tbaa !5
  %210 = load ptr, ptr %14, align 8, !tbaa !5
  %211 = load double, ptr %15, align 8, !tbaa !9
  %212 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 6
  %213 = getelementptr inbounds [3 x double], ptr %212, i64 0, i64 0
  %214 = call double @Math_sqrDistPointLineseg(ptr noundef %208, ptr noundef %209, ptr noundef %210, double noundef %211, ptr noundef %213)
  %215 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 6
  store double %214, ptr %215, align 16, !tbaa !9
  %216 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 6
  %217 = getelementptr inbounds [3 x double], ptr %216, i64 0, i64 0
  %218 = load ptr, ptr %10, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %217, ptr noundef %218)
  %219 = getelementptr inbounds [3 x double], ptr %27, i64 0, i64 0
  %220 = load ptr, ptr %13, align 8, !tbaa !5
  %221 = call double @Vec3d_sqrDistance(ptr noundef %219, ptr noundef %220)
  %222 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 7
  store double %221, ptr %222, align 8, !tbaa !9
  %223 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 7
  %224 = getelementptr inbounds [3 x double], ptr %223, i64 0, i64 0
  %225 = getelementptr inbounds [3 x double], ptr %27, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %224, ptr noundef %225)
  %226 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 7
  %227 = getelementptr inbounds [3 x double], ptr %226, i64 0, i64 0
  %228 = load ptr, ptr %13, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %227, ptr noundef %228)
  %229 = getelementptr inbounds [3 x double], ptr %27, i64 0, i64 0
  %230 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  %231 = call double @Vec3d_sqrDistance(ptr noundef %229, ptr noundef %230)
  %232 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 8
  store double %231, ptr %232, align 16, !tbaa !9
  %233 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 8
  %234 = getelementptr inbounds [3 x double], ptr %233, i64 0, i64 0
  %235 = getelementptr inbounds [3 x double], ptr %27, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %234, ptr noundef %235)
  %236 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 8
  %237 = getelementptr inbounds [3 x double], ptr %236, i64 0, i64 0
  %238 = getelementptr inbounds [3 x double], ptr %28, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %237, ptr noundef %238)
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %239 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 1
  %240 = call i32 @VecNd_indexMin(ptr noundef %239, i32 noundef 8)
  store i32 %240, ptr %29, align 4, !tbaa !11
  %241 = load ptr, ptr %16, align 8, !tbaa !5
  %242 = load i32, ptr %29, align 4, !tbaa !11
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [9 x [3 x double]], ptr %25, i64 0, i64 %243
  %245 = getelementptr inbounds [3 x double], ptr %244, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %241, ptr noundef %245)
  %246 = load ptr, ptr %17, align 8, !tbaa !5
  %247 = load i32, ptr %29, align 4, !tbaa !11
  %248 = sext i32 %247 to i64
  %249 = getelementptr inbounds [9 x [3 x double]], ptr %26, i64 0, i64 %248
  %250 = getelementptr inbounds [3 x double], ptr %249, i64 0, i64 0
  call void @Vec3d_copy(ptr noundef %246, ptr noundef %250)
  %251 = load i32, ptr %29, align 4, !tbaa !11
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 %252
  %254 = load double, ptr %253, align 8, !tbaa !9
  store double %254, ptr %9, align 8
  store i32 1, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr %24) #4
  br label %255

255:                                              ; preds = %138, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  %256 = load double, ptr %9, align 8
  ret double %256
}

declare void @Vec3d_copy(ptr noundef, ptr noundef) #1

declare i32 @VecNd_indexMin(ptr noundef, i32 noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@__func__.Math_sqrDistLinesegLineseg_old = external hidden unnamed_addr constant [31 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [56 x i8], align 1
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1

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

declare void @Vec3d_sub(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare double @Vec3d_innerProduct(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @Vec3d_constMulAndAdd(ptr noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

declare double @Vec3d_sqrDistance(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare double @Math_clip(double noundef, double noundef, double noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local double @Math_sqrDistLinesegLineseg_old(ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef %3, ptr noundef %4, double noundef %5, ptr noundef %6, ptr noundef %7) local_unnamed_addr #2 {
  %9 = alloca [2 x double], align 16
  %10 = alloca [3 x double], align 16
  %11 = alloca [9 x double], align 16
  %12 = alloca [9 x [3 x double]], align 16
  %13 = alloca [9 x [3 x double]], align 16
  %14 = alloca [3 x double], align 16
  %15 = alloca [3 x double], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  %16 = call double @Math_sqrDistLineLine(ptr noundef %0, ptr noundef %1, ptr noundef %3, ptr noundef %4, ptr noundef nonnull %9)
  %17 = load double, ptr %9, align 16, !tbaa !5
  %18 = call double @Math_clip(double noundef %17, double noundef 0.000000e+00, double noundef %2) #4
  call void @Vec3d_constMulAndAdd(ptr noundef %6, ptr noundef %0, ptr noundef %1, double noundef %18) #4
  %19 = getelementptr inbounds i8, ptr %9, i64 8
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = call double @Math_clip(double noundef %20, double noundef 0.000000e+00, double noundef %5) #4
  call void @Vec3d_constMulAndAdd(ptr noundef %7, ptr noundef %3, ptr noundef %4, double noundef %21) #4
  %22 = call double @Vec3d_sqrDistance(ptr noundef %6, ptr noundef %7) #4
  %23 = load double, ptr %9, align 16, !tbaa !5
  %24 = fcmp ult double %23, 0.000000e+00
  br i1 %24, label %62, label %25

25:                                               ; preds = %8
  %26 = fcmp ugt double %23, %2
  %27 = load double, ptr %19, align 8
  %28 = fcmp ult double %27, 0.000000e+00
  %29 = fcmp ugt double %27, %5
  %30 = or i1 %28, %29
  %or.cond69 = select i1 %26, i1 true, i1 %30
  br i1 %or.cond69, label %62, label %31

31:                                               ; preds = %25
  %32 = fcmp oeq double %16, 0.000000e+00
  %33 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !9
  %.not68 = icmp eq ptr %33, null
  br i1 %32, label %34, label %50

34:                                               ; preds = %31
  br i1 %.not68, label %36, label %35

35:                                               ; preds = %34
  call void (i32, ptr, ptr, i32, ptr, ...) %33(i32 noundef 1, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 620, ptr noundef nonnull @.str.5, double noundef %23, double noundef %27) #4
  br label %36

36:                                               ; preds = %35, %34
  %37 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %39, label %48

39:                                               ; preds = %36
  %40 = load ptr, ptr @stderr, align 8, !tbaa !9
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 620) #5
  %42 = load ptr, ptr @stderr, align 8, !tbaa !9
  %43 = load double, ptr %9, align 16, !tbaa !5
  %44 = load double, ptr %19, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.5, double noundef %43, double noundef %44) #5
  %46 = load ptr, ptr @stderr, align 8, !tbaa !9
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef nonnull @.str.4) #5
  br label %48

48:                                               ; preds = %39, %36
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #4
  call void @Vec3d_sub(ptr noundef nonnull %10, ptr noundef %3, ptr noundef %0) #4
  %49 = call double @Vec3d_innerProduct(ptr noundef nonnull %10, ptr noundef %1) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #4
  br label %101

50:                                               ; preds = %31
  br i1 %.not68, label %52, label %51

51:                                               ; preds = %50
  call void (i32, ptr, ptr, i32, ptr, ...) %33(i32 noundef 1, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 641, ptr noundef nonnull @.str.7) #4
  br label %52

52:                                               ; preds = %51, %50
  %53 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %101

55:                                               ; preds = %52
  %56 = load ptr, ptr @stderr, align 8, !tbaa !9
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_sqrDistLinesegLineseg_old, i32 noundef 641) #5
  %58 = load ptr, ptr @stderr, align 8, !tbaa !9
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str.7) #5
  %60 = load ptr, ptr @stderr, align 8, !tbaa !9
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef nonnull @.str.4) #5
  br label %101

62:                                               ; preds = %25, %8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %13) #4
  store double %22, ptr %11, align 16, !tbaa !5
  call void @Vec3d_copy(ptr noundef nonnull %12, ptr noundef %6) #4
  %63 = getelementptr inbounds i8, ptr %12, i64 24
  call void @Vec3d_copy(ptr noundef nonnull %63, ptr noundef %7) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %15) #4
  call void @Vec3d_constMulAndAdd(ptr noundef nonnull %15, ptr noundef %3, ptr noundef %4, double noundef %5) #4
  call void @Vec3d_constMulAndAdd(ptr noundef nonnull %14, ptr noundef %0, ptr noundef %1, double noundef %2) #4
  %64 = call double @Math_sqrDistPointLineseg(ptr noundef %3, ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef nonnull %63)
  %65 = getelementptr inbounds i8, ptr %11, i64 8
  store double %64, ptr %65, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %13, i64 24
  call void @Vec3d_copy(ptr noundef nonnull %66, ptr noundef %3) #4
  %67 = getelementptr inbounds i8, ptr %12, i64 48
  %68 = call double @Math_sqrDistPointLineseg(ptr noundef nonnull %15, ptr noundef %0, ptr noundef %1, double noundef %2, ptr noundef nonnull %67)
  %69 = getelementptr inbounds i8, ptr %11, i64 16
  store double %68, ptr %69, align 16, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %13, i64 48
  call void @Vec3d_copy(ptr noundef nonnull %70, ptr noundef nonnull %15) #4
  %71 = getelementptr inbounds i8, ptr %13, i64 72
  %72 = call double @Math_sqrDistPointLineseg(ptr noundef %0, ptr noundef %3, ptr noundef %4, double noundef %5, ptr noundef nonnull %71)
  %73 = getelementptr inbounds i8, ptr %11, i64 24
  store double %72, ptr %73, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %12, i64 72
  call void @Vec3d_copy(ptr noundef nonnull %74, ptr noundef %0) #4
  %75 = call double @Vec3d_sqrDistance(ptr noundef %0, ptr noundef %3) #4
  %76 = getelementptr inbounds i8, ptr %11, i64 32
  store double %75, ptr %76, align 16, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %12, i64 96
  call void @Vec3d_copy(ptr noundef nonnull %77, ptr noundef %0) #4
  %78 = getelementptr inbounds i8, ptr %13, i64 96
  call void @Vec3d_copy(ptr noundef nonnull %78, ptr noundef %3) #4
  %79 = call double @Vec3d_sqrDistance(ptr noundef %0, ptr noundef nonnull %15) #4
  %80 = getelementptr inbounds i8, ptr %11, i64 40
  store double %79, ptr %80, align 8, !tbaa !5
  %81 = getelementptr inbounds i8, ptr %12, i64 120
  call void @Vec3d_copy(ptr noundef nonnull %81, ptr noundef %0) #4
  %82 = getelementptr inbounds i8, ptr %13, i64 120
  call void @Vec3d_copy(ptr noundef nonnull %82, ptr noundef nonnull %15) #4
  %83 = getelementptr inbounds i8, ptr %13, i64 144
  %84 = call double @Math_sqrDistPointLineseg(ptr noundef %0, ptr noundef %3, ptr noundef %4, double noundef %5, ptr noundef nonnull %83)
  %85 = getelementptr inbounds i8, ptr %11, i64 48
  store double %84, ptr %85, align 16, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %12, i64 144
  call void @Vec3d_copy(ptr noundef nonnull %86, ptr noundef %0) #4
  %87 = call double @Vec3d_sqrDistance(ptr noundef nonnull %14, ptr noundef %3) #4
  %88 = getelementptr inbounds i8, ptr %11, i64 56
  store double %87, ptr %88, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %12, i64 168
  call void @Vec3d_copy(ptr noundef nonnull %89, ptr noundef nonnull %14) #4
  %90 = getelementptr inbounds i8, ptr %13, i64 168
  call void @Vec3d_copy(ptr noundef nonnull %90, ptr noundef %3) #4
  %91 = call double @Vec3d_sqrDistance(ptr noundef nonnull %14, ptr noundef nonnull %15) #4
  %92 = getelementptr inbounds i8, ptr %11, i64 64
  store double %91, ptr %92, align 16, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %12, i64 192
  call void @Vec3d_copy(ptr noundef nonnull %93, ptr noundef nonnull %14) #4
  %94 = getelementptr inbounds i8, ptr %13, i64 192
  call void @Vec3d_copy(ptr noundef nonnull %94, ptr noundef nonnull %15) #4
  %95 = call i32 @VecNd_indexMin(ptr noundef nonnull %65, i32 noundef 8) #4
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [9 x [3 x double]], ptr %12, i64 0, i64 %96
  call void @Vec3d_copy(ptr noundef %6, ptr noundef nonnull %97) #4
  %98 = getelementptr inbounds [9 x [3 x double]], ptr %13, i64 0, i64 %96
  call void @Vec3d_copy(ptr noundef %7, ptr noundef nonnull %98) #4
  %99 = getelementptr inbounds [9 x double], ptr %11, i64 0, i64 %96
  %100 = load double, ptr %99, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #4
  br label %101

101:                                              ; preds = %48, %55, %52, %62
  %.0 = phi double [ %100, %62 ], [ %22, %52 ], [ %22, %55 ], [ %22, %48 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  ret double %.0
}

declare void @Vec3d_copy(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @VecNd_indexMin(ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 #4 = { nounwind }
attributes #5 = { cold 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass