; 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 @_ZNK6Corner4getXEv(ptr noundef nonnull align 4 dereferenceable(88)) #2 align 2

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4fabsf(float noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z9checkEpipP16CornerDescriptorS0_P6MatrixfRf(ptr noundef %0, ptr noundef %1, ptr noundef %2, float noundef %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #3 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store float %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %17 = call noalias noundef nonnull ptr @_Znam(i64 noundef 12) #7
  store ptr %17, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %18 = call noalias noundef nonnull ptr @_Znam(i64 noundef 12) #7
  store ptr %18, ptr %13, align 8, !tbaa !5
  %19 = load ptr, ptr %13, align 8, !tbaa !5
  %20 = getelementptr inbounds float, ptr %19, i64 0
  store float 0.000000e+00, ptr %20, align 4, !tbaa !9
  %21 = load ptr, ptr %13, align 8, !tbaa !5
  %22 = getelementptr inbounds float, ptr %21, i64 1
  store float 0.000000e+00, ptr %22, align 4, !tbaa !9
  %23 = load ptr, ptr %13, align 8, !tbaa !5
  %24 = getelementptr inbounds float, ptr %23, i64 2
  store float 0.000000e+00, ptr %24, align 4, !tbaa !9
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = call noundef float @_ZNK6Corner4getXEv(ptr noundef nonnull align 4 dereferenceable(88) %25)
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = getelementptr inbounds float, ptr %27, i64 0
  store float %26, ptr %28, align 4, !tbaa !9
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = call noundef float @_ZNK6Corner4getYEv(ptr noundef nonnull align 4 dereferenceable(88) %29)
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds float, ptr %31, i64 1
  store float %30, ptr %32, align 4, !tbaa !9
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = getelementptr inbounds float, ptr %33, i64 2
  store float 1.000000e+00, ptr %34, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %76, %5
  %36 = load i32, ptr %14, align 4, !tbaa !11
  %37 = icmp slt i32 %36, 3
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %79

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %40

40:                                               ; preds = %72, %39
  %41 = load i32, ptr %16, align 4, !tbaa !11
  %42 = icmp slt i32 %41, 3
  br i1 %42, label %44, label %43

43:                                               ; preds = %40
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %75

44:                                               ; preds = %40
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds %class.Matrix, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = load i32, ptr %14, align 4, !tbaa !11
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds ptr, ptr %47, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = load i32, ptr %16, align 4, !tbaa !11
  %54 = add nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds double, ptr %52, i64 %55
  %57 = load double, ptr %56, align 8, !tbaa !15
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = load i32, ptr %16, align 4, !tbaa !11
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds float, ptr %58, i64 %60
  %62 = load float, ptr %61, align 4, !tbaa !9
  %63 = fpext float %62 to double
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = load i32, ptr %14, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds float, ptr %64, i64 %66
  %68 = load float, ptr %67, align 4, !tbaa !9
  %69 = fpext float %68 to double
  %70 = call double @llvm.fmuladd.f64(double %57, double %63, double %69)
  %71 = fptrunc double %70 to float
  store float %71, ptr %67, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %44
  %73 = load i32, ptr %16, align 4, !tbaa !11
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %16, align 4, !tbaa !11
  br label %40, !llvm.loop !17

75:                                               ; preds = %43
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %14, align 4, !tbaa !11
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %14, align 4, !tbaa !11
  br label %35, !llvm.loop !19

79:                                               ; preds = %38
  %80 = load ptr, ptr %13, align 8, !tbaa !5
  %81 = getelementptr inbounds float, ptr %80, i64 0
  %82 = load float, ptr %81, align 4, !tbaa !9
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = call noundef float @_ZNK6Corner4getXEv(ptr noundef nonnull align 4 dereferenceable(88) %83)
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds float, ptr %85, i64 1
  %87 = load float, ptr %86, align 4, !tbaa !9
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = call noundef float @_ZNK6Corner4getYEv(ptr noundef nonnull align 4 dereferenceable(88) %88)
  %90 = fmul float %87, %89
  %91 = call float @llvm.fmuladd.f32(float %82, float %84, float %90)
  %92 = load ptr, ptr %13, align 8, !tbaa !5
  %93 = getelementptr inbounds float, ptr %92, i64 2
  %94 = load float, ptr %93, align 4, !tbaa !9
  %95 = fadd float %91, %94
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = getelementptr inbounds float, ptr %96, i64 0
  %98 = load float, ptr %97, align 4, !tbaa !9
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = getelementptr inbounds float, ptr %99, i64 0
  %101 = load float, ptr %100, align 4, !tbaa !9
  %102 = load ptr, ptr %13, align 8, !tbaa !5
  %103 = getelementptr inbounds float, ptr %102, i64 1
  %104 = load float, ptr %103, align 4, !tbaa !9
  %105 = load ptr, ptr %13, align 8, !tbaa !5
  %106 = getelementptr inbounds float, ptr %105, i64 1
  %107 = load float, ptr %106, align 4, !tbaa !9
  %108 = fmul float %104, %107
  %109 = call float @llvm.fmuladd.f32(float %98, float %101, float %108)
  %110 = call noundef float @_ZSt4sqrtf(float noundef %109)
  %111 = fdiv float %95, %110
  %112 = call noundef float @_ZSt4fabsf(float noundef %111)
  %113 = load ptr, ptr %11, align 8, !tbaa !5
  store float %112, ptr %113, align 4, !tbaa !9
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = icmp eq ptr %114, null
  br i1 %115, label %117, label %116

116:                                              ; preds = %79
  call void @_ZdaPv(ptr noundef %114) #8
  br label %117

117:                                              ; preds = %116, %79
  %118 = load ptr, ptr %13, align 8, !tbaa !5
  %119 = icmp eq ptr %118, null
  br i1 %119, label %121, label %120

120:                                              ; preds = %117
  call void @_ZdaPv(ptr noundef %118) #8
  br label %121

121:                                              ; preds = %120, %117
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  %123 = load float, ptr %122, align 4, !tbaa !9
  %124 = load float, ptr %10, align 4, !tbaa !9
  %125 = fcmp olt float %123, %124
  br i1 %125, label %126, label %127

126:                                              ; preds = %121
  store i32 1, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %128

127:                                              ; preds = %121
  store i32 0, ptr %6, align 4
  store i32 1, ptr %15, align 4
  br label %128

128:                                              ; preds = %127, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %129 = load i32, ptr %6, align 4
  ret i32 %129
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #5

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 = { nobuiltin allocsize(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 = { nobuiltin nounwind "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 }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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 8}
!14 = !{!"_ZTS6Matrix", !6, i64 8, !12, i64 16, !12, i64 20}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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 @_ZNK6Corner4getXEv(ptr noundef nonnull align 4 dereferenceable(88)) local_unnamed_addr #1 align 2

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4fabsf(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z9checkEpipP16CornerDescriptorS0_P6MatrixfRf(ptr noundef nonnull %0, ptr noundef %1, ptr nocapture noundef readonly %2, float noundef %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %4) local_unnamed_addr #2 {
.preheader:
  %5 = tail call noundef float @_ZNK6Corner4getXEv(ptr noundef nonnull align 4 dereferenceable(88) %0)
  %6 = tail call noundef float @_ZNK6Corner4getYEv(ptr noundef nonnull align 4 dereferenceable(88) %0)
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %invariant.gep = getelementptr inbounds i8, ptr %8, i64 8
  %9 = load ptr, ptr %invariant.gep, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !12
  %12 = fpext float %5 to double
  %13 = tail call double @llvm.fmuladd.f64(double %11, double %12, double 0.000000e+00)
  %14 = fptrunc double %13 to float
  %15 = getelementptr inbounds i8, ptr %9, i64 16
  %16 = load double, ptr %15, align 8, !tbaa !12
  %17 = fpext float %6 to double
  %18 = fpext float %14 to double
  %19 = tail call double @llvm.fmuladd.f64(double %16, double %17, double %18)
  %20 = fptrunc double %19 to float
  %21 = getelementptr inbounds i8, ptr %9, i64 24
  %22 = load double, ptr %21, align 8, !tbaa !12
  %23 = fpext float %20 to double
  %24 = fadd double %22, %23
  %25 = fptrunc double %24 to float
  %gep.1 = getelementptr inbounds i8, ptr %8, i64 16
  %26 = load ptr, ptr %gep.1, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %26, i64 8
  %28 = load double, ptr %27, align 8, !tbaa !12
  %29 = tail call double @llvm.fmuladd.f64(double %28, double %12, double 0.000000e+00)
  %30 = fptrunc double %29 to float
  %31 = getelementptr inbounds i8, ptr %26, i64 16
  %32 = load double, ptr %31, align 8, !tbaa !12
  %33 = fpext float %30 to double
  %34 = tail call double @llvm.fmuladd.f64(double %32, double %17, double %33)
  %35 = fptrunc double %34 to float
  %36 = getelementptr inbounds i8, ptr %26, i64 24
  %37 = load double, ptr %36, align 8, !tbaa !12
  %38 = fpext float %35 to double
  %39 = fadd double %37, %38
  %40 = fptrunc double %39 to float
  %gep.2 = getelementptr inbounds i8, ptr %8, i64 24
  %41 = load ptr, ptr %gep.2, align 8, !tbaa !11
  %42 = getelementptr inbounds i8, ptr %41, i64 8
  %43 = load double, ptr %42, align 8, !tbaa !12
  %44 = tail call double @llvm.fmuladd.f64(double %43, double %12, double 0.000000e+00)
  %45 = fptrunc double %44 to float
  %46 = getelementptr inbounds i8, ptr %41, i64 16
  %47 = load double, ptr %46, align 8, !tbaa !12
  %48 = fpext float %45 to double
  %49 = tail call double @llvm.fmuladd.f64(double %47, double %17, double %48)
  %50 = fptrunc double %49 to float
  %51 = getelementptr inbounds i8, ptr %41, i64 24
  %52 = load double, ptr %51, align 8, !tbaa !12
  %53 = fpext float %50 to double
  %54 = fadd double %52, %53
  %55 = fptrunc double %54 to float
  %56 = tail call noundef float @_ZNK6Corner4getXEv(ptr noundef nonnull align 4 dereferenceable(88) %1)
  %57 = tail call noundef float @_ZNK6Corner4getYEv(ptr noundef nonnull align 4 dereferenceable(88) %1)
  %58 = fmul float %57, %40
  %59 = tail call float @llvm.fmuladd.f32(float %25, float %56, float %58)
  %60 = fadd float %59, %55
  %61 = fmul float %40, %40
  %62 = tail call float @llvm.fmuladd.f32(float %25, float %25, float %61)
  %63 = tail call noundef float @_ZSt4sqrtf(float noundef %62)
  %64 = fdiv float %60, %63
  %65 = tail call noundef float @_ZSt4fabsf(float noundef %64)
  store float %65, ptr %4, align 4, !tbaa !14
  %66 = fcmp olt float %65, %3
  %.034 = zext i1 %66 to i32
  ret i32 %.034
}

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

!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: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass