; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes (R2Align)

; 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.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }
%class.R2Point = type { [2 x double] }
%class.R2Diad = type { [2 x %class.R2Vector] }
%class.R2Vector = type { [2 x double] }

@RN_EPSILON = external global double, align 8
@R2identity_affine = external global %class.R2Affine, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10R2CentroidRK7RNArrayIP7R2PointEPKd(ptr dead_on_unwind noalias writable sret(%class.R2Point) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #0

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

; 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 @_Z15R2PrincipleAxesRK7R2PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind noalias writable sret(%class.R2Diad) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7R2Point6VectorEv(ptr dead_on_unwind noalias writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z17R2AverageDistanceRK7R2PointRK7RNArrayIPS_EPKd(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z29R2NormalizationTransformationRK7RNArrayIP7R2PointEiii(ptr dead_on_unwind noalias writable sret(%class.R2Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i1, align 1
  %12 = alloca %class.R2Point, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.R2Vector, align 8
  %16 = alloca double, align 8
  %17 = alloca [3 x double], align 16
  %18 = alloca %class.R2Diad, align 8
  %19 = alloca %class.R2Affine, align 8
  %20 = alloca %class.R3Matrix, align 8
  %21 = alloca %class.R2Affine, align 8
  %22 = alloca %class.R3Matrix, align 8
  %23 = alloca %class.R2Vector, align 8
  %24 = alloca %class.R2Vector, align 8
  store ptr %0, ptr %6, align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  store i1 false, ptr %11, align 1
  call void @_ZN8R2AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) @R2identity_affine)
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_Z10R2CentroidRK7RNArrayIP7R2PointEPKd(ptr dead_on_unwind writable sret(%class.R2Point) align 8 %12, ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef null)
          to label %26 unwind label %32

26:                                               ; preds = %5
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %40, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #7
  invoke void @_ZNK7R2Point6VectorEv(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %15, ptr noundef nonnull align 8 dereferenceable(16) %12)
          to label %30 unwind label %36

30:                                               ; preds = %29
  invoke void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %31 unwind label %36

31:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %40

32:                                               ; preds = %5
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %13, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %14, align 4
  br label %138

36:                                               ; preds = %30, %29
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %13, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #7
  br label %138

40:                                               ; preds = %31, %26
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %64

43:                                               ; preds = %40
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = icmp ne i32 %44, 2
  br i1 %45, label %46, label %64

46:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = invoke noundef double @_Z17R2AverageDistanceRK7R2PointRK7RNArrayIPS_EPKd(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %47, ptr noundef null)
          to label %49 unwind label %59

49:                                               ; preds = %46
  store double %48, ptr %16, align 8, !tbaa !11
  %50 = load double, ptr %16, align 8, !tbaa !11
  %51 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %52 = invoke noundef i32 @_Z12RNIsPositivedd(double noundef %50, double noundef %51)
          to label %53 unwind label %59

53:                                               ; preds = %49
  %54 = icmp ne i32 %52, 0
  br i1 %54, label %55, label %63

55:                                               ; preds = %53
  %56 = load double, ptr %16, align 8, !tbaa !11
  %57 = fdiv double 1.000000e+00, %56
  invoke void @_ZN8R2Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(84) %0, double noundef %57)
          to label %58 unwind label %59

58:                                               ; preds = %55
  br label %63

59:                                               ; preds = %55, %49, %46
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %13, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %138

63:                                               ; preds = %58, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %64

64:                                               ; preds = %63, %43, %40
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = icmp eq i32 %68, 2
  br i1 %69, label %70, label %129

70:                                               ; preds = %67, %64
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  call void @llvm.memset.p0.i64(ptr align 16 %17, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #7
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  invoke void @_Z15R2PrincipleAxesRK7R2PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind writable sret(%class.R2Diad) align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(16) %71, ptr noundef %72, ptr noundef null)
          to label %73 unwind label %80

73:                                               ; preds = %70
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %93, label %76

76:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 88, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 72, ptr %20) #7
  invoke void @_ZNK6R2Diad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R3Matrix) align 8 %20, ptr noundef nonnull align 8 dereferenceable(32) %18)
          to label %77 unwind label %84

77:                                               ; preds = %76
  invoke void @_ZN8R2AffineC1ERK8R3Matrixi(ptr noundef nonnull align 8 dereferenceable(84) %19, ptr noundef nonnull align 8 dereferenceable(72) %20, i32 noundef 0)
          to label %78 unwind label %84

78:                                               ; preds = %77
  invoke void @_ZN8R2Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) %19)
          to label %79 unwind label %88

79:                                               ; preds = %78
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %19) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %19) #7
  br label %93

80:                                               ; preds = %109, %100, %70
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %13, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %14, align 4
  br label %128

84:                                               ; preds = %77, %76
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %13, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %14, align 4
  br label %92

88:                                               ; preds = %78
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %13, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %14, align 4
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %19) #7
  br label %92

92:                                               ; preds = %88, %84
  call void @llvm.lifetime.end.p0(i64 72, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %19) #7
  br label %128

93:                                               ; preds = %79, %73
  %94 = load i32, ptr %10, align 4, !tbaa !9
  %95 = icmp eq i32 %94, 2
  br i1 %95, label %96, label %115

96:                                               ; preds = %93
  %97 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %98 = load double, ptr %97, align 16, !tbaa !11
  %99 = fcmp ogt double %98, 0.000000e+00
  br i1 %99, label %100, label %105

100:                                              ; preds = %96
  %101 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %102 = load double, ptr %101, align 16, !tbaa !11
  %103 = fdiv double 1.000000e+00, %102
  invoke void @_ZN8R2Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(84) %0, double noundef %103)
          to label %104 unwind label %80

104:                                              ; preds = %100
  br label %105

105:                                              ; preds = %104, %96
  %106 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 1
  %107 = load double, ptr %106, align 8, !tbaa !11
  %108 = fcmp ogt double %107, 0.000000e+00
  br i1 %108, label %109, label %114

109:                                              ; preds = %105
  %110 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 1
  %111 = load double, ptr %110, align 8, !tbaa !11
  %112 = fdiv double 1.000000e+00, %111
  invoke void @_ZN8R2Affine6YScaleEd(ptr noundef nonnull align 8 dereferenceable(84) %0, double noundef %112)
          to label %113 unwind label %80

113:                                              ; preds = %109
  br label %114

114:                                              ; preds = %113, %105
  br label %115

115:                                              ; preds = %114, %93
  call void @llvm.lifetime.start.p0(i64 88, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 72, ptr %22) #7
  invoke void @_ZNK6R2Diad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R3Matrix) align 8 %22, ptr noundef nonnull align 8 dereferenceable(32) %18)
          to label %116 unwind label %119

116:                                              ; preds = %115
  invoke void @_ZN8R2AffineC1ERK8R3Matrixi(ptr noundef nonnull align 8 dereferenceable(84) %21, ptr noundef nonnull align 8 dereferenceable(72) %22, i32 noundef 0)
          to label %117 unwind label %119

117:                                              ; preds = %116
  invoke void @_ZN8R2Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) %21)
          to label %118 unwind label %123

118:                                              ; preds = %117
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %21) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  br label %129

119:                                              ; preds = %116, %115
  %120 = landingpad { ptr, i32 }
          cleanup
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %13, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %14, align 4
  br label %127

123:                                              ; preds = %117
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %13, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %14, align 4
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %21) #7
  br label %127

127:                                              ; preds = %123, %119
  call void @llvm.lifetime.end.p0(i64 72, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr %21) #7
  br label %128

128:                                              ; preds = %127, %92, %80
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  br label %138

129:                                              ; preds = %118, %67
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #7
  invoke void @_ZNK7R2Point6VectorEv(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %24, ptr noundef nonnull align 8 dereferenceable(16) %12)
          to label %130 unwind label %134

130:                                              ; preds = %129
  invoke void @_ZngRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Vector) align 8 %23, ptr noundef nonnull align 8 dereferenceable(16) %24)
          to label %131 unwind label %134

131:                                              ; preds = %130
  invoke void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(16) %23)
          to label %132 unwind label %134

132:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #7
  store i1 true, ptr %11, align 1
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  %133 = load i1, ptr %11, align 1
  br i1 %133, label %140, label %139

134:                                              ; preds = %131, %130, %129
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %13, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #7
  br label %138

138:                                              ; preds = %134, %128, %59, %36, %32
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %0) #7
  br label %141

139:                                              ; preds = %132
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %0) #7
  br label %140

140:                                              ; preds = %139, %132
  ret void

141:                                              ; preds = %138
  %142 = load ptr, ptr %13, align 8
  %143 = load i32, ptr %14, align 4
  %144 = insertvalue { ptr, i32 } poison, ptr %142, 0
  %145 = insertvalue { ptr, i32 } %144, i32 %143, 1
  resume { ptr, i32 } %145
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(84), double noundef) #4 align 2

