; LLVM IR from bbenligiray/stag :: src/ED/ValidateEdgeSegments.ll (Z31ValidateEdgeSegmentsMultipleDivP7EdgeMapPhPS1_i)

; 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.EdgeMap = type <{ i32, i32, ptr, ptr, ptr, i32, [4 x i8] }>
%struct.EdgeSegment = type { ptr, i32 }
%struct.Pixel = type { i32, i32 }

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL17ComputePrewitt3x3PhiiPd(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL11TestSegmentP7EdgeMapPsiiiiPdd(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, double noundef) #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #6

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z31ValidateEdgeSegmentsMultipleDivP7EdgeMapPhPS1_i(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #5 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.EdgeMap, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !11
  store i32 %28, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.EdgeMap, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !13
  store i32 %31, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 32768, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %33, i64 8)
  %35 = extractvalue { i64, i1 } %34, 1
  %36 = extractvalue { i64, i1 } %34, 0
  %37 = select i1 %35, i64 -1, i64 %36
  %38 = call noalias noundef nonnull ptr @_Znam(i64 noundef %37) #8
  store ptr %38, ptr %12, align 8, !tbaa !5
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = load i32, ptr %11, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = mul i64 8, %41
  call void @llvm.memset.p0.i64(ptr align 8 %39, i8 0, i64 %42, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = call noundef ptr @_ZL17ComputePrewitt3x3PhiiPd(ptr noundef %43, i32 noundef %44, i32 noundef %45, ptr noundef %46)
  store ptr %47, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  store double 1.000000e+00, ptr %15, align 8, !tbaa !14
  br label %48

48:                                               ; preds = %205, %4
  %49 = load double, ptr %15, align 8, !tbaa !14
  %50 = fcmp ole double %49, 8.500000e+00
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %210

52:                                               ; preds = %48
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.EdgeMap, ptr %53, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !16
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = load i32, ptr %10, align 4, !tbaa !9
  %58 = mul nsw i32 %56, %57
  %59 = sext i32 %58 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %55, i8 0, i64 %59, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %83, %52
  %61 = load i32, ptr %18, align 4, !tbaa !9
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.EdgeMap, ptr %62, i32 0, i32 5
  %64 = load i32, ptr %63, align 8, !tbaa !17
  %65 = icmp slt i32 %61, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %60
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %86

67:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.EdgeMap, ptr %68, i32 0, i32 4
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  %71 = load i32, ptr %18, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds %struct.EdgeSegment, ptr %70, i64 %72
  %74 = getelementptr inbounds %struct.EdgeSegment, ptr %73, i32 0, i32 1
  %75 = load i32, ptr %74, align 8, !tbaa !19
  store i32 %75, ptr %19, align 4, !tbaa !9
  %76 = load i32, ptr %19, align 4, !tbaa !9
  %77 = load i32, ptr %19, align 4, !tbaa !9
  %78 = sub nsw i32 %77, 1
  %79 = mul nsw i32 %76, %78
  %80 = sdiv i32 %79, 2
  %81 = load i32, ptr %17, align 4, !tbaa !9
  %82 = add nsw i32 %81, %80
  store i32 %82, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %83

83:                                               ; preds = %67
  %84 = load i32, ptr %18, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %18, align 4, !tbaa !9
  br label %60, !llvm.loop !21

86:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = load i32, ptr %14, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds ptr, ptr %87, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  store ptr %91, ptr %20, align 8, !tbaa !5
  %92 = load ptr, ptr %20, align 8, !tbaa !5
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %111

94:                                               ; preds = %86
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = mul nsw i32 %95, %96
  %98 = sext i32 %97 to i64
  %99 = call noalias noundef nonnull ptr @_Znam(i64 noundef %98) #8
  store ptr %99, ptr %20, align 8, !tbaa !5
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = load i32, ptr %14, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds ptr, ptr %100, i64 %102
  store ptr %99, ptr %103, align 8, !tbaa !5
  %104 = load ptr, ptr %20, align 8, !tbaa !5
  %105 = load i32, ptr %9, align 4, !tbaa !9
  %106 = load i32, ptr %10, align 4, !tbaa !9
  %107 = mul nsw i32 %105, %106
  %108 = sext i32 %107 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %104, i8 0, i64 %108, i1 false)
  %109 = load i32, ptr %8, align 4, !tbaa !9
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %8, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %94, %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %135, %111
  %113 = load i32, ptr %21, align 4, !tbaa !9
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.EdgeMap, ptr %114, i32 0, i32 5
  %116 = load i32, ptr %115, align 8, !tbaa !17
  %117 = icmp slt i32 %113, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %112
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %138

119:                                              ; preds = %112
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = load i32, ptr %21, align 4, !tbaa !9
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.EdgeMap, ptr %123, i32 0, i32 4
  %125 = load ptr, ptr %124, align 8, !tbaa !18
  %126 = load i32, ptr %21, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds %struct.EdgeSegment, ptr %125, i64 %127
  %129 = getelementptr inbounds %struct.EdgeSegment, ptr %128, i32 0, i32 1
  %130 = load i32, ptr %129, align 8, !tbaa !19
  %131 = sub nsw i32 %130, 1
  %132 = load i32, ptr %17, align 4, !tbaa !9
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = load double, ptr %15, align 8, !tbaa !14
  call void @_ZL11TestSegmentP7EdgeMapPsiiiiPdd(ptr noundef %120, ptr noundef %121, i32 noundef %122, i32 noundef 0, i32 noundef %131, i32 noundef %132, ptr noundef %133, double noundef %134)
  br label %135

135:                                              ; preds = %119
  %136 = load i32, ptr %21, align 4, !tbaa !9
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %21, align 4, !tbaa !9
  br label %112, !llvm.loop !23

138:                                              ; preds = %118
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_Z18ExtractNewSegmentsP7EdgeMap(ptr noundef %139)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %201, %138
  %141 = load i32, ptr %22, align 4, !tbaa !9
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.EdgeMap, ptr %142, i32 0, i32 5
  %144 = load i32, ptr %143, align 8, !tbaa !17
  %145 = icmp slt i32 %141, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %140
  store i32 11, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %204

147:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %148

148:                                              ; preds = %197, %147
  %149 = load i32, ptr %23, align 4, !tbaa !9
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.EdgeMap, ptr %150, i32 0, i32 4
  %152 = load ptr, ptr %151, align 8, !tbaa !18
  %153 = load i32, ptr %22, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds %struct.EdgeSegment, ptr %152, i64 %154
  %156 = getelementptr inbounds %struct.EdgeSegment, ptr %155, i32 0, i32 1
  %157 = load i32, ptr %156, align 8, !tbaa !19
  %158 = icmp slt i32 %149, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %148
  store i32 14, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %200

160:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #7
  %161 = load ptr, ptr %5, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.EdgeMap, ptr %161, i32 0, i32 4
  %163 = load ptr, ptr %162, align 8, !tbaa !18
  %164 = load i32, ptr %22, align 4, !tbaa !9
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds %struct.EdgeSegment, ptr %163, i64 %165
  %167 = getelementptr inbounds %struct.EdgeSegment, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !24
  %169 = load i32, ptr %23, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds %struct.Pixel, ptr %168, i64 %170
  %172 = getelementptr inbounds %struct.Pixel, ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 4, !tbaa !25
  store i32 %173, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.EdgeMap, ptr %174, i32 0, i32 4
  %176 = load ptr, ptr %175, align 8, !tbaa !18
  %177 = load i32, ptr %22, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds %struct.EdgeSegment, ptr %176, i64 %178
  %180 = getelementptr inbounds %struct.EdgeSegment, ptr %179, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !24
  %182 = load i32, ptr %23, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds %struct.Pixel, ptr %181, i64 %183
  %185 = getelementptr inbounds %struct.Pixel, ptr %184, i32 0, i32 1
  %186 = load i32, ptr %185, align 4, !tbaa !27
  store i32 %186, ptr %25, align 4, !tbaa !9
  %187 = load ptr, ptr %20, align 8, !tbaa !5
  %188 = load i32, ptr %24, align 4, !tbaa !9
  %189 = load i32, ptr %9, align 4, !tbaa !9
  %190 = mul nsw i32 %188, %189
  %191 = load i32, ptr %25, align 4, !tbaa !9
  %192 = add nsw i32 %190, %191
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds i8, ptr %187, i64 %193
  %195 = load i8, ptr %194, align 1, !tbaa !28
  %196 = add i8 %195, 1
  store i8 %196, ptr %194, align 1, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %197

197:                                              ; preds = %160
  %198 = load i32, ptr %23, align 4, !tbaa !9
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %23, align 4, !tbaa !9
  br label %148, !llvm.loop !29

200:                                              ; preds = %159
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %22, align 4, !tbaa !9
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %22, align 4, !tbaa !9
  br label %140, !llvm.loop !30

204:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %205

205:                                              ; preds = %204
  %206 = load double, ptr %15, align 8, !tbaa !14
  %207 = fadd double %206, 5.000000e-01
  store double %207, ptr %15, align 8, !tbaa !14
  %208 = load i32, ptr %14, align 4, !tbaa !9
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %14, align 4, !tbaa !9
  br label %48, !llvm.loop !31

210:                                              ; preds = %51
  %211 = load ptr, ptr %12, align 8, !tbaa !5
  %212 = icmp eq ptr %211, null
  br i1 %212, label %214, label %213

213:                                              ; preds = %210
  call void @_ZdlPvm(ptr noundef %211, i64 noundef 8) #9
  br label %214

214:                                              ; preds = %213, %210
  %215 = load ptr, ptr %13, align 8, !tbaa !5
  %216 = icmp eq ptr %215, null
  br i1 %216, label %218, label %217

217:                                              ; preds = %214
  call void @_ZdlPvm(ptr noundef %215, i64 noundef 2) #9
  br label %218

218:                                              ; preds = %217, %214
  %219 = load i32, ptr %8, align 4, !tbaa !9
  store i32 1, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret i32 %219
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS7EdgeMap", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32}
!13 = !{!12, !10, i64 4}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !10, i64 32}
!18 = !{!12, !6, i64 24}
!19 = !{!20, !10, i64 8}
!20 = !{!"_ZTS11EdgeSegment", !6, i64 0, !10, i64 8}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!20, !6, i64 0}
!25 = !{!26, !10, i64 0}
!26 = !{!"_ZTS5Pixel", !10, i64 0, !10, i64 4}
!27 = !{!26, !10, i64 4}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !22}
!30 = distinct !{!30, !22}
!31 = distinct !{!31, !22}


; 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.EdgeSegment = type { ptr, i32 }
%struct.Pixel = type { i32, i32 }

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL17ComputePrewitt3x3PhiiPd(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL11TestSegmentP7EdgeMapPsiiiiPdd(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, double noundef) local_unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z31ValidateEdgeSegmentsMultipleDivP7EdgeMapPhPS1_i(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = load i32, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = tail call noalias noundef nonnull dereferenceable(262144) ptr @_Znam(i64 noundef 262144) #6
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(262144) %8, i8 0, i64 262144, i1 false)
  %9 = tail call noundef ptr @_ZL17ComputePrewitt3x3PhiiPd(ptr noundef %1, i32 noundef %5, i32 noundef %7, ptr noundef nonnull %8)
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = mul nsw i32 %7, %5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  br label %15

15:                                               ; preds = %4, %._crit_edge85
  %indvars.iv99 = phi i64 [ 0, %4 ], [ %indvars.iv.next100, %._crit_edge85 ]
  %.088 = phi i32 [ %3, %4 ], [ %.1, %._crit_edge85 ]
  %.07086 = phi double [ 1.000000e+00, %4 ], [ %92, %._crit_edge85 ]
  %16 = load ptr, ptr %10, align 8, !tbaa !12
  tail call void @llvm.memset.p0.i64(ptr align 1 %16, i8 0, i64 %12, i1 false)
  %17 = load i32, ptr %13, align 8, !tbaa !13
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %15
  %19 = load ptr, ptr %14, align 8, !tbaa !14
  %wide.trip.count = zext nneg i32 %17 to i64
  %min.iters.check = icmp ult i32 %17, 9
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %.07275.ph = phi i32 [ 0, %.lr.ph ], [ %62, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.mod.vf = and i64 %wide.trip.count, 7
  %20 = icmp eq i64 %n.mod.vf, 0
  %21 = select i1 %20, i64 8, i64 %n.mod.vf
  %n.vec = sub nsw i64 %wide.trip.count, %21
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %59, %vector.body ]
  %vec.phi106 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %60, %vector.body ]
  %22 = or disjoint i64 %index, 1
  %23 = or disjoint i64 %index, 2
  %24 = or disjoint i64 %index, 3
  %25 = or disjoint i64 %index, 4
  %26 = or disjoint i64 %index, 5
  %27 = or disjoint i64 %index, 6
  %28 = or disjoint i64 %index, 7
  %29 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %index, i32 1
  %30 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %22, i32 1
  %31 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %23, i32 1
  %32 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %24, i32 1
  %33 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %25, i32 1
  %34 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %26, i32 1
  %35 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %27, i32 1
  %36 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %28, i32 1
  %37 = load i32, ptr %29, align 8, !tbaa !15
  %38 = load i32, ptr %30, align 8, !tbaa !15
  %39 = load i32, ptr %31, align 8, !tbaa !15
  %40 = load i32, ptr %32, align 8, !tbaa !15
  %41 = insertelement <4 x i32> poison, i32 %37, i64 0
  %42 = insertelement <4 x i32> %41, i32 %38, i64 1
  %43 = insertelement <4 x i32> %42, i32 %39, i64 2
  %44 = insertelement <4 x i32> %43, i32 %40, i64 3
  %45 = load i32, ptr %33, align 8, !tbaa !15
  %46 = load i32, ptr %34, align 8, !tbaa !15
  %47 = load i32, ptr %35, align 8, !tbaa !15
  %48 = load i32, ptr %36, align 8, !tbaa !15
  %49 = insertelement <4 x i32> poison, i32 %45, i64 0
  %50 = insertelement <4 x i32> %49, i32 %46, i64 1
  %51 = insertelement <4 x i32> %50, i32 %47, i64 2
  %52 = insertelement <4 x i32> %51, i32 %48, i64 3
  %53 = add nsw <4 x i32> %44, <i32 -1, i32 -1, i32 -1, i32 -1>
  %54 = add nsw <4 x i32> %52, <i32 -1, i32 -1, i32 -1, i32 -1>
  %55 = mul nsw <4 x i32> %53, %44
  %56 = mul nsw <4 x i32> %54, %52
  %57 = sdiv <4 x i32> %55, <i32 2, i32 2, i32 2, i32 2>
  %58 = sdiv <4 x i32> %56, <i32 2, i32 2, i32 2, i32 2>
  %59 = add <4 x i32> %57, %vec.phi
  %60 = add <4 x i32> %58, %vec.phi106
  %index.next = add nuw i64 %index, 8
  %61 = icmp eq i64 %index.next, %n.vec
  br i1 %61, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %60, %59
  %62 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br label %scalar.ph.preheader

._crit_edge:                                      ; preds = %scalar.ph, %15
  %.072.lcssa = phi i32 [ 0, %15 ], [ %71, %scalar.ph ]
  %63 = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv99
  %64 = load ptr, ptr %63, align 8, !tbaa !21
  %65 = icmp eq ptr %64, null
  br i1 %65, label %72, label %75

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %.07275 = phi i32 [ %71, %scalar.ph ], [ %.07275.ph, %scalar.ph.preheader ]
  %66 = getelementptr inbounds %struct.EdgeSegment, ptr %19, i64 %indvars.iv, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !15
  %68 = add nsw i32 %67, -1
  %69 = mul nsw i32 %68, %67
  %70 = sdiv i32 %69, 2
  %71 = add nsw i32 %70, %.07275
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !22

72:                                               ; preds = %._crit_edge
  %73 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %12) #6
  store ptr %73, ptr %63, align 8, !tbaa !21
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %73, i8 0, i64 %12, i1 false)
  %74 = add nsw i32 %.088, 1
  br label %75

75:                                               ; preds = %72, %._crit_edge
  %.069 = phi ptr [ %73, %72 ], [ %64, %._crit_edge ]
  %.1 = phi i32 [ %74, %72 ], [ %.088, %._crit_edge ]
  br i1 %18, label %.lr.ph79, label %._crit_edge80

._crit_edge80:                                    ; preds = %.lr.ph79, %75
  tail call void @_Z18ExtractNewSegmentsP7EdgeMap(ptr noundef nonnull %0)
  %76 = load i32, ptr %13, align 8, !tbaa !13
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.preheader.preheader, label %._crit_edge85

.preheader.preheader:                             ; preds = %._crit_edge80
  %.pre = load ptr, ptr %14, align 8, !tbaa !14
  br label %.preheader

.lr.ph79:                                         ; preds = %75, %.lr.ph79
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.lr.ph79 ], [ 0, %75 ]
  %78 = load ptr, ptr %14, align 8, !tbaa !14
  %79 = getelementptr inbounds %struct.EdgeSegment, ptr %78, i64 %indvars.iv90, i32 1
  %80 = load i32, ptr %79, align 8, !tbaa !15
  %81 = add nsw i32 %80, -1
  %82 = trunc nuw nsw i64 %indvars.iv90 to i32
  tail call void @_ZL11TestSegmentP7EdgeMapPsiiiiPdd(ptr noundef nonnull %0, ptr noundef %9, i32 noundef %82, i32 noundef 0, i32 noundef %81, i32 noundef %.072.lcssa, ptr noundef nonnull %8, double noundef %.07086)
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %83 = load i32, ptr %13, align 8, !tbaa !13
  %84 = sext i32 %83 to i64
  %85 = icmp slt i64 %indvars.iv.next91, %84
  br i1 %85, label %.lr.ph79, label %._crit_edge80, !llvm.loop !23

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge83
  %86 = phi i32 [ %76, %.preheader.preheader ], [ %93, %._crit_edge83 ]
  %87 = phi ptr [ %.pre, %.preheader.preheader ], [ %94, %._crit_edge83 ]
  %indvars.iv96 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next97, %._crit_edge83 ]
  %88 = getelementptr inbounds %struct.EdgeSegment, ptr %87, i64 %indvars.iv96
  %89 = getelementptr inbounds i8, ptr %88, i64 8
  %90 = load i32, ptr %89, align 8, !tbaa !15
  %91 = icmp sgt i32 %90, 0
  br i1 %91, label %.lr.ph82, label %._crit_edge83

._crit_edge85:                                    ; preds = %._crit_edge83, %._crit_edge80
  %92 = fadd double %.07086, 5.000000e-01
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %exitcond102 = icmp eq i64 %indvars.iv.next100, 16
  br i1 %exitcond102, label %115, label %15, !llvm.loop !24

._crit_edge83.loopexit:                           ; preds = %.lr.ph82
  %.pre103 = load i32, ptr %13, align 8, !tbaa !13
  br label %._crit_edge83

._crit_edge83:                                    ; preds = %._crit_edge83.loopexit, %.preheader
  %93 = phi i32 [ %.pre103, %._crit_edge83.loopexit ], [ %86, %.preheader ]
  %94 = phi ptr [ %109, %._crit_edge83.loopexit ], [ %87, %.preheader ]
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %95 = sext i32 %93 to i64
  %96 = icmp slt i64 %indvars.iv.next97, %95
  br i1 %96, label %.preheader, label %._crit_edge85, !llvm.loop !25

.lr.ph82:                                         ; preds = %.preheader, %.lr.ph82
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %.lr.ph82 ], [ 0, %.preheader ]
  %97 = phi ptr [ %110, %.lr.ph82 ], [ %88, %.preheader ]
  %98 = load ptr, ptr %97, align 8, !tbaa !26
  %99 = getelementptr inbounds %struct.Pixel, ptr %98, i64 %indvars.iv93
  %100 = load i32, ptr %99, align 4, !tbaa !27
  %101 = getelementptr inbounds i8, ptr %99, i64 4
  %102 = load i32, ptr %101, align 4, !tbaa !29
  %103 = mul nsw i32 %100, %5
  %104 = add nsw i32 %103, %102
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i8, ptr %.069, i64 %105
  %107 = load i8, ptr %106, align 1, !tbaa !30
  %108 = add i8 %107, 1
  store i8 %108, ptr %106, align 1, !tbaa !30
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %109 = load ptr, ptr %14, align 8, !tbaa !14
  %110 = getelementptr inbounds %struct.EdgeSegment, ptr %109, i64 %indvars.iv96
  %111 = getelementptr inbounds i8, ptr %110, i64 8
  %112 = load i32, ptr %111, align 8, !tbaa !15
  %113 = sext i32 %112 to i64
  %114 = icmp slt i64 %indvars.iv.next94, %113
  br i1 %114, label %.lr.ph82, label %._crit_edge83.loopexit, !llvm.loop !31

115:                                              ; preds = %._crit_edge85
  tail call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 8) #7
  %116 = icmp eq ptr %9, null
  br i1 %116, label %118, label %117

117:                                              ; preds = %115
  tail call void @_ZdlPvm(ptr noundef nonnull %9, i64 noundef 2) #7
  br label %118

118:                                              ; preds = %117, %115
  ret i32 %.1
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nobuiltin allocsize(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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nobuiltin 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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 = !{!"_ZTS7EdgeMap", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !7, i64 32}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !10, i64 24}
!15 = !{!16, !7, i64 8}
!16 = !{!"_ZTS11EdgeSegment", !10, i64 0, !7, i64 8}
!17 = distinct !{!17, !18, !19, !20}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = !{!10, !10, i64 0}
!22 = distinct !{!22, !18, !20, !19}
!23 = distinct !{!23, !18}
!24 = distinct !{!24, !18}
!25 = distinct !{!25, !18}
!26 = !{!16, !10, i64 0}
!27 = !{!28, !7, i64 0}
!28 = !{!"_ZTS5Pixel", !7, i64 0, !7, i64 4}
!29 = !{!28, !7, i64 4}
!30 = !{!8, !8, i64 0}
!31 = distinct !{!31, !18}


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