; LLVM IR from ArefMq/SoccerBallDetection :: src/modules/edgeimage.ll (ZN7MVision9EdgeImage6refineERKNS_8Vector2DE)

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

%"class.MVision::Image::Pixel" = type { i8, i8, i8 }
%"class.MVision::Vector2D" = type { float, float }
%"class.MVision::EdgeImage" = type { %class.Debugable, %"class.MVision::Image", i32, %"class.std::vector", ptr, %"class.std::vector.0", %"class.std::vector.5" }
%class.Debugable = type { ptr, ptr }
%"class.MVision::Image" = type { i32, i32, i32, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<MVision::Vector2D>, std::allocator<std::vector<MVision::Vector2D>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<MVision::Vector2D>, std::allocator<std::vector<MVision::Vector2D>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<MVision::Vector2D>, std::allocator<std::vector<MVision::Vector2D>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<MVision::Vector2D>, std::allocator<std::vector<MVision::Vector2D>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<MVision::Vector2D, std::allocator<MVision::Vector2D>>::_Vector_impl" }
%"struct.std::_Vector_base<MVision::Vector2D, std::allocator<MVision::Vector2D>>::_Vector_impl" = type { %"struct.std::_Vector_base<MVision::Vector2D, std::allocator<MVision::Vector2D>>::_Vector_impl_data" }
%"struct.std::_Vector_base<MVision::Vector2D, std::allocator<MVision::Vector2D>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZN7MVision9EdgeImage5blackE = external dso_local global %"class.MVision::Image::Pixel", align 1
@_ZN7MVision9EdgeImage3redE = external dso_local global %"class.MVision::Image::Pixel", align 1

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

declare void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7MVision9EdgeImage11edgeingStepEf(float noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
declare dso_local i24 @_ZN7MVision9EdgeImage13calculateEdgeERKNS_8Vector2DES3_S3_i(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7MVision9EdgeImage12setSafePixelEiiRKNS_5Image5PixelE(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef, i32 noundef, ptr noundef nonnull align 1 dereferenceable(3)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7MVision9EdgeImage6refineERKNS_8Vector2DE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %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 %"class.MVision::Vector2D", align 4
  %14 = alloca %"class.MVision::Vector2D", align 4
  %15 = alloca %"class.MVision::Vector2D", align 4
  %16 = alloca %"class.MVision::Image::Pixel", align 1
  %17 = alloca %"class.MVision::Image::Pixel", align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %19)
  %21 = getelementptr inbounds %"class.MVision::EdgeImage", ptr %18, i32 0, i32 2
  %22 = load i32, ptr %21, align 8, !tbaa !9
  %23 = sitofp i32 %22 to float
  %24 = fsub float %20, %23
  %25 = call noundef float @_ZN7MVision9EdgeImage11edgeingStepEf(float noundef %24)
  %26 = fptosi float %25 to i32
  store i32 %26, ptr %5, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %27)
  %29 = load i32, ptr %5, align 4, !tbaa !26
  %30 = sitofp i32 %29 to float
  %31 = fsub float %28, %30
  %32 = fcmp ogt float %31, 1.000000e+00
  br i1 %32, label %33, label %39

33:                                               ; preds = %2
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %34)
  %36 = load i32, ptr %5, align 4, !tbaa !26
  %37 = sitofp i32 %36 to float
  %38 = fsub float %35, %37
  br label %40

39:                                               ; preds = %2
  br label %40

40:                                               ; preds = %39, %33
  %41 = phi float [ %38, %33 ], [ 1.000000e+00, %39 ]
  %42 = fptosi float %41 to i32
  store i32 %42, ptr %6, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %43)
  %45 = load i32, ptr %5, align 4, !tbaa !26
  %46 = sitofp i32 %45 to float
  %47 = fsub float %44, %46
  %48 = fcmp ogt float %47, 1.000000e+00
  br i1 %48, label %49, label %55

49:                                               ; preds = %40
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %50)
  %52 = load i32, ptr %5, align 4, !tbaa !26
  %53 = sitofp i32 %52 to float
  %54 = fsub float %51, %53
  br label %56

55:                                               ; preds = %40
  br label %56