declare void @_ZN8R2Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) #5

declare void @_ZNK6R2Diad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R3Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(32)) #5

declare void @_ZN8R2AffineC1ERK8R3Matrixi(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) unnamed_addr #5

; Function Attrs: nounwind
declare void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(84), double noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine6YScaleEd(ptr noundef nonnull align 8 dereferenceable(84), double noundef) #4 align 2

declare void @_ZngRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16)) #5

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 "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 #7 = { 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}


; 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.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }
%class.R2Point = type { [2 x double] }
%class.R2Diad = type { [2 x %class.R2Vector] }
%class.R2Vector = type { [2 x double] }

@RN_EPSILON = external local_unnamed_addr global double, align 8
@R2identity_affine = external global %class.R2Affine, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10R2CentroidRK7RNArrayIP7R2PointEPKd(ptr dead_on_unwind noalias writable sret(%class.R2Point) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #0

; 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 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 @_Z15R2PrincipleAxesRK7R2PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind noalias writable sret(%class.R2Diad) align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7R2Point6VectorEv(ptr dead_on_unwind noalias writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z17R2AverageDistanceRK7R2PointRK7RNArrayIPS_EPKd(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z29R2NormalizationTransformationRK7RNArrayIP7R2PointEiii(ptr dead_on_unwind noalias nonnull writable sret(%class.R2Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.R2Point, align 8
  %7 = alloca %class.R2Vector, align 8
  %8 = alloca [3 x double], align 16
  %9 = alloca %class.R2Diad, align 8
  %10 = alloca %class.R2Affine, align 8
  %11 = alloca %class.R3Matrix, align 8
  %12 = alloca %class.R2Affine, align 8
  %13 = alloca %class.R3Matrix, align 8
  %14 = alloca %class.R2Vector, align 8
  %15 = alloca %class.R2Vector, align 8
  tail call void @_ZN8R2AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) @R2identity_affine)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  invoke void @_Z10R2CentroidRK7RNArrayIP7R2PointEPKd(ptr dead_on_unwind nonnull writable sret(%class.R2Point) align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef null)
          to label %16 unwind label %20

16:                                               ; preds = %5
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %17, label %24

17:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  invoke void @_ZNK7R2Point6VectorEv(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %18 unwind label %22

18:                                               ; preds = %17
  invoke void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %19 unwind label %22

19:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  br label %24

20:                                               ; preds = %5
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %79

22:                                               ; preds = %18, %17
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  br label %79

24:                                               ; preds = %19, %16
  %25 = and i32 %4, -3
  %or.cond.not = icmp eq i32 %25, 0
  br i1 %or.cond.not, label %35, label %26

26:                                               ; preds = %24
  %27 = invoke noundef double @_Z17R2AverageDistanceRK7R2PointRK7RNArrayIPS_EPKd(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef null)
          to label %28 unwind label %33

28:                                               ; preds = %26
  %29 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %30 = call noundef i32 @_Z12RNIsPositivedd(double noundef %27, double noundef %29)
  %.not23 = icmp eq i32 %30, 0
  br i1 %.not23, label %35, label %31

31:                                               ; preds = %28
  %32 = fdiv double 1.000000e+00, %27
  invoke void @_ZN8R2Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(84) %0, double noundef %32)
          to label %35 unwind label %33

33:                                               ; preds = %31, %26
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %79

35:                                               ; preds = %28, %31, %24
  %36 = icmp ne i32 %3, 0
  %37 = icmp eq i32 %4, 2
  %or.cond3 = or i1 %36, %37
  br i1 %or.cond3, label %38, label %73

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(24) %8, i8 0, i64 24, i1 false)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %9) #7
  invoke void @_Z15R2PrincipleAxesRK7R2PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind nonnull writable sret(%class.R2Diad) align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %8, ptr noundef null)
          to label %39 unwind label %44

39:                                               ; preds = %38
  br i1 %36, label %51, label %40

40:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %11) #7
  invoke void @_ZNK6R2Diad13InverseMatrixEv(ptr dead_on_unwind nonnull writable sret(%class.R3Matrix) align 8 %11, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %41 unwind label %46

41:                                               ; preds = %40
  invoke void @_ZN8R2AffineC1ERK8R3Matrixi(ptr noundef nonnull align 8 dereferenceable(84) %10, ptr noundef nonnull align 8 dereferenceable(72) %11, i32 noundef 0)
          to label %42 unwind label %46

42:                                               ; preds = %41
  invoke void @_ZN8R2Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) %10)
          to label %43 unwind label %48

43:                                               ; preds = %42
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %10) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %10) #7
  br label %51

44:                                               ; preds = %61, %55, %38
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %72

46:                                               ; preds = %41, %40
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %50

48:                                               ; preds = %42
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %10) #7
  br label %50

50:                                               ; preds = %48, %46
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %47, %46 ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %10) #7
  br label %72

51:                                               ; preds = %43, %39
  br i1 %37, label %52, label %63

52:                                               ; preds = %51
  %53 = load double, ptr %8, align 16, !tbaa !5
  %54 = fcmp ogt double %53, 0.000000e+00
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = fdiv double 1.000000e+00, %53
  invoke void @_ZN8R2Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(84) %0, double noundef %56)
          to label %57 unwind label %44

57:                                               ; preds = %55, %52
  %58 = getelementptr inbounds i8, ptr %8, i64 8
  %59 = load double, ptr %58, align 8, !tbaa !5
  %60 = fcmp ogt double %59, 0.000000e+00
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = fdiv double 1.000000e+00, %59
  invoke void @_ZN8R2Affine6YScaleEd(ptr noundef nonnull align 8 dereferenceable(84) %0, double noundef %62)
          to label %63 unwind label %44

63:                                               ; preds = %57, %61, %51
  call void @llvm.lifetime.start.p0(i64 88, ptr nonnull %12) #7
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %13) #7
  invoke void @_ZNK6R2Diad13InverseMatrixEv(ptr dead_on_unwind nonnull writable sret(%class.R3Matrix) align 8 %13, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %64 unwind label %67

64:                                               ; preds = %63
  invoke void @_ZN8R2AffineC1ERK8R3Matrixi(ptr noundef nonnull align 8 dereferenceable(84) %12, ptr noundef nonnull align 8 dereferenceable(72) %13, i32 noundef 0)
          to label %65 unwind label %67

65:                                               ; preds = %64
  invoke void @_ZN8R2Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(84) %12)
          to label %66 unwind label %69

66:                                               ; preds = %65
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %12) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  br label %73

67:                                               ; preds = %64, %63
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %71

69:                                               ; preds = %65
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %12) #7
  br label %71

71:                                               ; preds = %69, %67
  %.pn25 = phi { ptr, i32 } [ %70, %69 ], [ %68, %67 ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 88, ptr nonnull %12) #7
  br label %72

72:                                               ; preds = %71, %50, %44
  %.pn25.pn = phi { ptr, i32 } [ %.pn25, %71 ], [ %45, %44 ], [ %.pn, %50 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  br label %79

73:                                               ; preds = %35, %66
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #7
  invoke void @_ZNK7R2Point6VectorEv(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %15, ptr noundef nonnull align 8 dereferenceable(16) %6)
          to label %74 unwind label %77

74:                                               ; preds = %73
  invoke void @_ZngRK8R2Vector(ptr dead_on_unwind nonnull writable sret(%class.R2Vector) align 8 %14, ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %75 unwind label %77

75:                                               ; preds = %74
  invoke void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84) %0, ptr noundef nonnull align 8 dereferenceable(16) %14)
          to label %76 unwind label %77

76:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  ret void

77:                                               ; preds = %75, %74, %73
  %78 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #7
  br label %79

79:                                               ; preds = %77, %72, %33, %22, %20
  %.pn28 = phi { ptr, i32 } [ %78, %77 ], [ %.pn25.pn, %72 ], [ %34, %33 ], [ %23, %22 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(84) %0) #7
  resume { ptr, i32 } %.pn28
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine9TranslateERK8R2Vector(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(84), double noundef) local_unnamed_addr #4 align 2

declare void @_ZN8R2Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(84)) local_unnamed_addr #5

declare void @_ZNK6R2Diad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R3Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #5

declare void @_ZN8R2AffineC1ERK8R3Matrixi(ptr noundef nonnull align 8 dereferenceable(84), ptr noundef nonnull align 8 dereferenceable(72), i32 noundef) unnamed_addr #5

; Function Attrs: nounwind
declare void @_ZN16R2TransformationD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(84), double noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R2Affine6YScaleEd(ptr noundef nonnull align 8 dereferenceable(84), double noundef) local_unnamed_addr #4 align 2

declare void @_ZngRK8R2Vector(ptr dead_on_unwind writable sret(%class.R2Vector) align 8, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5

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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 "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 #7 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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