; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/matching/det_ransac (homography)

; 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.homography = type { [9 x double] }

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN10homography9getSimEigEv(ptr noundef nonnull align 8 dereferenceable(72) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %5 = getelementptr inbounds [9 x double], ptr %4, i64 0, i64 0
  %6 = load double, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %8 = getelementptr inbounds [9 x double], ptr %7, i64 0, i64 4
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %11 = getelementptr inbounds [9 x double], ptr %10, i64 0, i64 1
  %12 = load double, ptr %11, align 8, !tbaa !9
  %13 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %14 = getelementptr inbounds [9 x double], ptr %13, i64 0, i64 3
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = fmul double %12, %15
  %17 = fneg double %16
  %18 = call double @llvm.fmuladd.f64(double %6, double %9, double %17)
  %19 = call noundef double @_Z5mysqrd(double noundef %18)
  %20 = fmul double 4.000000e+00, %19
  %21 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %22 = getelementptr inbounds [9 x double], ptr %21, i64 0, i64 0
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %25 = getelementptr inbounds [9 x double], ptr %24, i64 0, i64 0
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %28 = getelementptr inbounds [9 x double], ptr %27, i64 0, i64 1
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %31 = getelementptr inbounds [9 x double], ptr %30, i64 0, i64 1
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = fmul double %29, %32
  %34 = call double @llvm.fmuladd.f64(double %23, double %26, double %33)
  %35 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %36 = getelementptr inbounds [9 x double], ptr %35, i64 0, i64 3
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %39 = getelementptr inbounds [9 x double], ptr %38, i64 0, i64 3
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = call double @llvm.fmuladd.f64(double %37, double %40, double %34)
  %42 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %43 = getelementptr inbounds [9 x double], ptr %42, i64 0, i64 4
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds %class.homography, ptr %3, i32 0, i32 0
  %46 = getelementptr inbounds [9 x double], ptr %45, i64 0, i64 4
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = call double @llvm.fmuladd.f64(double %44, double %47, double %41)
  %49 = call noundef double @_Z5mysqrd(double noundef %48)
  %50 = fdiv double %20, %49
  %51 = fsub double 1.000000e+00, %50
  ret double %51
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_Z5mysqrd(double noundef) #2

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

!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 = !{!"double", !7, i64 0}


; 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN10homography9getSimEigEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(72) %0) local_unnamed_addr #1 align 2 {
  %2 = load double, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = fneg double %6
  %10 = fmul double %8, %9
  %11 = tail call double @llvm.fmuladd.f64(double %2, double %4, double %10)
  %12 = tail call noundef double @_Z5mysqrd(double noundef %11)
  %13 = fmul double %12, 4.000000e+00
  %14 = load double, ptr %0, align 8, !tbaa !5
  %15 = load double, ptr %5, align 8, !tbaa !5
  %16 = fmul double %15, %15
  %17 = tail call double @llvm.fmuladd.f64(double %14, double %14, double %16)
  %18 = load double, ptr %7, align 8, !tbaa !5
  %19 = tail call double @llvm.fmuladd.f64(double %18, double %18, double %17)
  %20 = load double, ptr %3, align 8, !tbaa !5
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %20, double %19)
  %22 = tail call noundef double @_Z5mysqrd(double noundef %21)
  %23 = fdiv double %13, %22
  %24 = fsub double 1.000000e+00, %23
  ret double %24
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_Z5mysqrd(double noundef) local_unnamed_addr #2

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

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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