56:                                               ; preds = %55, %49
  %57 = phi float [ %54, %49 ], [ 1.000000e+00, %55 ]
  %58 = fptosi float %57 to i32
  store i32 %58, ptr %7, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %59)
  %61 = load i32, ptr %5, align 4, !tbaa !26
  %62 = sitofp i32 %61 to float
  %63 = fadd float %60, %62
  %64 = getelementptr inbounds i8, ptr %18, i64 16
  %65 = getelementptr inbounds %"class.MVision::Image", ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !27
  %67 = sub i32 %66, 1
  %68 = uitofp i32 %67 to float
  %69 = fcmp olt float %63, %68
  br i1 %69, label %70, label %76

70:                                               ; preds = %56
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %71)
  %73 = load i32, ptr %5, align 4, !tbaa !26
  %74 = sitofp i32 %73 to float
  %75 = fadd float %72, %74
  br label %82

76:                                               ; preds = %56
  %77 = getelementptr inbounds i8, ptr %18, i64 16
  %78 = getelementptr inbounds %"class.MVision::Image", ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 4, !tbaa !27
  %80 = sub i32 %79, 1
  %81 = uitofp i32 %80 to float
  br label %82

82:                                               ; preds = %76, %70
  %83 = phi float [ %75, %70 ], [ %81, %76 ]
  %84 = fptosi float %83 to i32
  store i32 %84, ptr %8, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %85)
  %87 = load i32, ptr %5, align 4, !tbaa !26
  %88 = sitofp i32 %87 to float
  %89 = fadd float %86, %88
  %90 = getelementptr inbounds i8, ptr %18, i64 16
  %91 = getelementptr inbounds %"class.MVision::Image", ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 8, !tbaa !28
  %93 = sub i32 %92, 1
  %94 = uitofp i32 %93 to float
  %95 = fcmp olt float %89, %94
  br i1 %95, label %96, label %102

96:                                               ; preds = %82
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %97)
  %99 = load i32, ptr %5, align 4, !tbaa !26
  %100 = sitofp i32 %99 to float
  %101 = fadd float %98, %100
  br label %108

102:                                              ; preds = %82
  %103 = getelementptr inbounds i8, ptr %18, i64 16
  %104 = getelementptr inbounds %"class.MVision::Image", ptr %103, i32 0, i32 2
  %105 = load i32, ptr %104, align 8, !tbaa !28
  %106 = sub i32 %105, 1
  %107 = uitofp i32 %106 to float
  br label %108

108:                                              ; preds = %102, %96
  %109 = phi float [ %101, %96 ], [ %107, %102 ]
  %110 = fptosi float %109 to i32
  store i32 %110, ptr %9, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %111 = load i32, ptr %7, align 4, !tbaa !26
  store i32 %111, ptr %10, align 4, !tbaa !26
  br label %112

112:                                              ; preds = %206, %108
  %113 = load i32, ptr %10, align 4, !tbaa !26
  %114 = load i32, ptr %9, align 4, !tbaa !26
  %115 = icmp slt i32 %113, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %209

117:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %118 = load i32, ptr %6, align 4, !tbaa !26
  store i32 %118, ptr %12, align 4, !tbaa !26
  br label %119

119:                                              ; preds = %202, %117
  %120 = load i32, ptr %12, align 4, !tbaa !26
  %121 = load i32, ptr %8, align 4, !tbaa !26
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %119
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %205

124:                                              ; preds = %119
  %125 = load i32, ptr %12, align 4, !tbaa !26
  %126 = sitofp i32 %125 to float
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %127)
  %129 = fcmp oeq float %126, %128
  br i1 %129, label %130, label %137

130:                                              ; preds = %124
  %131 = load i32, ptr %10, align 4, !tbaa !26
  %132 = sitofp i32 %131 to float
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %133)
  %135 = fcmp oeq float %132, %134
  br i1 %135, label %136, label %137

136:                                              ; preds = %130
  br label %202

137:                                              ; preds = %130, %124
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %138 = load i32, ptr %12, align 4, !tbaa !26
  %139 = sitofp i32 %138 to float
  %140 = load i32, ptr %10, align 4, !tbaa !26
  %141 = sitofp i32 %140 to float
  call void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %13, float noundef %139, float noundef %141)
  %142 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %143 = getelementptr inbounds i8, ptr %18, i64 16
  %144 = getelementptr inbounds %"class.MVision::Image", ptr %143, i32 0, i32 1
  %145 = load i32, ptr %144, align 4, !tbaa !27
  %146 = sitofp i32 %145 to float
  %147 = fcmp olt float %142, %146
  br i1 %147, label %148, label %173

148:                                              ; preds = %137
  %149 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %150 = fcmp ogt float %149, -1.000000e+00
  br i1 %150, label %151, label %173

151:                                              ; preds = %148
  %152 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %153 = getelementptr inbounds i8, ptr %18, i64 16
  %154 = getelementptr inbounds %"class.MVision::Image", ptr %153, i32 0, i32 2
  %155 = load i32, ptr %154, align 8, !tbaa !28
  %156 = sitofp i32 %155 to float
  %157 = fcmp olt float %152, %156
  br i1 %157, label %158, label %173

158:                                              ; preds = %151
  %159 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %160 = fcmp ogt float %159, -1.000000e+00
  br i1 %160, label %161, label %173

161:                                              ; preds = %158
  %162 = getelementptr inbounds i8, ptr %18, i64 16
  %163 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %164 = fptoui float %163 to i32
  %165 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %166 = fptoui float %165 to i32
  %167 = call noundef nonnull align 1 dereferenceable(3) ptr @_ZN7MVision5Image8getPixelEjj(ptr noundef nonnull align 8 dereferenceable(24) %162, i32 noundef %164, i32 noundef %166)
  %168 = getelementptr inbounds %"class.MVision::Image::Pixel", ptr %167, i32 0, i32 0
  %169 = load i8, ptr %168, align 1, !tbaa !29
  %170 = zext i8 %169 to i32
  %171 = icmp ne i32 %170, 0
  br i1 %171, label %172, label %173

172:                                              ; preds = %161
  store i32 7, ptr %11, align 4
  br label %199

173:                                              ; preds = %161, %158, %151, %148, %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %174 = load i32, ptr %12, align 4, !tbaa !26
  %175 = sub nsw i32 %174, 1
  %176 = sitofp i32 %175 to float
  %177 = load i32, ptr %10, align 4, !tbaa !26
  %178 = sub nsw i32 %177, 1
  %179 = sitofp i32 %178 to float
  call void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %14, float noundef %176, float noundef %179)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %180 = load i32, ptr %12, align 4, !tbaa !26
  %181 = add nsw i32 %180, 1
  %182 = sitofp i32 %181 to float
  %183 = load i32, ptr %10, align 4, !tbaa !26
  %184 = add nsw i32 %183, 1
  %185 = sitofp i32 %184 to float
  call void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %15, float noundef %182, float noundef %185)
  call void @llvm.lifetime.start.p0(i64 3, ptr %16) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %16, ptr align 1 @_ZN7MVision9EdgeImage5blackE, i64 3, i1 false), !tbaa.struct !31
  call void @llvm.lifetime.start.p0(i64 3, ptr %17) #6
  %186 = call i24 @_ZN7MVision9EdgeImage13calculateEdgeERKNS_8Vector2DES3_S3_i(ptr noundef nonnull align 8 dereferenceable(128) %18, ptr noundef nonnull align 4 dereferenceable(8) %14, ptr noundef nonnull align 4 dereferenceable(8) %13, ptr noundef nonnull align 4 dereferenceable(8) %15, i32 noundef 60)
  store i24 %186, ptr %17, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %16, ptr align 1 %17, i64 3, i1 false), !tbaa.struct !31
  call void @llvm.lifetime.end.p0(i64 3, ptr %17) #6
  %187 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %188 = fptosi float %187 to i32
  %189 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %190 = fptosi float %189 to i32
  %191 = getelementptr inbounds %"class.MVision::Image::Pixel", ptr %16, i32 0, i32 0
  %192 = load i8, ptr %191, align 1, !tbaa !29
  %193 = zext i8 %192 to i32
  %194 = icmp sgt i32 %193, 127
  br i1 %194, label %195, label %196

195:                                              ; preds = %173
  br label %197

196:                                              ; preds = %173
  br label %197

197:                                              ; preds = %196, %195
  %198 = phi ptr [ @_ZN7MVision9EdgeImage3redE, %195 ], [ @_ZN7MVision9EdgeImage5blackE, %196 ]
  call void @_ZN7MVision9EdgeImage12setSafePixelEiiRKNS_5Image5PixelE(ptr noundef nonnull align 8 dereferenceable(128) %18, i32 noundef %188, i32 noundef %190, ptr noundef nonnull align 1 dereferenceable(3) %198)
  call void @llvm.lifetime.end.p0(i64 3, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  store i32 0, ptr %11, align 4
  br label %199

199:                                              ; preds = %197, %172
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %200 = load i32, ptr %11, align 4
  switch i32 %200, label %210 [
    i32 0, label %201
    i32 7, label %202
  ]

201:                                              ; preds = %199
  br label %202

202:                                              ; preds = %201, %199, %136
  %203 = load i32, ptr %12, align 4, !tbaa !26
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %12, align 4, !tbaa !26
  br label %119, !llvm.loop !33

205:                                              ; preds = %123
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %10, align 4, !tbaa !26
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %10, align 4, !tbaa !26
  br label %112, !llvm.loop !35

209:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret void

210:                                              ; preds = %199
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(3) ptr @_ZN7MVision5Image8getPixelEjj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #2 align 2

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 = { inlinehint 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { inlinehint 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 = { 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, !13, i64 40}
!10 = !{!"_ZTSN7MVision9EdgeImageE", !11, i64 0, !12, i64 16, !13, i64 40, !14, i64 48, !6, i64 72, !18, i64 80, !22, i64 104}
!11 = !{!"_ZTS9Debugable", !6, i64 8}
!12 = !{!"_ZTSN7MVision5ImageE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6vectorIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"_ZTSSt6vectorIS_IN7MVision8Vector2DESaIS1_EESaIS3_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseISt6vectorIN7MVision8Vector2DESaIS2_EESaIS4_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN7MVision8Vector2DESaIS2_EESaIS4_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN7MVision8Vector2DESaIS2_EESaIS4_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSSt6vectorIN7MVision8Vector2DESaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIN7MVision8Vector2DESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN7MVision8Vector2DESaIS1_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIN7MVision8Vector2DESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!13, !13, i64 0}
!27 = !{!12, !13, i64 4}
!28 = !{!12, !13, i64 8}
!29 = !{!30, !7, i64 0}
!30 = !{!"_ZTSN7MVision5Image5PixelE", !7, i64 0, !7, i64 1, !7, i64 2}
!31 = !{i64 0, i64 1, !32, i64 1, i64 1, !32, i64 2, i64 1, !32}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}


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

%"class.MVision::Image::Pixel" = type { i8, i8, i8 }
%"class.MVision::Vector2D" = type { float, float }

@_ZN7MVision9EdgeImage5blackE = external dso_local global %"class.MVision::Image::Pixel", align 1
@_ZN7MVision9EdgeImage3redE = external dso_local global %"class.MVision::Image::Pixel", align 1

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

declare void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN7MVision9EdgeImage11edgeingStepEf(float noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local i24 @_ZN7MVision9EdgeImage13calculateEdgeERKNS_8Vector2DES3_S3_i(ptr noundef nonnull align 8 dereferenceable(128), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7MVision9EdgeImage12setSafePixelEiiRKNS_5Image5PixelE(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef, i32 noundef, ptr noundef nonnull align 1 dereferenceable(3)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7MVision9EdgeImage6refineERKNS_8Vector2DE(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 4 dereferenceable(8) %1) local_unnamed_addr #3 align 2 {
  %3 = alloca %"class.MVision::Vector2D", align 4
  %4 = alloca %"class.MVision::Vector2D", align 4
  %5 = alloca %"class.MVision::Vector2D", align 4
  %6 = tail call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = sitofp i32 %8 to float
  %10 = fsub float %6, %9
  %11 = tail call noundef float @_ZN7MVision9EdgeImage11edgeingStepEf(float noundef %10)
  %12 = fptosi float %11 to i32
  %13 = tail call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %14 = sitofp i32 %12 to float
  %15 = fsub float %13, %14
  %16 = fcmp ogt float %15, 1.000000e+00
  br i1 %16, label %17, label %21

17:                                               ; preds = %2
  %18 = tail call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %19 = fsub float %18, %14
  %20 = fptosi float %19 to i32
  br label %21

21:                                               ; preds = %2, %17
  %22 = phi i32 [ %20, %17 ], [ 1, %2 ]
  %23 = tail call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %24 = fsub float %23, %14
  %25 = fcmp ogt float %24, 1.000000e+00
  br i1 %25, label %26, label %30

26:                                               ; preds = %21
  %27 = tail call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %28 = fsub float %27, %14
  %29 = fptosi float %28 to i32
  br label %30

30:                                               ; preds = %21, %26
  %31 = phi i32 [ %29, %26 ], [ 1, %21 ]
  %32 = tail call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %33 = fadd float %32, %14
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = getelementptr inbounds i8, ptr %0, i64 20
  %36 = load i32, ptr %35, align 4, !tbaa !25
  %37 = add i32 %36, -1
  %38 = uitofp i32 %37 to float
  %39 = fcmp olt float %33, %38
  br i1 %39, label %40, label %43

40:                                               ; preds = %30
  %41 = tail call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %42 = fadd float %41, %14
  br label %43

43:                                               ; preds = %30, %40
  %44 = phi float [ %42, %40 ], [ %38, %30 ]
  %45 = fptosi float %44 to i32
  %46 = tail call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %47 = fadd float %46, %14
  %48 = getelementptr inbounds i8, ptr %0, i64 24
  %49 = load i32, ptr %48, align 8, !tbaa !26
  %50 = add i32 %49, -1
  %51 = uitofp i32 %50 to float
  %52 = fcmp olt float %47, %51
  br i1 %52, label %53, label %56

53:                                               ; preds = %43
  %54 = tail call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %55 = fadd float %54, %14
  br label %56

56:                                               ; preds = %43, %53
  %57 = phi float [ %55, %53 ], [ %51, %43 ]
  %58 = fptosi float %57 to i32
  %59 = icmp slt i32 %31, %58
  %60 = icmp slt i32 %22, %45
  %or.cond = select i1 %59, i1 %60, i1 false
  br i1 %or.cond, label %.preheader.us, label %._crit_edge43

.preheader.us:                                    ; preds = %56, %._crit_edge.us
  %.042.us = phi i32 [ %64, %._crit_edge.us ], [ %31, %56 ]
  %61 = sitofp i32 %.042.us to float
  %62 = add nsw i32 %.042.us, -1
  %63 = sitofp i32 %62 to float
  %64 = add i32 %.042.us, 1
  %65 = sitofp i32 %64 to float
  br label %66

66:                                               ; preds = %.preheader.us, %108
  %.03640.us = phi i32 [ %22, %.preheader.us ], [ %109, %108 ]
  %67 = sitofp i32 %.03640.us to float
  %68 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %69 = fcmp oeq float %68, %67
  br i1 %69, label %70, label %73

70:                                               ; preds = %66
  %71 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %1)
  %72 = fcmp oeq float %71, %61
  br i1 %72, label %108, label %73

73:                                               ; preds = %70, %66
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %3, float noundef %67, float noundef %61)
  %74 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %75 = load i32, ptr %35, align 4, !tbaa !25
  %76 = sitofp i32 %75 to float
  %77 = fcmp olt float %74, %76
  br i1 %77, label %78, label %96

78:                                               ; preds = %73
  %79 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %80 = fcmp ogt float %79, -1.000000e+00
  br i1 %80, label %81, label %96

81:                                               ; preds = %78
  %82 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %83 = load i32, ptr %48, align 8, !tbaa !26
  %84 = sitofp i32 %83 to float
  %85 = fcmp olt float %82, %84
  br i1 %85, label %86, label %96

86:                                               ; preds = %81
  %87 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %88 = fcmp ogt float %87, -1.000000e+00
  br i1 %88, label %89, label %96

89:                                               ; preds = %86
  %90 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %91 = fptoui float %90 to i32
  %92 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %93 = fptoui float %92 to i32
  %94 = call noundef nonnull align 1 dereferenceable(3) ptr @_ZN7MVision5Image8getPixelEjj(ptr noundef nonnull align 8 dereferenceable(24) %34, i32 noundef %91, i32 noundef %93)
  %95 = load i8, ptr %94, align 1, !tbaa !27
  %.not.us = icmp eq i8 %95, 0
  br i1 %.not.us, label %96, label %107

96:                                               ; preds = %89, %86, %81, %78, %73
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %97 = add nsw i32 %.03640.us, -1
  %98 = sitofp i32 %97 to float
  call void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %4, float noundef %98, float noundef %63)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %99 = add nsw i32 %.03640.us, 1
  %100 = sitofp i32 %99 to float
  call void @_ZN7MVision8Vector2DC1Eff(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %100, float noundef %65)
  %101 = call i24 @_ZN7MVision9EdgeImage13calculateEdgeERKNS_8Vector2DES3_S3_i(ptr noundef nonnull align 8 dereferenceable(128) %0, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 60)
  %102 = call noundef float @_ZNK7MVision8Vector2D1xEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %103 = fptosi float %102 to i32
  %104 = call noundef float @_ZNK7MVision8Vector2D1yEv(ptr noundef nonnull align 4 dereferenceable(8) %3)
  %105 = fptosi float %104 to i32
  %106 = and i24 %101, 128
  %.not39.us = icmp eq i24 %106, 0
  %_ZN7MVision9EdgeImage3redE._ZN7MVision9EdgeImage5blackE.us = select i1 %.not39.us, ptr @_ZN7MVision9EdgeImage5blackE, ptr @_ZN7MVision9EdgeImage3redE
  call void @_ZN7MVision9EdgeImage12setSafePixelEiiRKNS_5Image5PixelE(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %103, i32 noundef %105, ptr noundef nonnull align 1 dereferenceable(3) %_ZN7MVision9EdgeImage3redE._ZN7MVision9EdgeImage5blackE.us)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %107

107:                                              ; preds = %96, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %108

108:                                              ; preds = %107, %70
  %109 = add i32 %.03640.us, 1
  %exitcond.not = icmp eq i32 %109, %45
  br i1 %exitcond.not, label %._crit_edge.us, label %66, !llvm.loop !29

._crit_edge.us:                                   ; preds = %108
  %exitcond45.not = icmp eq i32 %64, %58
  br i1 %exitcond45.not, label %._crit_edge43, label %.preheader.us, !llvm.loop !31

._crit_edge43:                                    ; preds = %._crit_edge.us, %56
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(3) ptr @_ZN7MVision5Image8getPixelEjj(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint 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 #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 = { inlinehint 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 #5 = { 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, !12, i64 40}
!6 = !{!"_ZTSN7MVision9EdgeImageE", !7, i64 0, !11, i64 16, !12, i64 40, !13, i64 48, !8, i64 72, !17, i64 80, !21, i64 104}
!7 = !{!"_ZTS9Debugable", !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN7MVision5ImageE", !12, i64 0, !12, i64 4, !12, i64 8, !8, i64 16}
!12 = !{!"int", !9, i64 0}
!13 = !{!"_ZTSSt6vectorIiSaIiEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!17 = !{!"_ZTSSt6vectorIS_IN7MVision8Vector2DESaIS1_EESaIS3_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseISt6vectorIN7MVision8Vector2DESaIS2_EESaIS4_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN7MVision8Vector2DESaIS2_EESaIS4_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN7MVision8Vector2DESaIS2_EESaIS4_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!21 = !{!"_ZTSSt6vectorIN7MVision8Vector2DESaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseIN7MVision8Vector2DESaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIN7MVision8Vector2DESaIS1_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIN7MVision8Vector2DESaIS1_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!25 = !{!11, !12, i64 4}
!26 = !{!11, !12, i64 8}
!27 = !{!28, !9, i64 0}
!28 = !{!"_ZTSN7MVision5Image5PixelE", !9, i64 0, !9, i64 1, !9, i64 2}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass