; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/descriptor/EdgeDetector._b3be246f (Z6getLapP12ImageContentff)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5floorf(float noundef) #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 i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_Z6getLapP12ImageContentff(ptr noundef %0, float noundef %1, float noundef %2) #2 {
  %4 = alloca float, align 4
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store float %1, ptr %6, align 4, !tbaa !9
  store float %2, ptr %7, align 4, !tbaa !9
  %13 = load float, ptr %6, align 4, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  %16 = sub i32 %15, 1
  %17 = uitofp i32 %16 to float
  %18 = fcmp olt float %13, %17
  br i1 %18, label %19, label %114

19:                                               ; preds = %3
  %20 = load float, ptr %7, align 4, !tbaa !9
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80) %21)
  %23 = sub i32 %22, 1
  %24 = uitofp i32 %23 to float
  %25 = fcmp olt float %20, %24
  br i1 %25, label %26, label %114

26:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %27 = load float, ptr %6, align 4, !tbaa !9
  %28 = call noundef float @_ZSt5floorf(float noundef %27)
  %29 = fptosi float %28 to i32
  store i32 %29, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %30 = load float, ptr %7, align 4, !tbaa !9
  %31 = call noundef float @_ZSt5floorf(float noundef %30)
  %32 = fptosi float %31 to i32
  store i32 %32, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %33 = load float, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = sitofp i32 %34 to float
  %36 = fsub float %33, %35
  store float %36, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %37 = load float, ptr %7, align 4, !tbaa !9
  %38 = load i32, ptr %9, align 4, !tbaa !11
  %39 = sitofp i32 %38 to float
  %40 = fsub float %37, %39
  store float %40, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %41 = load float, ptr %11, align 4, !tbaa !9
  %42 = fpext float %41 to double
  %43 = fsub double 1.000000e+00, %42
  %44 = load float, ptr %10, align 4, !tbaa !9
  %45 = fpext float %44 to double
  %46 = fsub double 1.000000e+00, %45
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %class.ImageContent, ptr %47, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !13
  %50 = load i32, ptr %9, align 4, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds ptr, ptr %49, i64 %51
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = load i32, ptr %8, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds float, ptr %53, i64 %55
  %57 = load float, ptr %56, align 4, !tbaa !9
  %58 = fpext float %57 to double
  %59 = load float, ptr %10, align 4, !tbaa !9
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %class.ImageContent, ptr %60, i32 0, i32 4
  %62 = load ptr, ptr %61, align 8, !tbaa !13
  %63 = load i32, ptr %9, align 4, !tbaa !11
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds ptr, ptr %62, i64 %64
  %66 = load ptr, ptr %65, align 8, !tbaa !5
  %67 = load i32, ptr %8, align 4, !tbaa !11
  %68 = add nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds float, ptr %66, i64 %69
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = fmul float %59, %71
  %73 = fpext float %72 to double
  %74 = call double @llvm.fmuladd.f64(double %46, double %58, double %73)
  %75 = load float, ptr %11, align 4, !tbaa !9
  %76 = fpext float %75 to double
  %77 = load float, ptr %10, align 4, !tbaa !9
  %78 = fpext float %77 to double
  %79 = fsub double 1.000000e+00, %78
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %class.ImageContent, ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !13
  %83 = load i32, ptr %9, align 4, !tbaa !11
  %84 = add nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds ptr, ptr %82, i64 %85
  %87 = load ptr, ptr %86, align 8, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !11
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds float, ptr %87, i64 %89
  %91 = load float, ptr %90, align 4, !tbaa !9
  %92 = fpext float %91 to double
  %93 = load float, ptr %10, align 4, !tbaa !9
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %class.ImageContent, ptr %94, i32 0, i32 4
  %96 = load ptr, ptr %95, align 8, !tbaa !13
  %97 = load i32, ptr %9, align 4, !tbaa !11
  %98 = add nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds ptr, ptr %96, i64 %99
  %101 = load ptr, ptr %100, align 8, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !11
  %103 = add nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds float, ptr %101, i64 %104
  %106 = load float, ptr %105, align 4, !tbaa !9
  %107 = fmul float %93, %106
  %108 = fpext float %107 to double
  %109 = call double @llvm.fmuladd.f64(double %79, double %92, double %108)
  %110 = fmul double %76, %109
  %111 = call double @llvm.fmuladd.f64(double %43, double %74, double %110)
  %112 = fptrunc double %111 to float
  store float %112, ptr %12, align 4, !tbaa !9
  %113 = load float, ptr %12, align 4, !tbaa !9
  store float %113, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %115

114:                                              ; preds = %19, %3
  store float 0.000000e+00, ptr %4, align 4
  br label %115

115:                                              ; preds = %114, %26
  %116 = load float, ptr %4, align 4
  ret float %116
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"_ZTS12ImageContent", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}


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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5floorf(float noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef float @_Z6getLapP12ImageContentff(ptr noundef nonnull %0, float noundef %1, float noundef %2) local_unnamed_addr #1 {
  %4 = tail call noundef i32 @_ZNK12ImageContent1xEv(ptr noundef nonnull align 8 dereferenceable(80) %0)
  %5 = add i32 %4, -1
  %6 = uitofp i32 %5 to float
  %7 = fcmp ogt float %6, %1
  br i1 %7, label %8, label %55

8:                                                ; preds = %3
  %9 = tail call noundef i32 @_ZNK12ImageContent1yEv(ptr noundef nonnull align 8 dereferenceable(80) %0)
  %10 = add i32 %9, -1
  %11 = uitofp i32 %10 to float
  %12 = fcmp ogt float %11, %2
  br i1 %12, label %13, label %55

13:                                               ; preds = %8
  %14 = tail call noundef float @_ZSt5floorf(float noundef %1)
  %15 = fptosi float %14 to i32
  %16 = tail call noundef float @_ZSt5floorf(float noundef %2)
  %17 = fptosi float %16 to i32
  %18 = sitofp i32 %15 to float
  %19 = fsub float %1, %18
  %20 = sitofp i32 %17 to float
  %21 = fsub float %2, %20
  %22 = fpext float %21 to double
  %23 = fsub double 1.000000e+00, %22
  %24 = fpext float %19 to double
  %25 = fsub double 1.000000e+00, %24
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = sext i32 %17 to i64
  %29 = getelementptr inbounds ptr, ptr %27, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = sext i32 %15 to i64
  %32 = getelementptr inbounds float, ptr %30, i64 %31
  %33 = load float, ptr %32, align 4, !tbaa !12
  %34 = fpext float %33 to double
  %35 = add nsw i32 %15, 1
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds float, ptr %30, i64 %36
  %38 = load float, ptr %37, align 4, !tbaa !12
  %39 = fmul float %19, %38
  %40 = fpext float %39 to double
  %41 = tail call double @llvm.fmuladd.f64(double %25, double %34, double %40)
  %42 = getelementptr i8, ptr %29, i64 8
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = getelementptr inbounds float, ptr %43, i64 %31
  %45 = load float, ptr %44, align 4, !tbaa !12
  %46 = fpext float %45 to double
  %47 = getelementptr inbounds float, ptr %43, i64 %36
  %48 = load float, ptr %47, align 4, !tbaa !12
  %49 = fmul float %19, %48
  %50 = fpext float %49 to double
  %51 = tail call double @llvm.fmuladd.f64(double %25, double %46, double %50)
  %52 = fmul double %51, %22
  %53 = tail call double @llvm.fmuladd.f64(double %23, double %41, double %52)
  %54 = fptrunc double %53 to float
  br label %55

55:                                               ; preds = %3, %8, %13
  %.0 = phi float [ %54, %13 ], [ 0.000000e+00, %8 ], [ 0.000000e+00, %3 ]
  ret float %.0
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 16}
!6 = !{!"_ZTS12ImageContent", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass