; LLVM IR from jingweizhanghuai/Morn :: src/image (morn_image_geometry2)

; 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.MList = type { i32, ptr }
%struct.MObject = type { i32, %union.anon }
%union.anon = type { ptr }
%struct.MChainNode = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [88 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.mEdgeBoundary = external hidden unnamed_addr constant [14 x i8], align 1

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

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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #1

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

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

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

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

declare ptr @mChainCreate(...) #1

declare void @mChainRelease(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @_EdgeBoundary(ptr noundef, ptr noundef, ptr noundef, float noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @mEdgeBoundary(ptr noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca float, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  %24 = zext i1 %23 to i32
  store i32 %24, ptr %7, align 4, !tbaa !9
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %21
  %28 = load i32, ptr %7, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %28, i32 noundef -1, ptr noundef @.str, i32 noundef 715, ptr noundef @__FUNCTION__.mEdgeBoundary, ptr noundef @.str.1)
  br label %29

29:                                               ; preds = %27, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %30

30:                                               ; preds = %29
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = icmp sle i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %33, %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.MList, ptr %35, i32 0, i32 0
  %37 = load i32, ptr %36, align 8, !tbaa !11
  store i32 %37, ptr %8, align 4, !tbaa !9
  %38 = load i32, ptr %8, align 4, !tbaa !9
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %34
  store i32 1, ptr %9, align 4
  br label %252

41:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.MList, ptr %42, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  store ptr %44, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %45 = call ptr (...) @mChainCreate()
  store ptr %45, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = call ptr @mChainNode(ptr noundef %46, ptr noundef null, i32 noundef 4)
  store ptr %47, ptr %12, align 8, !tbaa !5
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.MObject, ptr %49, i32 0, i32 1
  store ptr %48, ptr %50, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = call ptr @mChainNode(ptr noundef %51, ptr noundef null, i32 noundef 4)
  store ptr %52, ptr %13, align 8, !tbaa !5
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = load ptr, ptr %13, align 8, !tbaa !5
  call void @mChainNodeInsert(ptr noundef %53, ptr noundef %54, ptr noundef null)
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = sdiv i32 %55, 2
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.MChainNode, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  store i32 %56, ptr %59, align 4, !tbaa !9
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.MChainNode, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !15
  store i32 %60, ptr %63, align 4, !tbaa !9
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  call void @_EdgeBoundary(ptr noundef %64, ptr noundef %65, ptr noundef %66, float noundef 1.000000e+00)
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MChainNode, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !15
  store i32 0, ptr %69, align 4, !tbaa !9
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_EdgeBoundary(ptr noundef %70, ptr noundef %71, ptr noundef %72, float noundef 1.000000e+00)
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.MObject, ptr %73, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  store ptr %75, ptr %12, align 8, !tbaa !5
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MChainNode, ptr %76, i32 0, i32 2
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = getelementptr inbounds %struct.MChainNode, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !17
  store ptr %80, ptr %13, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %195, %193, %41
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = icmp ne ptr %82, %83
  br i1 %84, label %85, label %196

85:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %86 = load ptr, ptr %12, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.MChainNode, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !15
  %89 = load i32, ptr %88, align 4, !tbaa !9
  store i32 %89, ptr %14, align 4, !tbaa !9
  %90 = load i32, ptr %14, align 4, !tbaa !9
  %91 = icmp sge i32 %90, 0
  br i1 %91, label %92, label %177

92:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.MChainNode, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !15
  %96 = load i32, ptr %95, align 4, !tbaa !9
  store i32 %96, ptr %15, align 4, !tbaa !9
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = icmp slt i32 %97, 0
  br i1 %98, label %99, label %103

99:                                               ; preds = %92
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.MChainNode, ptr %100, i32 0, i32 2
  %102 = load ptr, ptr %101, align 8, !tbaa !17
  store ptr %102, ptr %13, align 8, !tbaa !5
  store i32 4, ptr %9, align 4
  br label %174, !llvm.loop !18

103:                                              ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.MChainNode, ptr %104, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !17
  store ptr %106, ptr %16, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %160, %103
  %108 = load ptr, ptr %16, align 8, !tbaa !5
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = icmp ne ptr %108, %109
  br i1 %110, label %111, label %164

111:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %112 = load ptr, ptr %16, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.MChainNode, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !15
  %115 = load i32, ptr %114, align 4, !tbaa !9
  store i32 %115, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %116 = load i32, ptr %17, align 4, !tbaa !9
  %117 = icmp slt i32 %116, 0
  br i1 %117, label %118, label %121

118:                                              ; preds = %111
  %119 = load i32, ptr %17, align 4, !tbaa !9
  %120 = sub nsw i32 -1, %119
  br label %123

121:                                              ; preds = %111
  %122 = load i32, ptr %17, align 4, !tbaa !9
  br label %123

123:                                              ; preds = %121, %118
  %124 = phi i32 [ %120, %118 ], [ %122, %121 ]
  store i32 %124, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = load i32, ptr %18, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds ptr, ptr %125, i64 %127
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = load i32, ptr %14, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds ptr, ptr %130, i64 %132
  %134 = load ptr, ptr %133, align 8, !tbaa !5
  %135 = load ptr, ptr %10, align 8, !tbaa !5
  %136 = load i32, ptr %15, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds ptr, ptr %135, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !5
  %140 = call float @mPointVerticalDistance(ptr noundef %129, ptr noundef %134, ptr noundef %139, ptr noundef null)
  store float %140, ptr %19, align 4, !tbaa !20
  %141 = load float, ptr %19, align 4, !tbaa !20
  %142 = load i32, ptr %6, align 4, !tbaa !9
  %143 = sitofp i32 %142 to float
  %144 = fcmp ogt float %141, %143
  br i1 %144, label %145, label %146

145:                                              ; preds = %123
  store i32 6, ptr %9, align 4
  br label %157

146:                                              ; preds = %123
  %147 = load i32, ptr %17, align 4, !tbaa !9
  %148 = icmp sgt i32 %147, 0
  br i1 %148, label %149, label %155

149:                                              ; preds = %146
  %150 = load i32, ptr %17, align 4, !tbaa !9
  %151 = sub nsw i32 -1, %150
  %152 = load ptr, ptr %16, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.MChainNode, ptr %152, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !15
  store i32 %151, ptr %154, align 4, !tbaa !9
  br label %155

155:                                              ; preds = %149, %146
  br label %156

156:                                              ; preds = %155
  store i32 0, ptr %9, align 4
  br label %157

157:                                              ; preds = %156, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  %158 = load i32, ptr %9, align 4
  switch i32 %158, label %255 [
    i32 0, label %159
    i32 6, label %164
  ]

159:                                              ; preds = %157
  br label %160

160:                                              ; preds = %159
  %161 = load ptr, ptr %16, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.MChainNode, ptr %161, i32 0, i32 2
  %163 = load ptr, ptr %162, align 8, !tbaa !17
  store ptr %163, ptr %16, align 8, !tbaa !5
  br label %107, !llvm.loop !22

164:                                              ; preds = %157, %107
  %165 = load ptr, ptr %16, align 8, !tbaa !5
  %166 = load ptr, ptr %13, align 8, !tbaa !5
  %167 = icmp eq ptr %165, %166
  br i1 %167, label %168, label %172

168:                                              ; preds = %164
  %169 = load ptr, ptr %13, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.MChainNode, ptr %169, i32 0, i32 2
  %171 = load ptr, ptr %170, align 8, !tbaa !17
  store ptr %171, ptr %13, align 8, !tbaa !5
  store i32 4, ptr %9, align 4
  br label %173, !llvm.loop !18

172:                                              ; preds = %164
  store i32 0, ptr %9, align 4
  br label %173

173:                                              ; preds = %172, %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %174

174:                                              ; preds = %173, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  %175 = load i32, ptr %9, align 4
  switch i32 %175, label %193 [
    i32 0, label %176
  ]

176:                                              ; preds = %174
  br label %177

177:                                              ; preds = %176, %85
  %178 = load ptr, ptr %12, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.MChainNode, ptr %178, i32 0, i32 2
  %180 = load ptr, ptr %179, align 8, !tbaa !17
  store ptr %180, ptr %12, align 8, !tbaa !5
  %181 = load ptr, ptr %12, align 8, !tbaa !5
  %182 = load ptr, ptr %11, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.MObject, ptr %182, i32 0, i32 1
  %184 = load ptr, ptr %183, align 8, !tbaa !14
  %185 = icmp eq ptr %181, %184
  br i1 %185, label %186, label %187

186:                                              ; preds = %177
  store i32 5, ptr %9, align 4
  br label %193

187:                                              ; preds = %177
  %188 = load ptr, ptr %12, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.MChainNode, ptr %188, i32 0, i32 2
  %190 = load ptr, ptr %189, align 8, !tbaa !17
  %191 = getelementptr inbounds %struct.MChainNode, ptr %190, i32 0, i32 2
  %192 = load ptr, ptr %191, align 8, !tbaa !17
  store ptr %192, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %193

193:                                              ; preds = %187, %186, %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %194 = load i32, ptr %9, align 4
  switch i32 %194, label %255 [
    i32 0, label %195
    i32 4, label %81
    i32 5, label %196
  ]

195:                                              ; preds = %193
  br label %81, !llvm.loop !18

196:                                              ; preds = %193, %81
  %197 = load ptr, ptr %11, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.MObject, ptr %197, i32 0, i32 1
  %199 = load ptr, ptr %198, align 8, !tbaa !14
  store ptr %199, ptr %12, align 8, !tbaa !5
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  call void @mListClear(ptr noundef %200)
  br label %201

201:                                              ; preds = %230, %196
  br label %202

202:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %203 = load ptr, ptr %12, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.MChainNode, ptr %203, i32 0, i32 0
  %205 = load ptr, ptr %204, align 8, !tbaa !15
  %206 = load i32, ptr %205, align 4, !tbaa !9
  store i32 %206, ptr %20, align 4, !tbaa !9
  %207 = load i32, ptr %20, align 4, !tbaa !9
  %208 = icmp sge i32 %207, 0
  br i1 %208, label %209, label %217

209:                                              ; preds = %202
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = load ptr, ptr %10, align 8, !tbaa !5
  %212 = load i32, ptr %20, align 4, !tbaa !9
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds ptr, ptr %211, i64 %213
  %215 = load ptr, ptr %214, align 8, !tbaa !5
  %216 = call ptr @mListWrite(ptr noundef %210, i32 noundef -1, ptr noundef %215, i32 noundef 8)
  br label %217

217:                                              ; preds = %209, %202
  %218 = load ptr, ptr %12, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.MChainNode, ptr %218, i32 0, i32 2
  %220 = load ptr, ptr %219, align 8, !tbaa !17
  store ptr %220, ptr %12, align 8, !tbaa !5
  %221 = load ptr, ptr %12, align 8, !tbaa !5
  %222 = load ptr, ptr %11, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.MObject, ptr %222, i32 0, i32 1
  %224 = load ptr, ptr %223, align 8, !tbaa !14
  %225 = icmp eq ptr %221, %224
  br i1 %225, label %226, label %227

226:                                              ; preds = %217
  store i32 10, ptr %9, align 4
  br label %228

227:                                              ; preds = %217
  store i32 0, ptr %9, align 4
  br label %228

228:                                              ; preds = %227, %226
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  %229 = load i32, ptr %9, align 4
  switch i32 %229, label %255 [
    i32 0, label %230
    i32 10, label %231
  ]

230:                                              ; preds = %228
  br label %201

231:                                              ; preds = %228
  %232 = load ptr, ptr %5, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.MList, ptr %232, i32 0, i32 0
  %234 = load i32, ptr %233, align 8, !tbaa !11
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %236, label %250

236:                                              ; preds = %231
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  %238 = load ptr, ptr %5, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.MList, ptr %238, i32 0, i32 1
  %240 = load ptr, ptr %239, align 8, !tbaa !13
  %241 = getelementptr inbounds ptr, ptr %240, i64 0
  %242 = load ptr, ptr %241, align 8, !tbaa !5
  %243 = call ptr @mListWrite(ptr noundef %237, i32 noundef -1, ptr noundef %242, i32 noundef 8)
  %244 = load ptr, ptr %5, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.MList, ptr %244, i32 0, i32 0
  %246 = load i32, ptr %245, align 8, !tbaa !11
  %247 = sub nsw i32 %246, 1
  %248 = load ptr, ptr %5, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.MList, ptr %248, i32 0, i32 0
  store i32 %247, ptr %249, align 8, !tbaa !11
  br label %250

250:                                              ; preds = %236, %231
  %251 = load ptr, ptr %11, align 8, !tbaa !5
  call void @mChainRelease(ptr noundef %251)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  store i32 0, ptr %9, align 4
  br label %252

252:                                              ; preds = %250, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %253 = load i32, ptr %9, align 4
  switch i32 %253, label %255 [
    i32 0, label %254
    i32 1, label %254
  ]

254:                                              ; preds = %252, %252
  ret void

255:                                              ; preds = %252, %228, %193, %157
  unreachable
}

declare void @mListClear(ptr 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 }

!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, !10, i64 0}
!12 = !{!"MList", !10, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"MChainNode", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!16, !6, i64 16}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !21, i64 0}
!21 = !{!"float", !7, i64 0}
!22 = distinct !{!22, !19}


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

@.str = external hidden unnamed_addr constant [88 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.mEdgeBoundary = external hidden unnamed_addr constant [14 x i8], align 1

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

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

declare ptr @mListWrite(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

declare ptr @mChainNode(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

declare void @mChainNodeInsert(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @mChainCreate(...) local_unnamed_addr #0

declare void @mChainRelease(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @mEdgeBoundary(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = icmp eq ptr %0, null
  br i1 %4, label %5, label %6

5:                                                ; preds = %3
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 715, ptr noundef nonnull @__FUNCTION__.mEdgeBoundary, ptr noundef nonnull @.str.1) #3
  br label %6

6:                                                ; preds = %5, %3
  %spec.store.select = tail call i32 @llvm.smax.i32(i32 %2, i32 1)
  %7 = load i32, ptr %0, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %88, label %9

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = tail call ptr (...) @mChainCreate() #3
  %13 = tail call ptr @mChainNode(ptr noundef %12, ptr noundef null, i32 noundef 4) #3
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  store ptr %13, ptr %14, align 8, !tbaa !12
  %15 = tail call ptr @mChainNode(ptr noundef %12, ptr noundef null, i32 noundef 4) #3
  tail call void @mChainNodeInsert(ptr noundef %13, ptr noundef %15, ptr noundef null) #3
  %16 = sdiv i32 %7, 2
  %17 = load ptr, ptr %15, align 8, !tbaa !13
  store i32 %16, ptr %17, align 4, !tbaa !15
  %18 = load ptr, ptr %13, align 8, !tbaa !13
  store i32 %7, ptr %18, align 4, !tbaa !15
  tail call void @_EdgeBoundary(ptr noundef nonnull %0, ptr noundef %12, ptr noundef nonnull %15, float noundef 1.000000e+00)
  %19 = load ptr, ptr %13, align 8, !tbaa !13
  store i32 0, ptr %19, align 4, !tbaa !15
  tail call void @_EdgeBoundary(ptr noundef nonnull %0, ptr noundef %12, ptr noundef nonnull %13, float noundef 1.000000e+00)
  %20 = load ptr, ptr %14, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  %22 = load ptr, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %.081114 = load ptr, ptr %23, align 8, !tbaa !16
  %.not115 = icmp eq ptr %20, %.081114
  br i1 %.not115, label %.thread104, label %.lr.ph119

.lr.ph119:                                        ; preds = %9
  %24 = uitofp nneg i32 %spec.store.select to float
  br label %25

25:                                               ; preds = %.lr.ph119, %.thread100
  %.081117 = phi ptr [ %.081114, %.lr.ph119 ], [ %.081, %.thread100 ]
  %.078116 = phi ptr [ %20, %.lr.ph119 ], [ %.179, %.thread100 ]
  %26 = load ptr, ptr %.078116, align 8, !tbaa !13
  %27 = load i32, ptr %26, align 4, !tbaa !15
  %28 = icmp sgt i32 %27, -1
  br i1 %28, label %29, label %.loopexit

29:                                               ; preds = %25
  %30 = load ptr, ptr %.081117, align 8, !tbaa !13
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = icmp slt i32 %31, 0
  br i1 %32, label %.thread100, label %.preheader, !llvm.loop !17

.preheader:                                       ; preds = %29
  %.086.in110 = getelementptr inbounds i8, ptr %.078116, i64 16
  %.086111 = load ptr, ptr %.086.in110, align 8, !tbaa !16
  %.not93112 = icmp eq ptr %.086111, %.081117
  br i1 %.not93112, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %33 = zext nneg i32 %27 to i64
  %34 = getelementptr inbounds ptr, ptr %11, i64 %33
  %35 = zext nneg i32 %31 to i64
  %36 = getelementptr inbounds ptr, ptr %11, i64 %35
  br label %37

37:                                               ; preds = %.lr.ph, %54
  %.086113 = phi ptr [ %.086111, %.lr.ph ], [ %.086, %54 ]
  %38 = load ptr, ptr %.086113, align 8, !tbaa !13
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = icmp slt i32 %39, 0
  %41 = xor i32 %39, -1
  %42 = select i1 %40, i32 %41, i32 %39
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds ptr, ptr %11, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !19
  %46 = load ptr, ptr %34, align 8, !tbaa !19
  %47 = load ptr, ptr %36, align 8, !tbaa !19
  %48 = tail call float @mPointVerticalDistance(ptr noundef %45, ptr noundef %46, ptr noundef %47, ptr noundef null)
  %49 = fcmp ogt float %48, %24
  br i1 %49, label %.loopexit, label %50

50:                                               ; preds = %37
  %51 = icmp sgt i32 %39, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %50
  %53 = load ptr, ptr %.086113, align 8, !tbaa !13
  store i32 %41, ptr %53, align 4, !tbaa !15
  br label %54

54:                                               ; preds = %52, %50
  %.086.in = getelementptr inbounds i8, ptr %.086113, i64 16
  %.086 = load ptr, ptr %.086.in, align 8, !tbaa !16
  %.not93 = icmp eq ptr %.086, %.081117
  br i1 %.not93, label %._crit_edge, label %37, !llvm.loop !20

._crit_edge:                                      ; preds = %54, %.preheader
  br label %.thread100, !llvm.loop !17

.loopexit:                                        ; preds = %37, %25
  %55 = getelementptr inbounds i8, ptr %.078116, i64 16
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = load ptr, ptr %14, align 8, !tbaa !12
  %58 = icmp eq ptr %56, %57
  br i1 %58, label %.thread104, label %59

59:                                               ; preds = %.loopexit
  %60 = getelementptr inbounds i8, ptr %56, i64 16
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  br label %.thread100

.thread100:                                       ; preds = %29, %._crit_edge, %59
  %.081117.sink = phi ptr [ %.081117, %._crit_edge ], [ %61, %59 ], [ %.081117, %29 ]
  %.179 = phi ptr [ %.078116, %._crit_edge ], [ %56, %59 ], [ %.078116, %29 ]
  %62 = getelementptr inbounds i8, ptr %.081117.sink, i64 16
  %.081 = load ptr, ptr %62, align 8, !tbaa !16
  %.not = icmp eq ptr %.179, %.081
  br i1 %.not, label %.thread100..thread104.loopexit_crit_edge, label %25

.thread100..thread104.loopexit_crit_edge:         ; preds = %.thread100
  %.pre.pre = load ptr, ptr %14, align 8, !tbaa !12
  br label %.thread104

.thread104:                                       ; preds = %.loopexit, %.thread100..thread104.loopexit_crit_edge, %9
  %63 = phi ptr [ %20, %9 ], [ %.pre.pre, %.thread100..thread104.loopexit_crit_edge ], [ %57, %.loopexit ]
  tail call void @mListClear(ptr noundef %1) #3
  br label %64

64:                                               ; preds = %73, %.thread104
  %.280 = phi ptr [ %63, %.thread104 ], [ %75, %73 ]
  %65 = load ptr, ptr %.280, align 8, !tbaa !13
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = icmp sgt i32 %66, -1
  br i1 %67, label %68, label %73

68:                                               ; preds = %64
  %69 = zext nneg i32 %66 to i64
  %70 = getelementptr inbounds ptr, ptr %11, i64 %69
  %71 = load ptr, ptr %70, align 8, !tbaa !19
  %72 = tail call ptr @mListWrite(ptr noundef %1, i32 noundef -1, ptr noundef %71, i32 noundef 8) #3
  br label %73

73:                                               ; preds = %68, %64
  %74 = getelementptr inbounds i8, ptr %.280, i64 16
  %75 = load ptr, ptr %74, align 8, !tbaa !16
  %76 = load ptr, ptr %14, align 8, !tbaa !12
  %77 = icmp eq ptr %75, %76
  br i1 %77, label %78, label %64

78:                                               ; preds = %73
  %79 = load i32, ptr %1, align 8, !tbaa !5
  %.not94 = icmp eq i32 %79, 0
  br i1 %.not94, label %87, label %80

80:                                               ; preds = %78
  %81 = getelementptr inbounds i8, ptr %1, i64 8
  %82 = load ptr, ptr %81, align 8, !tbaa !11
  %83 = load ptr, ptr %82, align 8, !tbaa !19
  %84 = tail call ptr @mListWrite(ptr noundef nonnull %1, i32 noundef -1, ptr noundef %83, i32 noundef 8) #3
  %85 = load i32, ptr %1, align 8, !tbaa !5
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr %1, align 8, !tbaa !5
  br label %87

87:                                               ; preds = %80, %78
  tail call void @mChainRelease(ptr noundef nonnull %12) #3
  br label %88

88:                                               ; preds = %6, %87
  ret void
}

declare void @mListClear(ptr noundef) local_unnamed_addr #0

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"MList", !7, i64 0, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"MChainNode", !10, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!7, !7, i64 0}
!16 = !{!14, !10, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!10, !10, i64 0}
!20 = distinct !{!20, !18}


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