; LLVM IR from ljm941004/HYPERCV_PUBLIC :: modules/process/src/c_src (gradient)

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

@.str = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [26 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @hypercv_border_Interpolate(i32 noundef, i32 noundef, i32 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @hypercv_sobel(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #5 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca [3 x [3 x i32]], align 16
  %15 = alloca [3 x [3 x i32]], align 16
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !11
  %31 = icmp eq i32 %27, %30
  br i1 %31, label %32, label %41

32:                                               ; preds = %4
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %33, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !13
  %39 = icmp eq i32 %35, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %32
  br label %45

41:                                               ; preds = %32, %4
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @exit(i32 noundef 1) #7
  unreachable

45:                                               ; preds = %40
  %46 = load i32, ptr %8, align 4, !tbaa !9
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %60, label %48

48:                                               ; preds = %45
  %49 = load i32, ptr %8, align 4, !tbaa !9
  %50 = icmp eq i32 %49, 4
  br i1 %50, label %60, label %51

51:                                               ; preds = %48
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %60, label %54

54:                                               ; preds = %51
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = icmp eq i32 %55, 3
  br i1 %56, label %60, label %57

57:                                               ; preds = %54
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %57, %54, %51, %48, %45
  br label %65

61:                                               ; preds = %57
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @exit(i32 noundef 1) #7
  unreachable

65:                                               ; preds = %60
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %66, i32 0, i32 3
  %68 = load i32, ptr %67, align 4, !tbaa !14
  %69 = icmp eq i32 %68, 1
  br i1 %69, label %70, label %71

70:                                               ; preds = %65
  br label %75

71:                                               ; preds = %65
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @exit(i32 noundef 1) #7
  unreachable

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !11
  store i32 %78, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !13
  store i32 %81, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 36, ptr %14) #8
  call void @llvm.memset.p0.i64(ptr align 16 %14, i8 0, i64 36, i1 false)
  %82 = getelementptr inbounds [3 x [3 x i32]], ptr %14, i32 0, i32 0
  %83 = getelementptr inbounds [3 x i32], ptr %82, i32 0, i32 0
  store i32 -1, ptr %83, align 16
  %84 = getelementptr inbounds [3 x i32], ptr %82, i32 0, i32 2
  store i32 1, ptr %84, align 8
  %85 = getelementptr inbounds [3 x [3 x i32]], ptr %14, i32 0, i32 1
  %86 = getelementptr inbounds [3 x i32], ptr %85, i32 0, i32 0
  store i32 -2, ptr %86, align 4
  %87 = getelementptr inbounds [3 x i32], ptr %85, i32 0, i32 2
  store i32 2, ptr %87, align 4
  %88 = getelementptr inbounds [3 x [3 x i32]], ptr %14, i32 0, i32 2
  %89 = getelementptr inbounds [3 x i32], ptr %88, i32 0, i32 0
  store i32 -1, ptr %89, align 8
  %90 = getelementptr inbounds [3 x i32], ptr %88, i32 0, i32 2
  store i32 1, ptr %90, align 8
  call void @llvm.lifetime.start.p0(i64 36, ptr %15) #8
  call void @llvm.memset.p0.i64(ptr align 16 %15, i8 0, i64 36, i1 false)
  %91 = getelementptr inbounds [3 x [3 x i32]], ptr %15, i32 0, i32 0
  %92 = getelementptr inbounds [3 x i32], ptr %91, i32 0, i32 0
  store i32 1, ptr %92, align 16
  %93 = getelementptr inbounds [3 x i32], ptr %91, i32 0, i32 1
  store i32 2, ptr %93, align 4
  %94 = getelementptr inbounds [3 x i32], ptr %91, i32 0, i32 2
  store i32 1, ptr %94, align 8
  %95 = getelementptr inbounds [3 x [3 x i32]], ptr %15, i32 0, i32 2
  %96 = getelementptr inbounds [3 x i32], ptr %95, i32 0, i32 0
  store i32 -1, ptr %96, align 8
  %97 = getelementptr inbounds [3 x i32], ptr %95, i32 0, i32 1
  store i32 -2, ptr %97, align 4
  %98 = getelementptr inbounds [3 x i32], ptr %95, i32 0, i32 2
  store i32 -1, ptr %98, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %99, i32 0, i32 5
  %101 = load ptr, ptr %100, align 8, !tbaa !15
  store ptr %101, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.SIMPLE_MAT, ptr %102, i32 0, i32 5
  %104 = load ptr, ptr %103, align 8, !tbaa !15
  store ptr %104, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %257, %75
  %106 = load i32, ptr %20, align 4, !tbaa !9
  %107 = load i32, ptr %9, align 4, !tbaa !9
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  store i32 2, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %260

110:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %253, %110
  %112 = load i32, ptr %22, align 4, !tbaa !9
  %113 = load i32, ptr %10, align 4, !tbaa !9
  %114 = icmp slt i32 %112, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %111
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %256

116:                                              ; preds = %111
  store i32 0, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %222, %116
  %118 = load i32, ptr %23, align 4, !tbaa !9
  %119 = icmp slt i32 %118, 3
  br i1 %119, label %121, label %120

120:                                              ; preds = %117
  store i32 8, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %225

121:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %122

122:                                              ; preds = %218, %121
  %123 = load i32, ptr %24, align 4, !tbaa !9
  %124 = icmp slt i32 %123, 3
  br i1 %124, label %126, label %125

125:                                              ; preds = %122
  store i32 11, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %221

126:                                              ; preds = %122
  %127 = load i32, ptr %20, align 4, !tbaa !9
  %128 = load i32, ptr %23, align 4, !tbaa !9
  %129 = add nsw i32 %127, %128
  %130 = sub nsw i32 %129, 1
  %131 = icmp slt i32 %130, 0
  br i1 %131, label %139, label %132

132:                                              ; preds = %126
  %133 = load i32, ptr %20, align 4, !tbaa !9
  %134 = load i32, ptr %23, align 4, !tbaa !9
  %135 = add nsw i32 %133, %134
  %136 = sub nsw i32 %135, 1
  %137 = load i32, ptr %9, align 4, !tbaa !9
  %138 = icmp sge i32 %136, %137
  br i1 %138, label %139, label %147

139:                                              ; preds = %132, %126
  %140 = load i32, ptr %20, align 4, !tbaa !9
  %141 = load i32, ptr %23, align 4, !tbaa !9
  %142 = add nsw i32 %140, %141
  %143 = sub nsw i32 %142, 1
  %144 = load i32, ptr %9, align 4, !tbaa !9
  %145 = load i32, ptr %8, align 4, !tbaa !9
  %146 = call i32 @hypercv_border_Interpolate(i32 noundef %143, i32 noundef %144, i32 noundef %145)
  store i32 %146, ptr %16, align 4, !tbaa !9
  br label %152

147:                                              ; preds = %132
  %148 = load i32, ptr %20, align 4, !tbaa !9
  %149 = load i32, ptr %23, align 4, !tbaa !9
  %150 = add nsw i32 %148, %149
  %151 = sub nsw i32 %150, 1
  store i32 %151, ptr %16, align 4, !tbaa !9
  br label %152

152:                                              ; preds = %147, %139
  %153 = load i32, ptr %22, align 4, !tbaa !9
  %154 = load i32, ptr %24, align 4, !tbaa !9
  %155 = add nsw i32 %153, %154
  %156 = sub nsw i32 %155, 1
  %157 = icmp slt i32 %156, 0
  br i1 %157, label %164, label %158

158:                                              ; preds = %152
  %159 = load i32, ptr %22, align 4, !tbaa !9
  %160 = load i32, ptr %24, align 4, !tbaa !9
  %161 = add nsw i32 %159, %160
  %162 = load i32, ptr %10, align 4, !tbaa !9
  %163 = icmp sgt i32 %161, %162
  br i1 %163, label %164, label %172

164:                                              ; preds = %158, %152
  %165 = load i32, ptr %22, align 4, !tbaa !9
  %166 = load i32, ptr %24, align 4, !tbaa !9
  %167 = add nsw i32 %165, %166
  %168 = sub nsw i32 %167, 1
  %169 = load i32, ptr %10, align 4, !tbaa !9
  %170 = load i32, ptr %8, align 4, !tbaa !9
  %171 = call i32 @hypercv_border_Interpolate(i32 noundef %168, i32 noundef %169, i32 noundef %170)
  store i32 %171, ptr %17, align 4, !tbaa !9
  br label %177

172:                                              ; preds = %158
  %173 = load i32, ptr %22, align 4, !tbaa !9
  %174 = load i32, ptr %24, align 4, !tbaa !9
  %175 = add nsw i32 %173, %174
  %176 = sub nsw i32 %175, 1
  store i32 %176, ptr %17, align 4, !tbaa !9
  br label %177

177:                                              ; preds = %172, %164
  %178 = load i32, ptr %23, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [3 x [3 x i32]], ptr %14, i64 0, i64 %179
  %181 = load i32, ptr %24, align 4, !tbaa !9
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [3 x i32], ptr %180, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !9
  %185 = load ptr, ptr %18, align 8, !tbaa !5
  %186 = load i32, ptr %16, align 4, !tbaa !9
  %187 = load i32, ptr %10, align 4, !tbaa !9
  %188 = mul nsw i32 %186, %187
  %189 = load i32, ptr %17, align 4, !tbaa !9
  %190 = add nsw i32 %188, %189
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds i8, ptr %185, i64 %191
  %193 = load i8, ptr %192, align 1, !tbaa !16
  %194 = zext i8 %193 to i32
  %195 = mul nsw i32 %184, %194
  %196 = load i32, ptr %11, align 4, !tbaa !9
  %197 = add nsw i32 %196, %195
  store i32 %197, ptr %11, align 4, !tbaa !9
  %198 = load i32, ptr %23, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [3 x [3 x i32]], ptr %15, i64 0, i64 %199
  %201 = load i32, ptr %24, align 4, !tbaa !9
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [3 x i32], ptr %200, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !9
  %205 = load ptr, ptr %18, align 8, !tbaa !5
  %206 = load i32, ptr %16, align 4, !tbaa !9
  %207 = load i32, ptr %10, align 4, !tbaa !9
  %208 = mul nsw i32 %206, %207
  %209 = load i32, ptr %17, align 4, !tbaa !9
  %210 = add nsw i32 %208, %209
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds i8, ptr %205, i64 %211
  %213 = load i8, ptr %212, align 1, !tbaa !16
  %214 = zext i8 %213 to i32
  %215 = mul nsw i32 %204, %214
  %216 = load i32, ptr %12, align 4, !tbaa !9
  %217 = add nsw i32 %216, %215
  store i32 %217, ptr %12, align 4, !tbaa !9
  br label %218

218:                                              ; preds = %177
  %219 = load i32, ptr %24, align 4, !tbaa !9
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %24, align 4, !tbaa !9
  br label %122, !llvm.loop !17

221:                                              ; preds = %125
  br label %222

222:                                              ; preds = %221
  %223 = load i32, ptr %23, align 4, !tbaa !9
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %23, align 4, !tbaa !9
  br label %117, !llvm.loop !19

225:                                              ; preds = %120
  %226 = load i32, ptr %11, align 4, !tbaa !9
  %227 = call i32 @llvm.abs.i32(i32 %226, i1 true)
  store i32 %227, ptr %11, align 4, !tbaa !9
  %228 = load i32, ptr %12, align 4, !tbaa !9
  %229 = call i32 @llvm.abs.i32(i32 %228, i1 true)
  store i32 %229, ptr %12, align 4, !tbaa !9
  %230 = load i32, ptr %11, align 4, !tbaa !9
  %231 = load i32, ptr %12, align 4, !tbaa !9
  %232 = icmp sgt i32 %230, %231
  br i1 %232, label %233, label %235

233:                                              ; preds = %225
  %234 = load i32, ptr %11, align 4, !tbaa !9
  br label %237

235:                                              ; preds = %225
  %236 = load i32, ptr %12, align 4, !tbaa !9
  br label %237

237:                                              ; preds = %235, %233
  %238 = phi i32 [ %234, %233 ], [ %236, %235 ]
  store i32 %238, ptr %13, align 4, !tbaa !9
  %239 = load i32, ptr %13, align 4, !tbaa !9
  %240 = load i32, ptr %7, align 4, !tbaa !9
  %241 = icmp sgt i32 %239, %240
  %242 = zext i1 %241 to i64
  %243 = select i1 %241, i32 255, i32 0
  %244 = trunc i32 %243 to i8
  %245 = load ptr, ptr %19, align 8, !tbaa !5
  %246 = load i32, ptr %20, align 4, !tbaa !9
  %247 = load i32, ptr %10, align 4, !tbaa !9
  %248 = mul nsw i32 %246, %247
  %249 = load i32, ptr %22, align 4, !tbaa !9
  %250 = add nsw i32 %248, %249
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds i8, ptr %245, i64 %251
  store i8 %244, ptr %252, align 1, !tbaa !16
  br label %253

253:                                              ; preds = %237
  %254 = load i32, ptr %22, align 4, !tbaa !9
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %22, align 4, !tbaa !9
  br label %111, !llvm.loop !20

256:                                              ; preds = %115
  br label %257

257:                                              ; preds = %256
  %258 = load i32, ptr %20, align 4, !tbaa !9
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %20, align 4, !tbaa !9
  br label %105, !llvm.loop !21

260:                                              ; preds = %109
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 36, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 36, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn nounwind }
attributes #8 = { 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 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24}
!13 = !{!12, !10, i64 4}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !6, i64 24}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}


; 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 [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [26 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @hypercv_border_Interpolate(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local void @hypercv_sobel(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #5 {
  %5 = alloca [3 x [3 x i32]], align 16
  %6 = alloca [3 x [3 x i32]], align 16
  %7 = load i32, ptr %0, align 8, !tbaa !5
  %8 = load i32, ptr %1, align 8, !tbaa !5
  %9 = icmp eq i32 %7, %8
  br i1 %9, label %10, label %16

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = icmp eq i32 %12, %14
  br i1 %15, label %20, label %16

16:                                               ; preds = %10, %4
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  tail call void @exit(i32 noundef 1) #8
  unreachable

20:                                               ; preds = %10
  %or.cond7 = icmp ult i32 %3, 5
  br i1 %or.cond7, label %25, label %21

21:                                               ; preds = %20
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  tail call void @exit(i32 noundef 1) #8
  unreachable

25:                                               ; preds = %20
  %26 = getelementptr inbounds i8, ptr %0, i64 12
  %27 = load i32, ptr %26, align 4, !tbaa !12
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %33, label %29

29:                                               ; preds = %25
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  tail call void @exit(i32 noundef 1) #8
  unreachable

33:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %5) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %5, i8 0, i64 32, i1 false)
  store i32 -1, ptr %5, align 16
  %34 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 1, ptr %34, align 8
  %35 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 -2, ptr %35, align 4
  %36 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 2, ptr %36, align 4
  %37 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 -1, ptr %37, align 8
  %38 = getelementptr inbounds i8, ptr %5, i64 32
  store i32 1, ptr %38, align 16
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %6) #9
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(36) %6, i8 0, i64 32, i1 false)
  store i32 1, ptr %6, align 16
  %39 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 2, ptr %39, align 4
  %40 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 1, ptr %40, align 8
  %41 = getelementptr inbounds i8, ptr %6, i64 24
  store i32 -1, ptr %41, align 8
  %42 = getelementptr inbounds i8, ptr %6, i64 28
  store i32 -2, ptr %42, align 4
  %43 = getelementptr inbounds i8, ptr %6, i64 32
  store i32 -1, ptr %43, align 16
  %44 = getelementptr inbounds i8, ptr %0, i64 24
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = getelementptr inbounds i8, ptr %1, i64 24
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = icmp sgt i32 %7, 0
  %49 = icmp sgt i32 %12, 0
  %or.cond = and i1 %48, %49
  br i1 %or.cond, label %.preheader92.us.preheader, label %._crit_edge102

.preheader92.us.preheader:                        ; preds = %33
  %50 = zext nneg i32 %12 to i64
  %51 = zext nneg i32 %7 to i64
  %52 = zext nneg i32 %12 to i64
  %wide.trip.count127 = zext nneg i32 %7 to i64
  br label %.preheader92.us

.preheader92.us:                                  ; preds = %.preheader92.us.preheader, %._crit_edge.us
  %indvars.iv124 = phi i64 [ 0, %.preheader92.us.preheader ], [ %indvars.iv.next125, %._crit_edge.us ]
  %53 = mul nuw nsw i64 %indvars.iv124, %52
  %invariant.gep = getelementptr inbounds i8, ptr %47, i64 %53
  br label %.preheader91.us

54:                                               ; preds = %.split.us103
  %55 = tail call i32 @llvm.abs.i32(i32 %118, i1 true)
  %56 = tail call i32 @llvm.abs.i32(i32 %122, i1 true)
  %57 = tail call i32 @llvm.umax.i32(i32 %55, i32 %56)
  %58 = icmp sgt i32 %57, %2
  %59 = sext i1 %58 to i8
  %gep = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv120
  store i8 %59, ptr %gep, align 1, !tbaa !14
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %exitcond123.not = icmp eq i64 %indvars.iv.next121, %52
  br i1 %exitcond123.not, label %._crit_edge.us, label %.preheader91.us, !llvm.loop !15

