; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/homography (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.Matrix = type { ptr, ptr, i32, i32 }

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13getScaleAngleP6MatrixRfS1_(ptr noundef %0, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %class.Matrix, ptr %13, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds ptr, ptr %15, i64 1
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds double, ptr %17, i64 1
  %19 = load double, ptr %18, align 8, !tbaa !12
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %class.Matrix, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 1
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds double, ptr %24, i64 3
  %26 = load double, ptr %25, align 8, !tbaa !12
  %27 = call double @llvm.fmuladd.f64(double 1.000000e+02, double %19, double %26)
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.Matrix, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 3
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds double, ptr %32, i64 1
  %34 = load double, ptr %33, align 8, !tbaa !12
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.Matrix, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds ptr, ptr %37, i64 3
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = getelementptr inbounds double, ptr %39, i64 3
  %41 = load double, ptr %40, align 8, !tbaa !12
  %42 = call double @llvm.fmuladd.f64(double 1.000000e+02, double %34, double %41)
  %43 = fdiv double %27, %42
  %44 = fptrunc double %43 to float
  store float %44, ptr %7, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.Matrix, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds ptr, ptr %47, i64 2
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = getelementptr inbounds double, ptr %49, i64 1
  %51 = load double, ptr %50, align 8, !tbaa !12
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %class.Matrix, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = getelementptr inbounds ptr, ptr %54, i64 2
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds double, ptr %56, i64 3
  %58 = load double, ptr %57, align 8, !tbaa !12
  %59 = call double @llvm.fmuladd.f64(double 1.000000e+02, double %51, double %58)
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %class.Matrix, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = getelementptr inbounds ptr, ptr %62, i64 3
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds double, ptr %64, i64 1
  %66 = load double, ptr %65, align 8, !tbaa !12
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %class.Matrix, ptr %67, i32 0, i32 1
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = getelementptr inbounds ptr, ptr %69, i64 3
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds double, ptr %71, i64 3
  %73 = load double, ptr %72, align 8, !tbaa !12
  %74 = call double @llvm.fmuladd.f64(double 1.000000e+02, double %66, double %73)
  %75 = fdiv double %59, %74
  %76 = fptrunc double %75 to float
  store float %76, ptr %8, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %class.Matrix, ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !9
  %80 = getelementptr inbounds ptr, ptr %79, i64 1
  %81 = load ptr, ptr %80, align 8, !tbaa !5
  %82 = getelementptr inbounds double, ptr %81, i64 3
  %83 = load double, ptr %82, align 8, !tbaa !12
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %class.Matrix, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  %87 = getelementptr inbounds ptr, ptr %86, i64 3
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = getelementptr inbounds double, ptr %88, i64 3
  %90 = load double, ptr %89, align 8, !tbaa !12
  %91 = fdiv double %83, %90
  %92 = fptrunc double %91 to float
  store float %92, ptr %9, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %class.Matrix, ptr %93, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !9
  %96 = getelementptr inbounds ptr, ptr %95, i64 2
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  %98 = getelementptr inbounds double, ptr %97, i64 3
  %99 = load double, ptr %98, align 8, !tbaa !12
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %class.Matrix, ptr %100, i32 0, i32 1
  %102 = load ptr, ptr %101, align 8, !tbaa !9
  %103 = getelementptr inbounds ptr, ptr %102, i64 3
  %104 = load ptr, ptr %103, align 8, !tbaa !5
  %105 = getelementptr inbounds double, ptr %104, i64 3
  %106 = load double, ptr %105, align 8, !tbaa !12
  %107 = fdiv double %99, %106
  %108 = fptrunc double %107 to float
  store float %108, ptr %10, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %109 = load float, ptr %7, align 4, !tbaa !14
  %110 = load float, ptr %9, align 4, !tbaa !14
  %111 = fsub float %109, %110
  store float %111, ptr %11, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %112 = load float, ptr %8, align 4, !tbaa !14
  %113 = load float, ptr %10, align 4, !tbaa !14
  %114 = fsub float %112, %113
  store float %114, ptr %12, align 4, !tbaa !14
  %115 = load float, ptr %11, align 4, !tbaa !14
  %116 = load float, ptr %11, align 4, !tbaa !14
  %117 = load float, ptr %12, align 4, !tbaa !14
  %118 = load float, ptr %12, align 4, !tbaa !14
  %119 = fmul float %117, %118
  %120 = call float @llvm.fmuladd.f32(float %115, float %116, float %119)
  %121 = call noundef float @_ZSt4sqrtf(float noundef %120)
  %122 = fpext float %121 to double
  %123 = fdiv double 1.000000e+02, %122
  %124 = call double @llvm.fabs.f64(double %123)
  %125 = fptrunc double %124 to float
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  store float %125, ptr %126, align 4, !tbaa !14
  %127 = load float, ptr %12, align 4, !tbaa !14
  %128 = load float, ptr %11, align 4, !tbaa !14
  %129 = call noundef float @_ZSt5atan2ff(float noundef %127, float noundef %128)
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  store float %129, ptr %130, align 4, !tbaa !14
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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, !6, i64 8}
!10 = !{!"_ZTS6Matrix", !6, i64 8, !11, i64 16, !11, i64 20}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4sqrtf(float noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z13getScaleAngleP6MatrixRfS1_(ptr nocapture noundef readonly %0, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = load double, ptr %8, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %7, i64 24
  %11 = load double, ptr %10, align 8, !tbaa !12
  %12 = tail call double @llvm.fmuladd.f64(double %9, double 1.000000e+02, double %11)
  %13 = getelementptr inbounds i8, ptr %5, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %14, i64 8
  %16 = load double, ptr %15, align 8, !tbaa !12
  %17 = getelementptr inbounds i8, ptr %14, i64 24
  %18 = load double, ptr %17, align 8, !tbaa !12
  %19 = tail call double @llvm.fmuladd.f64(double %16, double 1.000000e+02, double %18)
  %20 = getelementptr inbounds i8, ptr %5, i64 16
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = getelementptr inbounds i8, ptr %21, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %21, i64 24
  %25 = load double, ptr %24, align 8, !tbaa !12
  %26 = tail call double @llvm.fmuladd.f64(double %23, double 1.000000e+02, double %25)
  %27 = insertelement <2 x double> poison, double %12, i64 0
  %28 = insertelement <2 x double> %27, double %11, i64 1
  %29 = insertelement <2 x double> poison, double %19, i64 0
  %30 = insertelement <2 x double> %29, double %18, i64 1
  %31 = fdiv <2 x double> %28, %30
  %32 = fptrunc <2 x double> %31 to <2 x float>
  %33 = insertelement <2 x double> poison, double %26, i64 0
  %34 = insertelement <2 x double> %33, double %25, i64 1
  %35 = fdiv <2 x double> %34, %30
  %36 = fptrunc <2 x double> %35 to <2 x float>
  %shift = shufflevector <2 x float> %32, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %37 = fsub <2 x float> %32, %shift
  %38 = extractelement <2 x float> %37, i64 0
  %shift24 = shufflevector <2 x float> %36, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %39 = fsub <2 x float> %36, %shift24
  %40 = extractelement <2 x float> %39, i64 0
  %41 = fmul <2 x float> %39, %39
  %42 = extractelement <2 x float> %41, i64 0
  %43 = tail call float @llvm.fmuladd.f32(float %38, float %38, float %42)
  %44 = tail call noundef float @_ZSt4sqrtf(float noundef %43)
  %45 = fdiv float 1.000000e+02, %44
  %46 = tail call float @llvm.fabs.f32(float %45)
  store float %46, ptr %1, align 4, !tbaa !14
  %47 = tail call noundef float @_ZSt5atan2ff(float noundef %40, float noundef %38)
  store float %47, ptr %2, align 4, !tbaa !14
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5atan2ff(float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fabs.f32(float) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 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 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, !7, i64 8}
!6 = !{!"_ZTS6Matrix", !7, i64 8, !10, i64 16, !10, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !8, i64 0}


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