; 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 nounwind uwtable
define dso_local noundef double @_ZNK10homography12getDetAffineEv(ptr noundef nonnull align 8 dereferenceable(72) %0) #1 align 2 {
  %2 = alloca double, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %6 = getelementptr inbounds [9 x double], ptr %5, i64 0, i64 8
  %7 = load double, ptr %6, align 8, !tbaa !9
  %8 = fcmp olt double %7, 1.000000e-04
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store double 0.000000e+00, ptr %2, align 8
  br label %34

10:                                               ; preds = %1
  %11 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %12 = getelementptr inbounds [9 x double], ptr %11, i64 0, i64 0
  %13 = load double, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %15 = getelementptr inbounds [9 x double], ptr %14, i64 0, i64 4
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %18 = getelementptr inbounds [9 x double], ptr %17, i64 0, i64 1
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %21 = getelementptr inbounds [9 x double], ptr %20, i64 0, i64 3
  %22 = load double, ptr %21, align 8, !tbaa !9
  %23 = fmul double %19, %22
  %24 = fneg double %23
  %25 = call double @llvm.fmuladd.f64(double %13, double %16, double %24)
  %26 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %27 = getelementptr inbounds [9 x double], ptr %26, i64 0, i64 8
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds %class.homography, ptr %4, i32 0, i32 0
  %30 = getelementptr inbounds [9 x double], ptr %29, i64 0, i64 8
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = fmul double %28, %31
  %33 = fdiv double %25, %32
  store double %33, ptr %2, align 8
  br label %34

34:                                               ; preds = %10, %9
  %35 = load double, ptr %2, align 8
  ret double %35
}

attributes #0 = { 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" }

!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 nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef double @_ZNK10homography12getDetAffineEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(72) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 64
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = fcmp olt double %3, 1.000000e-04
  br i1 %4, label %18, label %5

5:                                                ; preds = %1
  %6 = load double, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 24
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fneg double %10
  %14 = fmul double %12, %13
  %15 = tail call double @llvm.fmuladd.f64(double %6, double %8, double %14)
  %16 = fmul double %3, %3
  %17 = fdiv double %15, %16
  br label %18

18:                                               ; preds = %1, %5
  %.0 = phi double [ %17, %5 ], [ 0.000000e+00, %1 ]
  ret double %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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,SimplifyCFGPass,TailCallElimPass