60:                                               ; preds = %.preheader.split.us111
  %61 = tail call i32 @hypercv_border_Interpolate(i32 noundef %107, i32 noundef %12, i32 noundef %3)
  br label %62

62:                                               ; preds = %60, %.preheader.split.us111
  %.084.us110 = phi i32 [ %61, %60 ], [ %107, %.preheader.split.us111 ]
  %63 = getelementptr inbounds [3 x [3 x i32]], ptr %5, i64 0, i64 %indvars.iv, i64 0
  %64 = load i32, ptr %63, align 4, !tbaa !17
  %65 = sext i32 %.084.us110 to i64
  %66 = getelementptr i8, ptr %45, i64 %114
  %67 = getelementptr i8, ptr %66, i64 %65
  %68 = load i8, ptr %67, align 1, !tbaa !14
  %69 = zext i8 %68 to i32
  %70 = mul nsw i32 %64, %69
  %71 = add nsw i32 %70, %.08198.us
  %72 = getelementptr inbounds [3 x [3 x i32]], ptr %6, i64 0, i64 %indvars.iv, i64 0
  %73 = load i32, ptr %72, align 4, !tbaa !17
  %74 = mul nsw i32 %73, %69
  %75 = add nsw i32 %74, %.08297.us
  %76 = getelementptr inbounds [3 x [3 x i32]], ptr %5, i64 0, i64 %indvars.iv, i64 1
  %77 = load i32, ptr %76, align 4, !tbaa !17
  %78 = getelementptr i8, ptr %109, i64 %114
  %79 = load i8, ptr %78, align 1, !tbaa !14
  %80 = zext i8 %79 to i32
  %81 = mul nsw i32 %77, %80
  %82 = add nsw i32 %81, %71
  %83 = getelementptr inbounds [3 x [3 x i32]], ptr %6, i64 0, i64 %indvars.iv, i64 1
  %84 = load i32, ptr %83, align 4, !tbaa !17
  %85 = mul nsw i32 %84, %80
  %86 = add nsw i32 %85, %75
  br i1 %111, label %87, label %.split.us103.loopexit112

87:                                               ; preds = %62
  %88 = tail call i32 @hypercv_border_Interpolate(i32 noundef %113, i32 noundef %12, i32 noundef %3)
  br label %.split.us103.loopexit112

.split.us103.loopexit112:                         ; preds = %87, %62
  %.084.us110.2 = phi i32 [ %88, %87 ], [ %113, %62 ]
  %89 = sext i32 %.084.us110.2 to i64
  %90 = getelementptr i8, ptr %45, i64 %114
  %91 = getelementptr i8, ptr %90, i64 %89
  br label %.split.us103

.preheader.us:                                    ; preds = %.split.us103, %.preheader91.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %.split.us103 ], [ 0, %.preheader91.us ]
  %.08198.us = phi i32 [ %118, %.split.us103 ], [ 0, %.preheader91.us ]
  %.08297.us = phi i32 [ %122, %.split.us103 ], [ 0, %.preheader91.us ]
  %92 = add nuw nsw i64 %indvars.iv, %indvars.iv124
  %93 = add nsw i64 %92, -1
  %94 = add nsw i64 %92, -1
  %or.cond.us.not = icmp ult i64 %94, %51
  br i1 %or.cond.us.not, label %.preheader.split.us111, label %.preheader.split.us.us.preheader

.preheader.split.us.us.preheader:                 ; preds = %.preheader.us
  %95 = trunc nsw i64 %93 to i32
  %96 = tail call i32 @hypercv_border_Interpolate(i32 noundef %95, i32 noundef %7, i32 noundef %3)
  br i1 %97, label %123, label %.preheader.split.us.us.2

.preheader91.us:                                  ; preds = %.preheader92.us, %54
  %indvars.iv120 = phi i64 [ 0, %.preheader92.us ], [ %indvars.iv.next121, %54 ]
  %97 = icmp eq i64 %indvars.iv120, 0
  %98 = trunc i64 %indvars.iv120 to i32
  %99 = add i32 %98, -1
  %100 = trunc i64 %indvars.iv120 to i32
  %101 = trunc i64 %indvars.iv120 to i32
  %102 = add i32 %101, 2
  %103 = add i32 %101, 1
  %104 = icmp sgt i32 %102, %12
  %105 = icmp eq i64 %indvars.iv120, 0
  %106 = trunc i64 %indvars.iv120 to i32
  %107 = add i32 %106, -1
  %sext = shl i64 %indvars.iv120, 32
  %108 = ashr exact i64 %sext, 32
  %109 = getelementptr i8, ptr %45, i64 %108
  %110 = add nuw nsw i64 %indvars.iv120, 2
  %111 = icmp ugt i64 %110, %50
  %112 = trunc i64 %indvars.iv120 to i32
  %113 = add i32 %112, 1
  br label %.preheader.us

.preheader.split.us111:                           ; preds = %.preheader.us
  %114 = mul nsw i64 %93, %50
  br i1 %105, label %60, label %62

.split.us103:                                     ; preds = %.split.us103.loopexit112, %.split.us103.loopexit
  %.sink135 = phi ptr [ %91, %.split.us103.loopexit112 ], [ %160, %.split.us103.loopexit ]
  %.sink132 = phi i32 [ %82, %.split.us103.loopexit112 ], [ %149, %.split.us103.loopexit ]
  %.sink129 = phi i32 [ %86, %.split.us103.loopexit112 ], [ %153, %.split.us103.loopexit ]
  %.sink133.in = getelementptr inbounds [3 x [3 x i32]], ptr %5, i64 0, i64 %indvars.iv, i64 2
  %.sink133 = load i32, ptr %.sink133.in, align 4, !tbaa !17
  %115 = load i8, ptr %.sink135, align 1, !tbaa !14
  %116 = zext i8 %115 to i32
  %117 = mul nsw i32 %.sink133, %116
  %118 = add nsw i32 %117, %.sink132
  %119 = getelementptr inbounds [3 x [3 x i32]], ptr %6, i64 0, i64 %indvars.iv, i64 2
  %120 = load i32, ptr %119, align 4, !tbaa !17
  %121 = mul nsw i32 %120, %116
  %122 = add nsw i32 %121, %.sink129
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 3
  br i1 %exitcond.not, label %54, label %.preheader.us, !llvm.loop !18

123:                                              ; preds = %.preheader.split.us.us.preheader
  %124 = tail call i32 @hypercv_border_Interpolate(i32 noundef %99, i32 noundef %12, i32 noundef %3)
  br label %.preheader.split.us.us.2

.preheader.split.us.us.2:                         ; preds = %123, %.preheader.split.us.us.preheader
  %.084.us.us = phi i32 [ %124, %123 ], [ %99, %.preheader.split.us.us.preheader ]
  %125 = getelementptr inbounds [3 x [3 x i32]], ptr %5, i64 0, i64 %indvars.iv, i64 0
  %126 = load i32, ptr %125, align 4, !tbaa !17
  %127 = mul nsw i32 %96, %12
  %128 = add nsw i32 %.084.us.us, %127
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i8, ptr %45, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !14
  %132 = zext i8 %131 to i32
  %133 = mul nsw i32 %126, %132
  %134 = add nsw i32 %133, %.08198.us
  %135 = getelementptr inbounds [3 x [3 x i32]], ptr %6, i64 0, i64 %indvars.iv, i64 0
  %136 = load i32, ptr %135, align 4, !tbaa !17
  %137 = mul nsw i32 %136, %132
  %138 = add nsw i32 %137, %.08297.us
  %139 = tail call i32 @hypercv_border_Interpolate(i32 noundef %95, i32 noundef %7, i32 noundef %3)
  %140 = getelementptr inbounds [3 x [3 x i32]], ptr %5, i64 0, i64 %indvars.iv, i64 1
  %141 = load i32, ptr %140, align 4, !tbaa !17
  %142 = mul nsw i32 %139, %12
  %143 = add nsw i32 %142, %100
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds i8, ptr %45, i64 %144
  %146 = load i8, ptr %145, align 1, !tbaa !14
  %147 = zext i8 %146 to i32
  %148 = mul nsw i32 %141, %147
  %149 = add nsw i32 %148, %134
  %150 = getelementptr inbounds [3 x [3 x i32]], ptr %6, i64 0, i64 %indvars.iv, i64 1
  %151 = load i32, ptr %150, align 4, !tbaa !17
  %152 = mul nsw i32 %151, %147
  %153 = add nsw i32 %152, %138
  %154 = tail call i32 @hypercv_border_Interpolate(i32 noundef %95, i32 noundef %7, i32 noundef %3)
  br i1 %104, label %155, label %.split.us103.loopexit

155:                                              ; preds = %.preheader.split.us.us.2
  %156 = tail call i32 @hypercv_border_Interpolate(i32 noundef %103, i32 noundef %12, i32 noundef %3)
  br label %.split.us103.loopexit

.split.us103.loopexit:                            ; preds = %155, %.preheader.split.us.us.2
  %.084.us.us.2 = phi i32 [ %156, %155 ], [ %103, %.preheader.split.us.us.2 ]
  %157 = mul nsw i32 %154, %12
  %158 = add nsw i32 %.084.us.us.2, %157
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i8, ptr %45, i64 %159
  br label %.split.us103

._crit_edge.us:                                   ; preds = %54
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next125, %wide.trip.count127
  br i1 %exitcond128.not, label %._crit_edge102, label %.preheader92.us, !llvm.loop !19

._crit_edge102:                                   ; preds = %._crit_edge.us, %33
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %5) #9
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

attributes #0 = { 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 #1 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 12}
!13 = !{!6, !10, i64 24}
!14 = !{!8, !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass