; LLVM IR from PyojinKim/LPVO :: LPVO_core/addon/lsd_1.6 (lsd)

; 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.rect = type { double, double, double, double, double, double, double, double, double, double, double, double }
%struct.image_double_s = type { ptr, i32, i32 }
%struct.image_char_s = type { ptr, i32, i32 }
%struct.coorlist = type { i32, i32, ptr }
%struct.image_int_s = type { ptr, i32, i32 }
%struct.point = type { i32, i32 }
%struct.ntuple_list_s = type { i32, i32, i32, ptr }

@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @LineSegmentDetection(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, double noundef %8, double noundef %9, i32 noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef %13) #0 {
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  %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 i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca ptr, align 8
  %34 = alloca ptr, align 8
  %35 = alloca ptr, align 8
  %36 = alloca ptr, align 8
  %37 = alloca ptr, align 8
  %38 = alloca ptr, align 8
  %39 = alloca %struct.rect, align 8
  %40 = alloca ptr, align 8
  %41 = alloca i32, align 4
  %42 = alloca i32, align 4
  %43 = alloca i32, align 4
  %44 = alloca i32, align 4
  %45 = alloca i32, align 4
  %46 = alloca double, align 8
  %47 = alloca double, align 8
  %48 = alloca double, align 8
  %49 = alloca double, align 8
  %50 = alloca double, align 8
  %51 = alloca double, align 8
  %52 = alloca i32, align 4
  store ptr %0, ptr %15, align 8, !tbaa !5
  store ptr %1, ptr %16, align 8, !tbaa !5
  store i32 %2, ptr %17, align 4, !tbaa !9
  store i32 %3, ptr %18, align 4, !tbaa !9
  store double %4, ptr %19, align 8, !tbaa !11
  store double %5, ptr %20, align 8, !tbaa !11
  store double %6, ptr %21, align 8, !tbaa !11
  store double %7, ptr %22, align 8, !tbaa !11
  store double %8, ptr %23, align 8, !tbaa !11
  store double %9, ptr %24, align 8, !tbaa !11
  store i32 %10, ptr %25, align 4, !tbaa !9
  store ptr %11, ptr %26, align 8, !tbaa !5
  store ptr %12, ptr %27, align 8, !tbaa !5
  store ptr %13, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #4
  %53 = call ptr @new_ntuple_list(i32 noundef 7)
  store ptr %53, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #4
  store ptr null, ptr %36, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #4
  call void @llvm.lifetime.start.p0(i64 96, ptr %39) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %40) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %42) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %43) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %44) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %45) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %46) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %47) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %48) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %50) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %51) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %52) #4
  store i32 0, ptr %52, align 4, !tbaa !9
  %54 = load ptr, ptr %16, align 8, !tbaa !5
  %55 = icmp eq ptr %54, null
  br i1 %55, label %62, label %56

56:                                               ; preds = %14
  %57 = load i32, ptr %17, align 4, !tbaa !9
  %58 = icmp sle i32 %57, 0
  br i1 %58, label %62, label %59

59:                                               ; preds = %56
  %60 = load i32, ptr %18, align 4, !tbaa !9
  %61 = icmp sle i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %59, %56, %14
  call void @error(ptr noundef @.str)
  br label %63

63:                                               ; preds = %62, %59
  %64 = load double, ptr %19, align 8, !tbaa !11
  %65 = fcmp ole double %64, 0.000000e+00
  br i1 %65, label %66, label %67

66:                                               ; preds = %63
  call void @error(ptr noundef @.str.1)
  br label %67

67:                                               ; preds = %66, %63
  %68 = load double, ptr %20, align 8, !tbaa !11
  %69 = fcmp ole double %68, 0.000000e+00
  br i1 %69, label %70, label %71

70:                                               ; preds = %67
  call void @error(ptr noundef @.str.2)
  br label %71

71:                                               ; preds = %70, %67
  %72 = load double, ptr %21, align 8, !tbaa !11
  %73 = fcmp olt double %72, 0.000000e+00
  br i1 %73, label %74, label %75

74:                                               ; preds = %71
  call void @error(ptr noundef @.str.3)
  br label %75

75:                                               ; preds = %74, %71
  %76 = load double, ptr %22, align 8, !tbaa !11
  %77 = fcmp ole double %76, 0.000000e+00
  br i1 %77, label %81, label %78

78:                                               ; preds = %75
  %79 = load double, ptr %22, align 8, !tbaa !11
  %80 = fcmp oge double %79, 1.800000e+02
  br i1 %80, label %81, label %82

81:                                               ; preds = %78, %75
  call void @error(ptr noundef @.str.4)
  br label %82

82:                                               ; preds = %81, %78
  %83 = load double, ptr %24, align 8, !tbaa !11
  %84 = fcmp olt double %83, 0.000000e+00
  br i1 %84, label %88, label %85

85:                                               ; preds = %82
  %86 = load double, ptr %24, align 8, !tbaa !11
  %87 = fcmp ogt double %86, 1.000000e+00
  br i1 %87, label %88, label %89

88:                                               ; preds = %85, %82
  call void @error(ptr noundef @.str.5)
  br label %89

89:                                               ; preds = %88, %85
  %90 = load i32, ptr %25, align 4, !tbaa !9
  %91 = icmp sle i32 %90, 0
  br i1 %91, label %92, label %93

92:                                               ; preds = %89
  call void @error(ptr noundef @.str.6)
  br label %93

93:                                               ; preds = %92, %89
  %94 = load double, ptr %22, align 8, !tbaa !11
  %95 = fmul double 0x400921FB54442D18, %94
  %96 = fdiv double %95, 1.800000e+02
  store double %96, ptr %48, align 8, !tbaa !11
  %97 = load double, ptr %22, align 8, !tbaa !11
  %98 = fdiv double %97, 1.800000e+02
  store double %98, ptr %49, align 8, !tbaa !11
  %99 = load double, ptr %21, align 8, !tbaa !11
  %100 = load double, ptr %48, align 8, !tbaa !11
  %101 = call double @sin(double noundef %100) #4
  %102 = fdiv double %99, %101
  store double %102, ptr %46, align 8, !tbaa !11
  %103 = load i32, ptr %17, align 4, !tbaa !9
  %104 = load i32, ptr %18, align 4, !tbaa !9
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = call ptr @new_image_double_ptr(i32 noundef %103, i32 noundef %104, ptr noundef %105)
  store ptr %106, ptr %29, align 8, !tbaa !5
  %107 = load double, ptr %19, align 8, !tbaa !11
  %108 = fcmp une double %107, 1.000000e+00
  br i1 %108, label %109, label %119

109:                                              ; preds = %93
  %110 = load ptr, ptr %29, align 8, !tbaa !5
  %111 = load double, ptr %19, align 8, !tbaa !11
  %112 = load double, ptr %20, align 8, !tbaa !11
  %113 = call ptr @gaussian_sampler(ptr noundef %110, double noundef %111, double noundef %112)
  store ptr %113, ptr %32, align 8, !tbaa !5
  %114 = load ptr, ptr %32, align 8, !tbaa !5
  %115 = load double, ptr %46, align 8, !tbaa !11
  %116 = load i32, ptr %25, align 4, !tbaa !9
  %117 = call ptr @ll_angle(ptr noundef %114, double noundef %115, ptr noundef %37, ptr noundef %38, ptr noundef %34, i32 noundef %116)
  store ptr %117, ptr %33, align 8, !tbaa !5
  %118 = load ptr, ptr %32, align 8, !tbaa !5
  call void @free_image_double(ptr noundef %118)
  br label %124

119:                                              ; preds = %93
  %120 = load ptr, ptr %29, align 8, !tbaa !5
  %121 = load double, ptr %46, align 8, !tbaa !11
  %122 = load i32, ptr %25, align 4, !tbaa !9
  %123 = call ptr @ll_angle(ptr noundef %120, double noundef %121, ptr noundef %37, ptr noundef %38, ptr noundef %34, i32 noundef %122)
  store ptr %123, ptr %33, align 8, !tbaa !5
  br label %124

124:                                              ; preds = %119, %109
  %125 = load ptr, ptr %33, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.image_double_s, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 8, !tbaa !13
  store i32 %127, ptr %44, align 4, !tbaa !9
  %128 = load ptr, ptr %33, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.image_double_s, ptr %128, i32 0, i32 2
  %130 = load i32, ptr %129, align 4, !tbaa !15
  store i32 %130, ptr %45, align 4, !tbaa !9
  %131 = load i32, ptr %44, align 4, !tbaa !9
  %132 = uitofp i32 %131 to double
  %133 = call double @log10(double noundef %132) #4
  %134 = load i32, ptr %45, align 4, !tbaa !9
  %135 = uitofp i32 %134 to double
  %136 = call double @log10(double noundef %135) #4
  %137 = fadd double %133, %136
  %138 = fmul double 5.000000e+00, %137
  %139 = fdiv double %138, 2.000000e+00
  %140 = call double @log10(double noundef 1.100000e+01) #4
  %141 = fadd double %139, %140
  store double %141, ptr %51, align 8, !tbaa !11
  %142 = load double, ptr %51, align 8, !tbaa !11
  %143 = fneg double %142
  %144 = load double, ptr %49, align 8, !tbaa !11
  %145 = call double @log10(double noundef %144) #4
  %146 = fdiv double %143, %145
  %147 = fptosi double %146 to i32
  store i32 %147, ptr %42, align 4, !tbaa !9
  %148 = load ptr, ptr %26, align 8, !tbaa !5
  %149 = icmp ne ptr %148, null
  br i1 %149, label %150, label %164

150:                                              ; preds = %124
  %151 = load ptr, ptr %27, align 8, !tbaa !5
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %164

153:                                              ; preds = %150
  %154 = load ptr, ptr %28, align 8, !tbaa !5
  %155 = icmp ne ptr %154, null
  br i1 %155, label %156, label %164

156:                                              ; preds = %153
  %157 = load ptr, ptr %33, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.image_double_s, ptr %157, i32 0, i32 1
  %159 = load i32, ptr %158, align 8, !tbaa !13
  %160 = load ptr, ptr %33, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.image_double_s, ptr %160, i32 0, i32 2
  %162 = load i32, ptr %161, align 4, !tbaa !15
  %163 = call ptr @new_image_int_ini(i32 noundef %159, i32 noundef %162, i32 noundef 0)
  store ptr %163, ptr %36, align 8, !tbaa !5
  br label %164

164:                                              ; preds = %156, %153, %150, %124
  %165 = load i32, ptr %44, align 4, !tbaa !9
  %166 = load i32, ptr %45, align 4, !tbaa !9
  %167 = call ptr @new_image_char_ini(i32 noundef %165, i32 noundef %166, i8 noundef zeroext 0)
  store ptr %167, ptr %35, align 8, !tbaa !5
  %168 = load i32, ptr %44, align 4, !tbaa !9
  %169 = load i32, ptr %45, align 4, !tbaa !9
  %170 = mul i32 %168, %169
  %171 = zext i32 %170 to i64
  %172 = call noalias ptr @calloc(i64 noundef %171, i64 noundef 8) #5
  store ptr %172, ptr %40, align 8, !tbaa !5
  %173 = load ptr, ptr %40, align 8, !tbaa !5
  %174 = icmp eq ptr %173, null
  br i1 %174, label %175, label %176

175:                                              ; preds = %164
  call void @error(ptr noundef @.str.7)
  br label %176

176:                                              ; preds = %175, %164
  br label %177

177:                                              ; preds = %351, %176
  %178 = load ptr, ptr %37, align 8, !tbaa !5
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %355

180:                                              ; preds = %177
  %181 = load ptr, ptr %35, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.image_char_s, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %182, align 8, !tbaa !16
  %184 = load ptr, ptr %37, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.coorlist, ptr %184, i32 0, i32 0
  %186 = load i32, ptr %185, align 8, !tbaa !18
  %187 = load ptr, ptr %37, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.coorlist, ptr %187, i32 0, i32 1
  %189 = load i32, ptr %188, align 4, !tbaa !20
  %190 = load ptr, ptr %35, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.image_char_s, ptr %190, i32 0, i32 1
  %192 = load i32, ptr %191, align 8, !tbaa !21
  %193 = mul i32 %189, %192
  %194 = add i32 %186, %193
  %195 = zext i32 %194 to i64
  %196 = getelementptr inbounds i8, ptr %183, i64 %195
  %197 = load i8, ptr %196, align 1, !tbaa !22
  %198 = zext i8 %197 to i32
  %199 = icmp eq i32 %198, 0
  br i1 %199, label %200, label %350

200:                                              ; preds = %180
  %201 = load ptr, ptr %33, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.image_double_s, ptr %201, i32 0, i32 0
  %203 = load ptr, ptr %202, align 8, !tbaa !23
  %204 = load ptr, ptr %37, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.coorlist, ptr %204, i32 0, i32 0
  %206 = load i32, ptr %205, align 8, !tbaa !18
  %207 = load ptr, ptr %37, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.coorlist, ptr %207, i32 0, i32 1
  %209 = load i32, ptr %208, align 4, !tbaa !20
  %210 = load ptr, ptr %33, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.image_double_s, ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 8, !tbaa !13
  %213 = mul i32 %209, %212
  %214 = add i32 %206, %213
  %215 = zext i32 %214 to i64
  %216 = getelementptr inbounds double, ptr %203, i64 %215
  %217 = load double, ptr %216, align 8, !tbaa !11
  %218 = fcmp une double %217, -1.024000e+03
  br i1 %218, label %219, label %350

219:                                              ; preds = %200
  %220 = load ptr, ptr %37, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.coorlist, ptr %220, i32 0, i32 0
  %222 = load i32, ptr %221, align 8, !tbaa !18
  %223 = load ptr, ptr %37, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.coorlist, ptr %223, i32 0, i32 1
  %225 = load i32, ptr %224, align 4, !tbaa !20
  %226 = load ptr, ptr %33, align 8, !tbaa !5
  %227 = load ptr, ptr %40, align 8, !tbaa !5
  %228 = load ptr, ptr %35, align 8, !tbaa !5
  %229 = load double, ptr %48, align 8, !tbaa !11
  call void @region_grow(i32 noundef %222, i32 noundef %225, ptr noundef %226, ptr noundef %227, ptr noundef %41, ptr noundef %47, ptr noundef %228, double noundef %229)
  %230 = load i32, ptr %41, align 4, !tbaa !9
  %231 = load i32, ptr %42, align 4, !tbaa !9
  %232 = icmp slt i32 %230, %231
  br i1 %232, label %233, label %234

233:                                              ; preds = %219
  br label %351

234:                                              ; preds = %219
  %235 = load ptr, ptr %40, align 8, !tbaa !5
  %236 = load i32, ptr %41, align 4, !tbaa !9
  %237 = load ptr, ptr %34, align 8, !tbaa !5
  %238 = load double, ptr %47, align 8, !tbaa !11
  %239 = load double, ptr %48, align 8, !tbaa !11
  %240 = load double, ptr %49, align 8, !tbaa !11
  call void @region2rect(ptr noundef %235, i32 noundef %236, ptr noundef %237, double noundef %238, double noundef %239, double noundef %240, ptr noundef %39)
  %241 = load ptr, ptr %40, align 8, !tbaa !5
  %242 = load ptr, ptr %34, align 8, !tbaa !5
  %243 = load double, ptr %47, align 8, !tbaa !11
  %244 = load double, ptr %48, align 8, !tbaa !11
  %245 = load double, ptr %49, align 8, !tbaa !11
  %246 = load ptr, ptr %35, align 8, !tbaa !5
  %247 = load ptr, ptr %33, align 8, !tbaa !5
  %248 = load double, ptr %24, align 8, !tbaa !11
  %249 = call i32 @refine(ptr noundef %241, ptr noundef %41, ptr noundef %242, double noundef %243, double noundef %244, double noundef %245, ptr noundef %39, ptr noundef %246, ptr noundef %247, double noundef %248)
  %250 = icmp ne i32 %249, 0
  br i1 %250, label %252, label %251

251:                                              ; preds = %234
  br label %351

252:                                              ; preds = %234
  %253 = load ptr, ptr %33, align 8, !tbaa !5
  %254 = load double, ptr %51, align 8, !tbaa !11
  %255 = load double, ptr %23, align 8, !tbaa !11
  %256 = call double @rect_improve(ptr noundef %39, ptr noundef %253, double noundef %254, double noundef %255)
  store double %256, ptr %50, align 8, !tbaa !11
  %257 = load double, ptr %50, align 8, !tbaa !11
  %258 = load double, ptr %23, align 8, !tbaa !11
  %259 = fcmp ole double %257, %258
  br i1 %259, label %260, label %261

260:                                              ; preds = %252
  br label %351

261:                                              ; preds = %252
  %262 = load i32, ptr %52, align 4, !tbaa !9
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %52, align 4, !tbaa !9
  %264 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 0
  %265 = load double, ptr %264, align 8, !tbaa !24
  %266 = fadd double %265, 5.000000e-01
  store double %266, ptr %264, align 8, !tbaa !24
  %267 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 1
  %268 = load double, ptr %267, align 8, !tbaa !26
  %269 = fadd double %268, 5.000000e-01
  store double %269, ptr %267, align 8, !tbaa !26
  %270 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 2
  %271 = load double, ptr %270, align 8, !tbaa !27
  %272 = fadd double %271, 5.000000e-01
  store double %272, ptr %270, align 8, !tbaa !27
  %273 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 3
  %274 = load double, ptr %273, align 8, !tbaa !28
  %275 = fadd double %274, 5.000000e-01
  store double %275, ptr %273, align 8, !tbaa !28
  %276 = load double, ptr %19, align 8, !tbaa !11
  %277 = fcmp une double %276, 1.000000e+00
  br i1 %277, label %278, label %299

278:                                              ; preds = %261
  %279 = load double, ptr %19, align 8, !tbaa !11
  %280 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 0
  %281 = load double, ptr %280, align 8, !tbaa !24
  %282 = fdiv double %281, %279
  store double %282, ptr %280, align 8, !tbaa !24
  %283 = load double, ptr %19, align 8, !tbaa !11
  %284 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 1
  %285 = load double, ptr %284, align 8, !tbaa !26
  %286 = fdiv double %285, %283
  store double %286, ptr %284, align 8, !tbaa !26
  %287 = load double, ptr %19, align 8, !tbaa !11
  %288 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 2
  %289 = load double, ptr %288, align 8, !tbaa !27
  %290 = fdiv double %289, %287
  store double %290, ptr %288, align 8, !tbaa !27
  %291 = load double, ptr %19, align 8, !tbaa !11
  %292 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 3
  %293 = load double, ptr %292, align 8, !tbaa !28
  %294 = fdiv double %293, %291
  store double %294, ptr %292, align 8, !tbaa !28
  %295 = load double, ptr %19, align 8, !tbaa !11
  %296 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 4
  %297 = load double, ptr %296, align 8, !tbaa !29
  %298 = fdiv double %297, %295
  store double %298, ptr %296, align 8, !tbaa !29
  br label %299

299:                                              ; preds = %278, %261
  %300 = load ptr, ptr %30, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 0
  %302 = load double, ptr %301, align 8, !tbaa !24
  %303 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 1
  %304 = load double, ptr %303, align 8, !tbaa !26
  %305 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 2
  %306 = load double, ptr %305, align 8, !tbaa !27
  %307 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 3
  %308 = load double, ptr %307, align 8, !tbaa !28
  %309 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 4
  %310 = load double, ptr %309, align 8, !tbaa !29
  %311 = getelementptr inbounds %struct.rect, ptr %39, i32 0, i32 11
  %312 = load double, ptr %311, align 8, !tbaa !30
  %313 = load double, ptr %50, align 8, !tbaa !11
  call void @add_7tuple(ptr noundef %300, double noundef %302, double noundef %304, double noundef %306, double noundef %308, double noundef %310, double noundef %312, double noundef %313)
  %314 = load ptr, ptr %36, align 8, !tbaa !5
  %315 = icmp ne ptr %314, null
  br i1 %315, label %316, label %349

316:                                              ; preds = %299
  store i32 0, ptr %43, align 4, !tbaa !9
  br label %317

317:                                              ; preds = %345, %316
  %318 = load i32, ptr %43, align 4, !tbaa !9
  %319 = load i32, ptr %41, align 4, !tbaa !9
  %320 = icmp slt i32 %318, %319
  br i1 %320, label %321, label %348

321:                                              ; preds = %317
  %322 = load i32, ptr %52, align 4, !tbaa !9
  %323 = load ptr, ptr %36, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.image_int_s, ptr %323, i32 0, i32 0
  %325 = load ptr, ptr %324, align 8, !tbaa !31
  %326 = load ptr, ptr %40, align 8, !tbaa !5
  %327 = load i32, ptr %43, align 4, !tbaa !9
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds %struct.point, ptr %326, i64 %328
  %330 = getelementptr inbounds %struct.point, ptr %329, i32 0, i32 0
  %331 = load i32, ptr %330, align 4, !tbaa !33
  %332 = load ptr, ptr %40, align 8, !tbaa !5
  %333 = load i32, ptr %43, align 4, !tbaa !9
  %334 = sext i32 %333 to i64
  %335 = getelementptr inbounds %struct.point, ptr %332, i64 %334
  %336 = getelementptr inbounds %struct.point, ptr %335, i32 0, i32 1
  %337 = load i32, ptr %336, align 4, !tbaa !35
  %338 = load ptr, ptr %36, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct.image_int_s, ptr %338, i32 0, i32 1
  %340 = load i32, ptr %339, align 8, !tbaa !36
  %341 = mul i32 %337, %340
  %342 = add i32 %331, %341
  %343 = zext i32 %342 to i64
  %344 = getelementptr inbounds i32, ptr %325, i64 %343
  store i32 %322, ptr %344, align 4, !tbaa !9
  br label %345

345:                                              ; preds = %321
  %346 = load i32, ptr %43, align 4, !tbaa !9
  %347 = add nsw i32 %346, 1
  store i32 %347, ptr %43, align 4, !tbaa !9
  br label %317, !llvm.loop !37

348:                                              ; preds = %317
  br label %349

349:                                              ; preds = %348, %299
  br label %350

350:                                              ; preds = %349, %200, %180
  br label %351

351:                                              ; preds = %350, %260, %251, %233
  %352 = load ptr, ptr %37, align 8, !tbaa !5
  %353 = getelementptr inbounds %struct.coorlist, ptr %352, i32 0, i32 2
  %354 = load ptr, ptr %353, align 8, !tbaa !39
  store ptr %354, ptr %37, align 8, !tbaa !5
  br label %177, !llvm.loop !40

355:                                              ; preds = %177
  %356 = load ptr, ptr %29, align 8, !tbaa !5
  call void @free(ptr noundef %356) #4
  %357 = load ptr, ptr %33, align 8, !tbaa !5
  call void @free_image_double(ptr noundef %357)
  %358 = load ptr, ptr %34, align 8, !tbaa !5
  call void @free_image_double(ptr noundef %358)
  %359 = load ptr, ptr %35, align 8, !tbaa !5
  call void @free_image_char(ptr noundef %359)
  %360 = load ptr, ptr %40, align 8, !tbaa !5
  call void @free(ptr noundef %360) #4
  %361 = load ptr, ptr %38, align 8, !tbaa !5
  call void @free(ptr noundef %361) #4
  %362 = load ptr, ptr %26, align 8, !tbaa !5
  %363 = icmp ne ptr %362, null
  br i1 %363, label %364, label %399

364:                                              ; preds = %355
  %365 = load ptr, ptr %27, align 8, !tbaa !5
  %366 = icmp ne ptr %365, null
  br i1 %366, label %367, label %399

367:                                              ; preds = %364
  %368 = load ptr, ptr %28, align 8, !tbaa !5
  %369 = icmp ne ptr %368, null
  br i1 %369, label %370, label %399

370:                                              ; preds = %367
  %371 = load ptr, ptr %36, align 8, !tbaa !5
  %372 = icmp eq ptr %371, null
  br i1 %372, label %373, label %374

373:                                              ; preds = %370
  call void @error(ptr noundef @.str.8)
  br label %374

374:                                              ; preds = %373, %370
  %375 = load ptr, ptr %36, align 8, !tbaa !5
  %376 = getelementptr inbounds %struct.image_int_s, ptr %375, i32 0, i32 0
  %377 = load ptr, ptr %376, align 8, !tbaa !31
  %378 = load ptr, ptr %26, align 8, !tbaa !5
  store ptr %377, ptr %378, align 8, !tbaa !5
  %379 = load ptr, ptr %36, align 8, !tbaa !5
  %380 = getelementptr inbounds %struct.image_int_s, ptr %379, i32 0, i32 1
  %381 = load i32, ptr %380, align 8, !tbaa !36
  %382 = icmp ugt i32 %381, 2147483647
  br i1 %382, label %388, label %383

383:                                              ; preds = %374
  %384 = load ptr, ptr %36, align 8, !tbaa !5
  %385 = getelementptr inbounds %struct.image_int_s, ptr %384, i32 0, i32 1
  %386 = load i32, ptr %385, align 8, !tbaa !36
  %387 = icmp ugt i32 %386, 2147483647
  br i1 %387, label %388, label %389

388:                                              ; preds = %383, %374
  call void @error(ptr noundef @.str.9)
  br label %389

389:                                              ; preds = %388, %383
  %390 = load ptr, ptr %36, align 8, !tbaa !5
  %391 = getelementptr inbounds %struct.image_int_s, ptr %390, i32 0, i32 1
  %392 = load i32, ptr %391, align 8, !tbaa !36
  %393 = load ptr, ptr %27, align 8, !tbaa !5
  store i32 %392, ptr %393, align 4, !tbaa !9
  %394 = load ptr, ptr %36, align 8, !tbaa !5
  %395 = getelementptr inbounds %struct.image_int_s, ptr %394, i32 0, i32 2
  %396 = load i32, ptr %395, align 4, !tbaa !41
  %397 = load ptr, ptr %28, align 8, !tbaa !5
  store i32 %396, ptr %397, align 4, !tbaa !9
  %398 = load ptr, ptr %36, align 8, !tbaa !5
  call void @free(ptr noundef %398) #4
  br label %399

399:                                              ; preds = %389, %367, %364, %355
  %400 = load ptr, ptr %30, align 8, !tbaa !5
  %401 = getelementptr inbounds %struct.ntuple_list_s, ptr %400, i32 0, i32 0
  %402 = load i32, ptr %401, align 8, !tbaa !42
  %403 = icmp ugt i32 %402, 2147483647
  br i1 %403, label %404, label %405

404:                                              ; preds = %399
  call void @error(ptr noundef @.str.10)
  br label %405

405:                                              ; preds = %404, %399
  %406 = load ptr, ptr %30, align 8, !tbaa !5
  %407 = getelementptr inbounds %struct.ntuple_list_s, ptr %406, i32 0, i32 0
  %408 = load i32, ptr %407, align 8, !tbaa !42
  %409 = load ptr, ptr %15, align 8, !tbaa !5
  store i32 %408, ptr %409, align 4, !tbaa !9
  %410 = load ptr, ptr %30, align 8, !tbaa !5
  %411 = getelementptr inbounds %struct.ntuple_list_s, ptr %410, i32 0, i32 3
  %412 = load ptr, ptr %411, align 8, !tbaa !44
  store ptr %412, ptr %31, align 8, !tbaa !5
  %413 = load ptr, ptr %30, align 8, !tbaa !5
  call void @free(ptr noundef %413) #4
  %414 = load ptr, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %52) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %51) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %50) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %48) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %47) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %46) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %45) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %44) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %43) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %40) #4
  call void @llvm.lifetime.end.p0(i64 96, ptr %39) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #4
  ret ptr %414
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @new_ntuple_list(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @error(ptr noundef) #0

; Function Attrs: nounwind
declare double @sin(double noundef) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @new_image_double_ptr(i32 noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @gaussian_sampler(ptr noundef, double noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @ll_angle(ptr noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @free_image_double(ptr noundef) #0

; Function Attrs: nounwind
declare double @log10(double noundef) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @new_image_int_ini(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @new_image_char_ini(i32 noundef, i32 noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @region_grow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @region2rect(ptr noundef, i32 noundef, ptr noundef, double noundef, double noundef, double noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @refine(ptr noundef, ptr noundef, ptr noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare hidden double @rect_improve(ptr noundef, ptr noundef, double noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @add_7tuple(ptr noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @free_image_char(ptr noundef) #0

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"image_double_s", !6, i64 0, !10, i64 8, !10, i64 12}
!15 = !{!14, !10, i64 12}
!16 = !{!17, !6, i64 0}
!17 = !{!"image_char_s", !6, i64 0, !10, i64 8, !10, i64 12}
!18 = !{!19, !10, i64 0}
!19 = !{!"coorlist", !10, i64 0, !10, i64 4, !6, i64 8}
!20 = !{!19, !10, i64 4}
!21 = !{!17, !10, i64 8}
!22 = !{!7, !7, i64 0}
!23 = !{!14, !6, i64 0}
!24 = !{!25, !12, i64 0}
!25 = !{!"rect", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88}
!26 = !{!25, !12, i64 8}
!27 = !{!25, !12, i64 16}
!28 = !{!25, !12, i64 24}
!29 = !{!25, !12, i64 32}
!30 = !{!25, !12, i64 88}
!31 = !{!32, !6, i64 0}
!32 = !{!"image_int_s", !6, i64 0, !10, i64 8, !10, i64 12}
!33 = !{!34, !10, i64 0}
!34 = !{!"point", !10, i64 0, !10, i64 4}
!35 = !{!34, !10, i64 4}
!36 = !{!32, !10, i64 8}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!19, !6, i64 8}
!40 = distinct !{!40, !38}
!41 = !{!32, !10, i64 12}
!42 = !{!43, !10, i64 0}
!43 = !{!"ntuple_list_s", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!44 = !{!43, !6, i64 16}


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

%struct.rect = type { double, double, double, double, double, double, double, double, double, double, double, double }
%struct.point = type { i32, i32 }

@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @LineSegmentDetection(ptr nocapture noundef writeonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7, double noundef %8, double noundef %9, i32 noundef %10, ptr noundef writeonly %11, ptr noundef writeonly %12, ptr noundef writeonly %13) local_unnamed_addr #0 {
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %struct.rect, align 16
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = tail call ptr @new_ntuple_list(i32 noundef 7)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %18) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %19) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #5
  %22 = icmp eq ptr %1, null
  %23 = icmp slt i32 %2, 1
  %or.cond = or i1 %22, %23
  %24 = icmp slt i32 %3, 1
  %or.cond3 = or i1 %or.cond, %24
  br i1 %or.cond3, label %25, label %26

25:                                               ; preds = %14
  tail call void @error(ptr noundef nonnull @.str)
  br label %26

26:                                               ; preds = %14, %25
  %27 = fcmp ugt double %4, 0.000000e+00
  br i1 %27, label %29, label %28

28:                                               ; preds = %26
  tail call void @error(ptr noundef nonnull @.str.1)
  br label %29

29:                                               ; preds = %28, %26
  %30 = fcmp ugt double %5, 0.000000e+00
  br i1 %30, label %32, label %31

31:                                               ; preds = %29
  tail call void @error(ptr noundef nonnull @.str.2)
  br label %32

32:                                               ; preds = %31, %29
  %33 = fcmp olt double %6, 0.000000e+00
  br i1 %33, label %34, label %35

34:                                               ; preds = %32
  tail call void @error(ptr noundef nonnull @.str.3)
  br label %35

35:                                               ; preds = %34, %32
  %36 = fcmp ole double %7, 0.000000e+00
  %37 = fcmp oge double %7, 1.800000e+02
  %or.cond5 = or i1 %36, %37
  br i1 %or.cond5, label %38, label %39

38:                                               ; preds = %35
  tail call void @error(ptr noundef nonnull @.str.4)
  br label %39

39:                                               ; preds = %35, %38
  %40 = fcmp olt double %9, 0.000000e+00
  %41 = fcmp ogt double %9, 1.000000e+00
  %or.cond7 = or i1 %40, %41
  br i1 %or.cond7, label %42, label %43

42:                                               ; preds = %39
  tail call void @error(ptr noundef nonnull @.str.5)
  br label %43

43:                                               ; preds = %39, %42
  %44 = icmp slt i32 %10, 1
  br i1 %44, label %45, label %46

45:                                               ; preds = %43
  tail call void @error(ptr noundef nonnull @.str.6)
  br label %46

46:                                               ; preds = %45, %43
  %47 = fmul double %7, 0x400921FB54442D18
  %48 = fdiv double %47, 1.800000e+02
  %49 = fdiv double %7, 1.800000e+02
  %50 = tail call double @sin(double noundef %48) #5
  %51 = fdiv double %6, %50
  %52 = tail call ptr @new_image_double_ptr(i32 noundef %2, i32 noundef %3, ptr noundef %1)
  %53 = fcmp une double %4, 1.000000e+00
  br i1 %53, label %54, label %57

54:                                               ; preds = %46
  %55 = tail call ptr @gaussian_sampler(ptr noundef %52, double noundef %4, double noundef %5)
  %56 = call ptr @ll_angle(ptr noundef %55, double noundef %51, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %15, i32 noundef %10)
  call void @free_image_double(ptr noundef %55)
  br label %59

57:                                               ; preds = %46
  %58 = call ptr @ll_angle(ptr noundef %52, double noundef %51, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %15, i32 noundef %10)
  br label %59

59:                                               ; preds = %57, %54
  %.0124 = phi ptr [ %56, %54 ], [ %58, %57 ]
  %60 = getelementptr inbounds i8, ptr %.0124, i64 8
  %61 = load i32, ptr %60, align 8, !tbaa !5
  %62 = getelementptr inbounds i8, ptr %.0124, i64 12
  %63 = load i32, ptr %62, align 4, !tbaa !11
  %64 = uitofp i32 %61 to double
  %65 = call double @log10(double noundef %64) #5
  %66 = uitofp i32 %63 to double
  %67 = call double @log10(double noundef %66) #5
  %68 = fadd double %65, %67
  %69 = fmul double %68, 5.000000e+00
  %70 = fmul double %69, 5.000000e-01
  %71 = fadd double %70, 0x3FF0A98B6050C56E
  %72 = fneg double %71
  %73 = call double @log10(double noundef %49) #5
  %74 = fdiv double %72, %73
  %75 = fptosi double %74 to i32
  %76 = icmp ne ptr %11, null
  %77 = icmp ne ptr %12, null
  %or.cond9 = and i1 %76, %77
  %78 = icmp ne ptr %13, null
  %or.cond11 = and i1 %or.cond9, %78
  br i1 %or.cond11, label %79, label %83

79:                                               ; preds = %59
  %80 = load i32, ptr %60, align 8, !tbaa !5
  %81 = load i32, ptr %62, align 4, !tbaa !11
  %82 = call ptr @new_image_int_ini(i32 noundef %80, i32 noundef %81, i32 noundef 0)
  br label %83

83:                                               ; preds = %79, %59
  %.0125 = phi ptr [ %82, %79 ], [ null, %59 ]
  %84 = call ptr @new_image_char_ini(i32 noundef %61, i32 noundef %63, i8 noundef zeroext 0)
  %85 = mul i32 %63, %61
  %86 = zext i32 %85 to i64
  %87 = call noalias ptr @calloc(i64 noundef %86, i64 noundef 8) #6
  %88 = icmp eq ptr %87, null
  br i1 %88, label %89, label %90

89:                                               ; preds = %83
  call void @error(ptr noundef nonnull @.str.7)
  br label %90

90:                                               ; preds = %89, %83
  %.pr = load ptr, ptr %16, align 8, !tbaa !12
  %.not138 = icmp eq ptr %.pr, null
  br i1 %.not138, label %._crit_edge, label %.lr.ph140

.lr.ph140:                                        ; preds = %90
  %91 = getelementptr inbounds i8, ptr %84, i64 8
  %92 = getelementptr inbounds i8, ptr %18, i64 16
  %93 = getelementptr inbounds i8, ptr %18, i64 32
  %94 = getelementptr inbounds i8, ptr %18, i64 88
  %.not136 = icmp ne ptr %.0125, null
  %95 = getelementptr inbounds i8, ptr %.0125, i64 8
  %96 = insertelement <4 x double> poison, double %4, i64 0
  %97 = shufflevector <4 x double> %96, <4 x double> poison, <4 x i32> zeroinitializer
  br label %98

98:                                               ; preds = %.lr.ph140, %.loopexit
  %.0139 = phi i32 [ 0, %.lr.ph140 ], [ %.1, %.loopexit ]
  %99 = phi ptr [ %.pr, %.lr.ph140 ], [ %169, %.loopexit ]
  %100 = load ptr, ptr %84, align 8, !tbaa !13
  %101 = load i32, ptr %99, align 8, !tbaa !15
  %102 = getelementptr inbounds i8, ptr %99, i64 4
  %103 = load i32, ptr %102, align 4, !tbaa !17
  %104 = load i32, ptr %91, align 8, !tbaa !18
  %105 = mul i32 %104, %103
  %106 = add i32 %105, %101
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds i8, ptr %100, i64 %107
  %109 = load i8, ptr %108, align 1, !tbaa !19
  %110 = icmp eq i8 %109, 0
  br i1 %110, label %111, label %.loopexit

111:                                              ; preds = %98
  %112 = load ptr, ptr %.0124, align 8, !tbaa !20
  %113 = load i32, ptr %60, align 8, !tbaa !5
  %114 = mul i32 %113, %103
  %115 = add i32 %114, %101
  %116 = zext i32 %115 to i64
  %117 = getelementptr inbounds double, ptr %112, i64 %116
  %118 = load double, ptr %117, align 8, !tbaa !21
  %119 = fcmp une double %118, -1.024000e+03
  br i1 %119, label %120, label %.loopexit

120:                                              ; preds = %111
  call void @region_grow(i32 noundef %101, i32 noundef %103, ptr noundef nonnull %.0124, ptr noundef %87, ptr noundef nonnull %19, ptr noundef nonnull %20, ptr noundef nonnull %84, double noundef %48)
  %121 = load i32, ptr %19, align 4, !tbaa !23
  %122 = icmp slt i32 %121, %75
  br i1 %122, label %.loopexit, label %123

123:                                              ; preds = %120
  %124 = load ptr, ptr %15, align 8, !tbaa !12
  %125 = load double, ptr %20, align 8, !tbaa !21
  call void @region2rect(ptr noundef %87, i32 noundef %121, ptr noundef %124, double noundef %125, double noundef %48, double noundef %49, ptr noundef nonnull %18)
  %126 = load ptr, ptr %15, align 8, !tbaa !12
  %127 = load double, ptr %20, align 8, !tbaa !21
  %128 = call i32 @refine(ptr noundef %87, ptr noundef nonnull %19, ptr noundef %126, double noundef %127, double noundef %48, double noundef %49, ptr noundef nonnull %18, ptr noundef nonnull %84, ptr noundef nonnull %.0124, double noundef %9)
  %.not135 = icmp eq i32 %128, 0
  br i1 %.not135, label %.loopexit, label %129

129:                                              ; preds = %123
  %130 = call double @rect_improve(ptr noundef nonnull %18, ptr noundef nonnull %.0124, double noundef %71, double noundef %8)
  %131 = fcmp ugt double %130, %8
  br i1 %131, label %132, label %.loopexit

132:                                              ; preds = %129
  %133 = add nsw i32 %.0139, 1
  %134 = load <4 x double>, ptr %18, align 16, !tbaa !21
  %135 = fadd <4 x double> %134, <double 5.000000e-01, double 5.000000e-01, double 5.000000e-01, double 5.000000e-01>
  %136 = shufflevector <4 x double> %135, <4 x double> poison, <2 x i32> <i32 0, i32 1>
  store <2 x double> %136, ptr %18, align 16, !tbaa !21
  %137 = shufflevector <4 x double> %135, <4 x double> poison, <2 x i32> <i32 2, i32 3>
  store <2 x double> %137, ptr %92, align 16, !tbaa !21
  %.pre = load double, ptr %93, align 16, !tbaa !24
  br i1 %53, label %138, label %143

138:                                              ; preds = %132
  %139 = fdiv <4 x double> %135, %97
  %140 = shufflevector <4 x double> %139, <4 x double> poison, <2 x i32> <i32 0, i32 1>
  store <2 x double> %140, ptr %18, align 16, !tbaa !21
  %141 = shufflevector <4 x double> %139, <4 x double> poison, <2 x i32> <i32 2, i32 3>
  store <2 x double> %141, ptr %92, align 16, !tbaa !21
  %142 = fdiv double %.pre, %4
  store double %142, ptr %93, align 16, !tbaa !24
  br label %143

143:                                              ; preds = %138, %132
  %144 = phi double [ %142, %138 ], [ %.pre, %132 ]
  %145 = phi <4 x double> [ %139, %138 ], [ %135, %132 ]
  %146 = load double, ptr %94, align 8, !tbaa !26
  %147 = extractelement <4 x double> %145, i64 0
  %148 = extractelement <4 x double> %145, i64 1
  %149 = extractelement <4 x double> %145, i64 2
  %150 = extractelement <4 x double> %145, i64 3
  call void @add_7tuple(ptr noundef %21, double noundef %147, double noundef %148, double noundef %149, double noundef %150, double noundef %144, double noundef %146, double noundef %130)
  %151 = load i32, ptr %19, align 4
  %152 = icmp sgt i32 %151, 0
  %or.cond142 = select i1 %.not136, i1 %152, i1 false
  br i1 %or.cond142, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %143
  %153 = load ptr, ptr %.0125, align 8, !tbaa !27
  br label %154

154:                                              ; preds = %.lr.ph, %154
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %154 ]
  %155 = getelementptr inbounds %struct.point, ptr %87, i64 %indvars.iv
  %156 = load i32, ptr %155, align 4, !tbaa !29
  %157 = getelementptr inbounds i8, ptr %155, i64 4
  %158 = load i32, ptr %157, align 4, !tbaa !31
  %159 = load i32, ptr %95, align 8, !tbaa !32
  %160 = mul i32 %159, %158
  %161 = add i32 %160, %156
  %162 = zext i32 %161 to i64
  %163 = getelementptr inbounds i32, ptr %153, i64 %162
  store i32 %133, ptr %163, align 4, !tbaa !23
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %164 = load i32, ptr %19, align 4, !tbaa !23
  %165 = sext i32 %164 to i64
  %166 = icmp slt i64 %indvars.iv.next, %165
  br i1 %166, label %154, label %.loopexit, !llvm.loop !33

.loopexit:                                        ; preds = %154, %98, %111, %143, %129, %123, %120
  %.1 = phi i32 [ %.0139, %120 ], [ %.0139, %129 ], [ %133, %143 ], [ %.0139, %123 ], [ %.0139, %111 ], [ %.0139, %98 ], [ %133, %154 ]
  %167 = load ptr, ptr %16, align 8, !tbaa !12
  %168 = getelementptr inbounds i8, ptr %167, i64 8
  %169 = load ptr, ptr %168, align 8, !tbaa !35
  store ptr %169, ptr %16, align 8, !tbaa !12
  %.not = icmp eq ptr %169, null
  br i1 %.not, label %._crit_edge, label %98, !llvm.loop !36

._crit_edge:                                      ; preds = %.loopexit, %90
  call void @free(ptr noundef %52) #5
  call void @free_image_double(ptr noundef %.0124)
  %170 = load ptr, ptr %15, align 8, !tbaa !12
  call void @free_image_double(ptr noundef %170)
  call void @free_image_char(ptr noundef %84)
  call void @free(ptr noundef %87) #5
  %171 = load ptr, ptr %17, align 8, !tbaa !12
  call void @free(ptr noundef %171) #5
  br i1 %or.cond11, label %172, label %185

172:                                              ; preds = %._crit_edge
  %173 = icmp eq ptr %.0125, null
  br i1 %173, label %174, label %175

174:                                              ; preds = %172
  call void @error(ptr noundef nonnull @.str.8)
  br label %175

175:                                              ; preds = %174, %172
  %176 = load ptr, ptr %.0125, align 8, !tbaa !27
  store ptr %176, ptr %11, align 8, !tbaa !12
  %177 = getelementptr inbounds i8, ptr %.0125, i64 8
  %178 = load i32, ptr %177, align 8, !tbaa !32
  %179 = icmp slt i32 %178, 0
  br i1 %179, label %180, label %181

180:                                              ; preds = %175
  call void @error(ptr noundef nonnull @.str.9)
  %.pre144 = load i32, ptr %177, align 8, !tbaa !32
  br label %181

181:                                              ; preds = %175, %180
  %182 = phi i32 [ %178, %175 ], [ %.pre144, %180 ]
  store i32 %182, ptr %12, align 4, !tbaa !23
  %183 = getelementptr inbounds i8, ptr %.0125, i64 12
  %184 = load i32, ptr %183, align 4, !tbaa !37
  store i32 %184, ptr %13, align 4, !tbaa !23
  call void @free(ptr noundef nonnull %.0125) #5
  br label %185

185:                                              ; preds = %181, %._crit_edge
  %186 = load i32, ptr %21, align 8, !tbaa !38
  %187 = icmp slt i32 %186, 0
  br i1 %187, label %188, label %189

188:                                              ; preds = %185
  call void @error(ptr noundef nonnull @.str.10)
  %.pre145 = load i32, ptr %21, align 8, !tbaa !38
  br label %189

189:                                              ; preds = %188, %185
  %190 = phi i32 [ %.pre145, %188 ], [ %186, %185 ]
  store i32 %190, ptr %0, align 4, !tbaa !23
  %191 = getelementptr inbounds i8, ptr %21, i64 16
  %192 = load ptr, ptr %191, align 8, !tbaa !40
  call void @free(ptr noundef nonnull %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %19) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #5
  ret ptr %192
}

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

; Function Attrs: nounwind uwtable
declare hidden ptr @new_ntuple_list(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @error(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @new_image_double_ptr(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @gaussian_sampler(ptr noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @ll_angle(ptr noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @free_image_double(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log10(double noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @new_image_int_ini(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @new_image_char_ini(i32 noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @region_grow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @region2rect(ptr noundef, i32 noundef, ptr noundef, double noundef, double noundef, double noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @refine(ptr noundef, ptr noundef, ptr noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden double @rect_improve(ptr noundef, ptr noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @add_7tuple(ptr noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef, double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @free_image_char(ptr noundef) local_unnamed_addr #0

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

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

!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, !10, i64 8}
!6 = !{!"image_double_s", !7, i64 0, !10, i64 8, !10, i64 12}
!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 12}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"image_char_s", !7, i64 0, !10, i64 8, !10, i64 12}
!15 = !{!16, !10, i64 0}
!16 = !{!"coorlist", !10, i64 0, !10, i64 4, !7, i64 8}
!17 = !{!16, !10, i64 4}
!18 = !{!14, !10, i64 8}
!19 = !{!8, !8, i64 0}
!20 = !{!6, !7, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"double", !8, i64 0}
!23 = !{!10, !10, i64 0}
!24 = !{!25, !22, i64 32}
!25 = !{!"rect", !22, i64 0, !22, i64 8, !22, i64 16, !22, i64 24, !22, i64 32, !22, i64 40, !22, i64 48, !22, i64 56, !22, i64 64, !22, i64 72, !22, i64 80, !22, i64 88}
!26 = !{!25, !22, i64 88}
!27 = !{!28, !7, i64 0}
!28 = !{!"image_int_s", !7, i64 0, !10, i64 8, !10, i64 12}
!29 = !{!30, !10, i64 0}
!30 = !{!"point", !10, i64 0, !10, i64 4}
!31 = !{!30, !10, i64 4}
!32 = !{!28, !10, i64 8}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!16, !7, i64 8}
!36 = distinct !{!36, !34}
!37 = !{!28, !10, i64 12}
!38 = !{!39, !10, i64 0}
!39 = !{!"ntuple_list_s", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16}
!40 = !{!39, !7, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass