; LLVM IR from rdguez-mariano/fast_imas_IPOL :: libOrsa/homography_model.ll (ZNK4orsa15HomographyModel5ErrorERKN11libNumerics6matrixIdEEiPi)

; 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.libNumerics::vector" = type { %"class.libNumerics::matrix" }
%"class.libNumerics::matrix" = type { ptr, i32, i32, ptr }
%"class.orsa::OrsaModel" = type <{ ptr, %"class.libNumerics::matrix", %"class.libNumerics::matrix", %"class.libNumerics::matrix", %"class.libNumerics::matrix", [2 x double], i8, [7 x i8] }>
%"class.orsa::HomographyModel" = type { %"class.orsa::OrsaModel.base", i8, [6 x i8] }
%"class.orsa::OrsaModel.base" = type <{ ptr, %"class.libNumerics::matrix", %"class.libNumerics::matrix", %"class.libNumerics::matrix", %"class.libNumerics::matrix", [2 x double], i8 }>

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK4orsa15HomographyModel5ErrorERKN11libNumerics6matrixIdEEiPi(ptr noundef nonnull align 8 dereferenceable(122) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, ptr noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca %"class.libNumerics::vector", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.libNumerics::vector", align 8
  %14 = alloca %"class.libNumerics::vector", align 8
  %15 = alloca %"class.libNumerics::matrix", align 8
  %16 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %18 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  store double %18, ptr %9, align 8, !tbaa !11
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %23

21:                                               ; preds = %4
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %22, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %21, %4
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #5
  call void @_ZN11libNumerics6vectorIdEC2Ei(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 3)
  %24 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 1
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %24, i32 noundef 0, i32 noundef %25)
          to label %27 unwind label %72

27:                                               ; preds = %23
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 0)
          to label %29 unwind label %72

29:                                               ; preds = %27
  store double %26, ptr %28, align 8, !tbaa !11
  %30 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 1
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %30, i32 noundef 1, i32 noundef %31)
          to label %33 unwind label %72

33:                                               ; preds = %29
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 1)
          to label %35 unwind label %72

35:                                               ; preds = %33
  store double %32, ptr %34, align 8, !tbaa !11
  %36 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 2)
          to label %37 unwind label %72

37:                                               ; preds = %35
  store double 1.000000e+00, ptr %36, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK11libNumerics6matrixIdEmlERKNS_6vectorIdEE(ptr dead_on_unwind writable sret(%"class.libNumerics::vector") align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %38, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %39 unwind label %76

39:                                               ; preds = %37
  %40 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN11libNumerics6vectorIdEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %13)
          to label %41 unwind label %80

41:                                               ; preds = %39
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  %42 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 2)
          to label %43 unwind label %72

43:                                               ; preds = %41
  %44 = load double, ptr %42, align 8, !tbaa !11
  %45 = fcmp ogt double %44, 0.000000e+00
  br i1 %45, label %46, label %85

46:                                               ; preds = %43
  %47 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 2)
          to label %48 unwind label %72

48:                                               ; preds = %46
  %49 = load double, ptr %47, align 8, !tbaa !11
  invoke void @_ZN11libNumerics6matrixIdEdVEd(ptr noundef nonnull align 8 dereferenceable(24) %10, double noundef %49)
          to label %50 unwind label %72

50:                                               ; preds = %48
  %51 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 2
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %51, i32 noundef 0, i32 noundef %52)
          to label %54 unwind label %72

54:                                               ; preds = %50
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 0)
          to label %56 unwind label %72

56:                                               ; preds = %54
  %57 = load double, ptr %55, align 8, !tbaa !11
  %58 = fsub double %53, %57
  %59 = invoke noundef double @_ZN4orsa3sqrEd(double noundef %58)
          to label %60 unwind label %72

60:                                               ; preds = %56
  %61 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 2
  %62 = load i32, ptr %7, align 4, !tbaa !9
  %63 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %61, i32 noundef 1, i32 noundef %62)
          to label %64 unwind label %72

64:                                               ; preds = %60
  %65 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 1)
          to label %66 unwind label %72

66:                                               ; preds = %64
  %67 = load double, ptr %65, align 8, !tbaa !11
  %68 = fsub double %63, %67
  %69 = invoke noundef double @_ZN4orsa3sqrEd(double noundef %68)
          to label %70 unwind label %72

70:                                               ; preds = %66
  %71 = fadd double %59, %69
  store double %71, ptr %9, align 8, !tbaa !11
  br label %85

72:                                               ; preds = %115, %113, %108, %101, %99, %95, %93, %89, %66, %64, %60, %56, %54, %50, %48, %46, %41, %35, %33, %29, %27, %23
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %11, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %12, align 4
  br label %171

76:                                               ; preds = %37
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %11, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %12, align 4
  br label %84

80:                                               ; preds = %39
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %11, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %12, align 4
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  br label %84

84:                                               ; preds = %80, %76
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  br label %171

85:                                               ; preds = %70, %43
  %86 = getelementptr inbounds %"class.orsa::HomographyModel", ptr %17, i32 0, i32 1
  %87 = load i8, ptr %86, align 1, !tbaa !13, !range !18, !noundef !19
  %88 = trunc i8 %87 to i1
  br i1 %88, label %89, label %169

89:                                               ; preds = %85
  %90 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 2
  %91 = load i32, ptr %7, align 4, !tbaa !9
  %92 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %90, i32 noundef 0, i32 noundef %91)
          to label %93 unwind label %72

93:                                               ; preds = %89
  %94 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 0)
          to label %95 unwind label %72

95:                                               ; preds = %93
  store double %92, ptr %94, align 8, !tbaa !11
  %96 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 2
  %97 = load i32, ptr %7, align 4, !tbaa !9
  %98 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %96, i32 noundef 1, i32 noundef %97)
          to label %99 unwind label %72

99:                                               ; preds = %95
  %100 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 1)
          to label %101 unwind label %72

101:                                              ; preds = %99
  store double %98, ptr %100, align 8, !tbaa !11
  %102 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 2)
          to label %103 unwind label %72

103:                                              ; preds = %101
  store double 1.000000e+00, ptr %102, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK11libNumerics6matrixIdE3invEv(ptr dead_on_unwind writable sret(%"class.libNumerics::matrix") align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %104)
          to label %105 unwind label %148

105:                                              ; preds = %103
  invoke void @_ZNK11libNumerics6matrixIdEmlERKNS_6vectorIdEE(ptr dead_on_unwind writable sret(%"class.libNumerics::vector") align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %106 unwind label %152

106:                                              ; preds = %105
  %107 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN11libNumerics6vectorIdEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %108 unwind label %156

108:                                              ; preds = %106
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  %109 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 2)
          to label %110 unwind label %72

110:                                              ; preds = %108
  %111 = load double, ptr %109, align 8, !tbaa !11
  %112 = fcmp ogt double %111, 0.000000e+00
  br i1 %112, label %113, label %168

113:                                              ; preds = %110
  %114 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 2)
          to label %115 unwind label %72

115:                                              ; preds = %113
  %116 = load double, ptr %114, align 8, !tbaa !11
  invoke void @_ZN11libNumerics6matrixIdEdVEd(ptr noundef nonnull align 8 dereferenceable(24) %10, double noundef %116)
          to label %117 unwind label %72

117:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %118 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 1
  %119 = load i32, ptr %7, align 4, !tbaa !9
  %120 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %118, i32 noundef 0, i32 noundef %119)
          to label %121 unwind label %162

121:                                              ; preds = %117
  %122 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 0)
          to label %123 unwind label %162

123:                                              ; preds = %121
  %124 = load double, ptr %122, align 8, !tbaa !11
  %125 = fsub double %120, %124
  %126 = invoke noundef double @_ZN4orsa3sqrEd(double noundef %125)
          to label %127 unwind label %162

127:                                              ; preds = %123
  %128 = getelementptr inbounds %"class.orsa::OrsaModel", ptr %17, i32 0, i32 1
  %129 = load i32, ptr %7, align 4, !tbaa !9
  %130 = invoke noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %128, i32 noundef 1, i32 noundef %129)
          to label %131 unwind label %162

131:                                              ; preds = %127
  %132 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %10, i32 noundef 1)
          to label %133 unwind label %162

133:                                              ; preds = %131
  %134 = load double, ptr %132, align 8, !tbaa !11
  %135 = fsub double %130, %134
  %136 = invoke noundef double @_ZN4orsa3sqrEd(double noundef %135)
          to label %137 unwind label %162

137:                                              ; preds = %133
  %138 = fadd double %126, %136
  store double %138, ptr %16, align 8, !tbaa !11
  %139 = load double, ptr %16, align 8, !tbaa !11
  %140 = load double, ptr %9, align 8, !tbaa !11
  %141 = fcmp ogt double %139, %140
  br i1 %141, label %142, label %167

142:                                              ; preds = %137
  %143 = load double, ptr %16, align 8, !tbaa !11
  store double %143, ptr %9, align 8, !tbaa !11
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %166

146:                                              ; preds = %142
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %147, align 4, !tbaa !9
  br label %166

148:                                              ; preds = %103
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %11, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %12, align 4
  br label %161

152:                                              ; preds = %105
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %11, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %12, align 4
  br label %160

156:                                              ; preds = %106
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %11, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %12, align 4
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  br label %160

160:                                              ; preds = %156, %152
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #5
  br label %161

161:                                              ; preds = %160, %148
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  br label %171

162:                                              ; preds = %133, %131, %127, %123, %121, %117
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %11, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %171

166:                                              ; preds = %146, %142
  br label %167

167:                                              ; preds = %166, %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %168

168:                                              ; preds = %167, %110
  br label %169

169:                                              ; preds = %168, %85
  %170 = load double, ptr %9, align 8, !tbaa !11
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret double %170

171:                                              ; preds = %162, %161, %84, %72
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %172

172:                                              ; preds = %171
  %173 = load ptr, ptr %11, align 8
  %174 = load i32, ptr %12, align 4
  %175 = insertvalue { ptr, i32 } poison, ptr %173, 0
  %176 = insertvalue { ptr, i32 } %175, i32 %174, 1
  resume { ptr, i32 } %176
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11libNumerics6vectorIdEC2Ei(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK11libNumerics6matrixIdEmlERKNS_6vectorIdEE(ptr dead_on_unwind noalias writable sret(%"class.libNumerics::vector") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN11libNumerics6vectorIdEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11libNumerics6matrixIdEdVEd(ptr noundef nonnull align 8 dereferenceable(24), double noundef) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK11libNumerics6matrixIdE3invEv(ptr dead_on_unwind noalias writable sret(%"class.libNumerics::matrix") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { inlinehint 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 #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !17, i64 121}
!14 = !{!"_ZTSN4orsa15HomographyModelE", !15, i64 0, !17, i64 121}
!15 = !{!"_ZTSN4orsa9OrsaModelE", !16, i64 8, !16, i64 32, !16, i64 56, !16, i64 80, !7, i64 104, !17, i64 120}
!16 = !{!"_ZTSN11libNumerics6matrixIdEE", !10, i64 8, !10, i64 12, !6, i64 16}
!17 = !{!"bool", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}


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

%"class.libNumerics::vector" = type { %"class.libNumerics::matrix" }
%"class.libNumerics::matrix" = type { ptr, i32, i32, ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK4orsa15HomographyModel5ErrorERKN11libNumerics6matrixIdEEiPi(ptr noundef nonnull align 8 dereferenceable(122) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, ptr noundef writeonly %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.libNumerics::vector", align 8
  %6 = alloca %"class.libNumerics::vector", align 8
  %7 = alloca %"class.libNumerics::vector", align 8
  %8 = alloca %"class.libNumerics::matrix", align 8
  %9 = tail call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %11, label %10

10:                                               ; preds = %4
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %10, %4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  call void @_ZN11libNumerics6vectorIdEC2Ei(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 3)
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 0, i32 noundef %2)
  %14 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0)
          to label %15 unwind label %47

15:                                               ; preds = %11
  store double %13, ptr %14, align 8, !tbaa !9
  %16 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 1, i32 noundef %2)
  %17 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 1)
          to label %18 unwind label %47

18:                                               ; preds = %15
  store double %16, ptr %17, align 8, !tbaa !9
  %19 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 2)
          to label %20 unwind label %47

20:                                               ; preds = %18
  store double 1.000000e+00, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  invoke void @_ZNK11libNumerics6matrixIdEmlERKNS_6vectorIdEE(ptr dead_on_unwind nonnull writable sret(%"class.libNumerics::vector") align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %21 unwind label %49

21:                                               ; preds = %20
  %22 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN11libNumerics6vectorIdEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %23 unwind label %51

23:                                               ; preds = %21
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  %24 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 2)
          to label %25 unwind label %47

25:                                               ; preds = %23
  %26 = load double, ptr %24, align 8, !tbaa !9
  %27 = fcmp ogt double %26, 0.000000e+00
  br i1 %27, label %28, label %54

28:                                               ; preds = %25
  %29 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 2)
          to label %30 unwind label %47

30:                                               ; preds = %28
  %31 = load double, ptr %29, align 8, !tbaa !9
  invoke void @_ZN11libNumerics6matrixIdEdVEd(ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef %31)
          to label %32 unwind label %47

32:                                               ; preds = %30
  %33 = getelementptr inbounds i8, ptr %0, i64 32
  %34 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %33, i32 noundef 0, i32 noundef %2)
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0)
          to label %36 unwind label %47

36:                                               ; preds = %32
  %37 = load double, ptr %35, align 8, !tbaa !9
  %38 = fsub double %34, %37
  %39 = call noundef double @_ZN4orsa3sqrEd(double noundef %38)
  %40 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %33, i32 noundef 1, i32 noundef %2)
  %41 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 1)
          to label %42 unwind label %47

42:                                               ; preds = %36
  %43 = load double, ptr %41, align 8, !tbaa !9
  %44 = fsub double %40, %43
  %45 = call noundef double @_ZN4orsa3sqrEd(double noundef %44)
  %46 = fadd double %39, %45
  br label %54

47:                                               ; preds = %78, %76, %71, %65, %62, %58, %36, %32, %30, %28, %23, %18, %15, %11
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %107

49:                                               ; preds = %20
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %53

51:                                               ; preds = %21
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  br label %53

53:                                               ; preds = %51, %49
  %.pn = phi { ptr, i32 } [ %52, %51 ], [ %50, %49 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  br label %107

54:                                               ; preds = %42, %25
  %.0 = phi double [ %46, %42 ], [ %9, %25 ]
  %55 = getelementptr inbounds i8, ptr %0, i64 121
  %56 = load i8, ptr %55, align 1, !tbaa !11, !range !17, !noundef !18
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %58, label %106

58:                                               ; preds = %54
  %59 = getelementptr inbounds i8, ptr %0, i64 32
  %60 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %59, i32 noundef 0, i32 noundef %2)
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0)
          to label %62 unwind label %47

62:                                               ; preds = %58
  store double %60, ptr %61, align 8, !tbaa !9
  %63 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %59, i32 noundef 1, i32 noundef %2)
  %64 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 1)
          to label %65 unwind label %47

65:                                               ; preds = %62
  store double %63, ptr %64, align 8, !tbaa !9
  %66 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 2)
          to label %67 unwind label %47

67:                                               ; preds = %65
  store double 1.000000e+00, ptr %66, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #5
  invoke void @_ZNK11libNumerics6matrixIdE3invEv(ptr dead_on_unwind nonnull writable sret(%"class.libNumerics::matrix") align 8 %8, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %68 unwind label %96

68:                                               ; preds = %67
  invoke void @_ZNK11libNumerics6matrixIdEmlERKNS_6vectorIdEE(ptr dead_on_unwind nonnull writable sret(%"class.libNumerics::vector") align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %5)
          to label %69 unwind label %98

69:                                               ; preds = %68
  %70 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN11libNumerics6vectorIdEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %71 unwind label %100

71:                                               ; preds = %69
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  %72 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 2)
          to label %73 unwind label %47

73:                                               ; preds = %71
  %74 = load double, ptr %72, align 8, !tbaa !9
  %75 = fcmp ogt double %74, 0.000000e+00
  br i1 %75, label %76, label %106

76:                                               ; preds = %73
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 2)
          to label %78 unwind label %47

78:                                               ; preds = %76
  %79 = load double, ptr %77, align 8, !tbaa !9
  invoke void @_ZN11libNumerics6matrixIdEdVEd(ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef %79)
          to label %80 unwind label %47

80:                                               ; preds = %78
  %81 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 0, i32 noundef %2)
  %82 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0)
          to label %83 unwind label %104

83:                                               ; preds = %80
  %84 = load double, ptr %82, align 8, !tbaa !9
  %85 = fsub double %81, %84
  %86 = call noundef double @_ZN4orsa3sqrEd(double noundef %85)
  %87 = call noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 1, i32 noundef %2)
  %88 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 1)
          to label %89 unwind label %104

89:                                               ; preds = %83
  %90 = load double, ptr %88, align 8, !tbaa !9
  %91 = fsub double %87, %90
  %92 = call noundef double @_ZN4orsa3sqrEd(double noundef %91)
  %93 = fadd double %86, %92
  %94 = fcmp ule double %93, %.0
  %brmerge = or i1 %.not, %94
  %.0.mux = select i1 %94, double %.0, double %93
  br i1 %brmerge, label %106, label %95

95:                                               ; preds = %89
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %106

96:                                               ; preds = %67
  %97 = landingpad { ptr, i32 }
          cleanup
  br label %103

98:                                               ; preds = %68
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %102

100:                                              ; preds = %69
  %101 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  br label %102

102:                                              ; preds = %100, %98
  %.pn31 = phi { ptr, i32 } [ %101, %100 ], [ %99, %98 ]
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  br label %103

103:                                              ; preds = %102, %96
  %.pn31.pn = phi { ptr, i32 } [ %.pn31, %102 ], [ %97, %96 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  br label %107

104:                                              ; preds = %83, %80
  %105 = landingpad { ptr, i32 }
          cleanup
  br label %107

106:                                              ; preds = %95, %89, %73, %54
  %.2 = phi double [ %.0, %73 ], [ %.0, %54 ], [ %93, %95 ], [ %.0.mux, %89 ]
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  ret double %.2

107:                                              ; preds = %104, %103, %53, %47
  %.pn34 = phi { ptr, i32 } [ %105, %104 ], [ %48, %47 ], [ %.pn31.pn, %103 ], [ %.pn, %53 ]
  call void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  resume { ptr, i32 } %.pn34
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11libNumerics6vectorIdEC2Ei(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK11libNumerics6matrixIdEclEii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN11libNumerics6matrixIdEclEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK11libNumerics6matrixIdEmlERKNS_6vectorIdEE(ptr dead_on_unwind noalias writable sret(%"class.libNumerics::vector") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN11libNumerics6vectorIdEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11libNumerics6matrixIdED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN11libNumerics6matrixIdEdVEd(ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK11libNumerics6matrixIdE3invEv(ptr dead_on_unwind noalias writable sret(%"class.libNumerics::matrix") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { inlinehint 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !16, i64 121}
!12 = !{!"_ZTSN4orsa15HomographyModelE", !13, i64 0, !16, i64 121}
!13 = !{!"_ZTSN4orsa9OrsaModelE", !14, i64 8, !14, i64 32, !14, i64 56, !14, i64 80, !7, i64 104, !16, i64 120}
!14 = !{!"_ZTSN11libNumerics6matrixIdEE", !6, i64 8, !6, i64 12, !15, i64 16}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}


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