; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Mesh.ll (ZNK6R3Mesh30PCANormalizationTransformationEiii)

; 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.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }
%class.R3Point = type { [3 x double] }
%class.R3Triad = type { [3 x %class.R3Vector] }
%class.R3Vector = type { [3 x double] }

@R3identity_affine = external global %class.R3Affine, align 8
@RN_EPSILON = external global double, align 8

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress uwtable
declare dso_local void @_ZNK6R3Mesh8CentroidEv(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(272)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Mesh13AverageRadiusEPK7R3Point(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6R3Mesh13PrincipleAxesEPK7R3PointPd(ptr dead_on_unwind noalias writable sret(%class.R3Triad) align 8, ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Mesh30PCANormalizationTransformationEiii(ptr dead_on_unwind noalias writable sret(%class.R3Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(272) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #1 align 2 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.R3Point, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.R3Vector, align 8
  %16 = alloca double, align 8
  %17 = alloca [3 x double], align 16
  %18 = alloca %class.R3Triad, align 8
  %19 = alloca %class.R3Affine, align 8
  %20 = alloca %class.R4Matrix, align 8
  %21 = alloca %class.R3Affine, align 8
  %22 = alloca %class.R4Matrix, align 8
  %23 = alloca %class.R3Vector, align 8
  %24 = alloca %class.R3Vector, 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
  %25 = load ptr, ptr %7, align 8
  store i1 false, ptr %11, align 1
  call void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) @R3identity_affine)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  invoke void @_ZNK6R3Mesh8CentroidEv(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %12, ptr noundef nonnull align 8 dereferenceable(272) %25)
          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 24, ptr %15) #6
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %30 unwind label %36

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

31:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  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 %145

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 24, ptr %15) #6
  br label %145

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 %63

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

46:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %47 = invoke noundef double @_ZNK6R3Mesh13AverageRadiusEPK7R3Point(ptr noundef nonnull align 8 dereferenceable(272) %25, ptr noundef %12)
          to label %48 unwind label %58

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

52:                                               ; preds = %48
  %53 = icmp ne i32 %51, 0
  br i1 %53, label %54, label %62

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

57:                                               ; preds = %54
  br label %62

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

62:                                               ; preds = %57, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %63

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

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

69:                                               ; preds = %66, %63
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 72, ptr %18) #6
  %70 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  invoke void @_ZNK6R3Mesh13PrincipleAxesEPK7R3PointPd(ptr dead_on_unwind writable sret(%class.R3Triad) align 8 %18, ptr noundef nonnull align 8 dereferenceable(272) %25, ptr noundef %12, ptr noundef %70)
          to label %71 unwind label %78

71:                                               ; preds = %69
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %91, label %74

74:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 272, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr %20) #6
  invoke void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R4Matrix) align 8 %20, ptr noundef nonnull align 8 dereferenceable(72) %18)
          to label %75 unwind label %82

75:                                               ; preds = %74
  invoke void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %19, ptr noundef nonnull align 8 dereferenceable(128) %20, i32 noundef 0)
          to label %76 unwind label %82

76:                                               ; preds = %75
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) %19)
          to label %77 unwind label %86

77:                                               ; preds = %76
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %19) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr %19) #6
  br label %91

78:                                               ; preds = %116, %107, %98, %69
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %13, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %14, align 4
  br label %135

82:                                               ; preds = %75, %74
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %13, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %14, align 4
  br label %90

86:                                               ; preds = %76
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %13, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %14, align 4
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %19) #6
  br label %90

90:                                               ; preds = %86, %82
  call void @llvm.lifetime.end.p0(i64 128, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr %19) #6
  br label %135

91:                                               ; preds = %77, %71
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = icmp eq i32 %92, 2
  br i1 %93, label %94, label %122

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

98:                                               ; preds = %94
  %99 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %100 = load double, ptr %99, align 16, !tbaa !11
  %101 = fdiv double 1.000000e+00, %100
  invoke void @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %101)
          to label %102 unwind label %78

102:                                              ; preds = %98
  br label %103

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

107:                                              ; preds = %103
  %108 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 1
  %109 = load double, ptr %108, align 8, !tbaa !11
  %110 = fdiv double 1.000000e+00, %109
  invoke void @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %110)
          to label %111 unwind label %78

111:                                              ; preds = %107
  br label %112

112:                                              ; preds = %111, %103
  %113 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 2
  %114 = load double, ptr %113, align 16, !tbaa !11
  %115 = fcmp ogt double %114, 0.000000e+00
  br i1 %115, label %116, label %121

116:                                              ; preds = %112
  %117 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 2
  %118 = load double, ptr %117, align 16, !tbaa !11
  %119 = fdiv double 1.000000e+00, %118
  invoke void @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %119)
          to label %120 unwind label %78

120:                                              ; preds = %116
  br label %121

121:                                              ; preds = %120, %112
  br label %122

122:                                              ; preds = %121, %91
  call void @llvm.lifetime.start.p0(i64 272, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr %22) #6
  invoke void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R4Matrix) align 8 %22, ptr noundef nonnull align 8 dereferenceable(72) %18)
          to label %123 unwind label %126

123:                                              ; preds = %122
  invoke void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef nonnull align 8 dereferenceable(128) %22, i32 noundef 0)
          to label %124 unwind label %126

124:                                              ; preds = %123
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) %21)
          to label %125 unwind label %130

125:                                              ; preds = %124
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %21) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  br label %136

126:                                              ; preds = %123, %122
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %13, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %14, align 4
  br label %134

130:                                              ; preds = %124
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %13, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %14, align 4
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %21) #6
  br label %134

134:                                              ; preds = %130, %126
  call void @llvm.lifetime.end.p0(i64 128, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr %21) #6
  br label %135

135:                                              ; preds = %134, %90, %78
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  br label %145

136:                                              ; preds = %125, %66
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #6
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %24, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %137 unwind label %141

137:                                              ; preds = %136
  invoke void @_ZngRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %23, ptr noundef nonnull align 8 dereferenceable(24) %24)
          to label %138 unwind label %141

138:                                              ; preds = %137
  invoke void @_ZN8R3Affine9TranslateERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(24) %23)
          to label %139 unwind label %141

139:                                              ; preds = %138
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #6
  store i1 true, ptr %11, align 1
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  %140 = load i1, ptr %11, align 1
  br i1 %140, label %147, label %146

141:                                              ; preds = %138, %137, %136
  %142 = landingpad { ptr, i32 }
          cleanup
  %143 = extractvalue { ptr, i32 } %142, 0
  store ptr %143, ptr %13, align 8
  %144 = extractvalue { ptr, i32 } %142, 1
  store i32 %144, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #6
  br label %145

145:                                              ; preds = %141, %135, %58, %36, %32
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #6
  br label %148

146:                                              ; preds = %139
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #6
  br label %147

147:                                              ; preds = %146, %139
  ret void

148:                                              ; preds = %145
  %149 = load ptr, ptr %13, align 8
  %150 = load i32, ptr %14, align 4
  %151 = insertvalue { ptr, i32 } poison, ptr %149, 0
  %152 = insertvalue { ptr, i32 } %151, i32 %150, 1
  resume { ptr, i32 } %152
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 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 @_ZN8R3Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(272), double noundef) #2 align 2

declare void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) #4

declare void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R4Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(72)) #4

declare void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #4

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #5

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

declare void @_ZngRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24)) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { "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 "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 }

!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.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }
%class.R3Point = type { [3 x double] }
%class.R3Triad = type { [3 x %class.R3Vector] }
%class.R3Vector = type { [3 x double] }

@R3identity_affine = external global %class.R3Affine, align 8
@RN_EPSILON = external local_unnamed_addr global double, align 8

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6R3Mesh8CentroidEv(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Mesh13AverageRadiusEPK7R3Point(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6R3Mesh13PrincipleAxesEPK7R3PointPd(ptr dead_on_unwind noalias writable sret(%class.R3Triad) align 8, ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Mesh30PCANormalizationTransformationEiii(ptr dead_on_unwind noalias nonnull writable sret(%class.R3Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(272) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R3Vector, align 8
  %8 = alloca [3 x double], align 16
  %9 = alloca %class.R3Triad, align 8
  %10 = alloca %class.R3Affine, align 8
  %11 = alloca %class.R4Matrix, align 8
  %12 = alloca %class.R3Affine, align 8
  %13 = alloca %class.R4Matrix, align 8
  %14 = alloca %class.R3Vector, align 8
  %15 = alloca %class.R3Vector, align 8
  tail call void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) @R3identity_affine)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  invoke void @_ZNK6R3Mesh8CentroidEv(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %6, ptr noundef nonnull align 8 dereferenceable(272) %1)
          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 24, ptr nonnull %7) #6
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %18 unwind label %22

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

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

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

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

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 @_ZNK6R3Mesh13AverageRadiusEPK7R3Point(ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef nonnull %6)
          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)
  %.not22 = icmp eq i32 %30, 0
  br i1 %.not22, label %35, label %31

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

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

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 %79

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %9) #6
  invoke void @_ZNK6R3Mesh13PrincipleAxesEPK7R3PointPd(ptr dead_on_unwind nonnull writable sret(%class.R3Triad) align 8 %9, ptr noundef nonnull align 8 dereferenceable(272) %1, ptr noundef nonnull %6, ptr noundef nonnull %8)
          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 272, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %11) #6
  invoke void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind nonnull writable sret(%class.R4Matrix) align 8 %11, ptr noundef nonnull align 8 dereferenceable(72) %9)
          to label %41 unwind label %46

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

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

43:                                               ; preds = %42
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %10) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %10) #6
  br label %51

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

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

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

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

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

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 @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %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 @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %62)
          to label %63 unwind label %44

63:                                               ; preds = %61, %57
  %64 = getelementptr inbounds i8, ptr %8, i64 16
  %65 = load double, ptr %64, align 16, !tbaa !5
  %66 = fcmp ogt double %65, 0.000000e+00
  br i1 %66, label %67, label %69

67:                                               ; preds = %63
  %68 = fdiv double 1.000000e+00, %65
  invoke void @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %68)
          to label %69 unwind label %44

69:                                               ; preds = %63, %67, %51
  call void @llvm.lifetime.start.p0(i64 272, ptr nonnull %12) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %13) #6
  invoke void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind nonnull writable sret(%class.R4Matrix) align 8 %13, ptr noundef nonnull align 8 dereferenceable(72) %9)
          to label %70 unwind label %73

70:                                               ; preds = %69
  invoke void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272) %12, ptr noundef nonnull align 8 dereferenceable(128) %13, i32 noundef 0)
          to label %71 unwind label %73

71:                                               ; preds = %70
  invoke void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(272) %12)
          to label %72 unwind label %75

72:                                               ; preds = %71
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %12) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  br label %79

73:                                               ; preds = %70, %69
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %77

75:                                               ; preds = %71
  %76 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %12) #6
  br label %77

77:                                               ; preds = %75, %73
  %.pn24 = phi { ptr, i32 } [ %76, %75 ], [ %74, %73 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %12) #6
  br label %78

78:                                               ; preds = %77, %50, %44
  %.pn24.pn = phi { ptr, i32 } [ %.pn24, %77 ], [ %45, %44 ], [ %.pn, %50 ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  br label %85

79:                                               ; preds = %35, %72
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %15) #6
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %80 unwind label %83

80:                                               ; preds = %79
  invoke void @_ZngRK8R3Vector(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %81 unwind label %83

81:                                               ; preds = %80
  invoke void @_ZN8R3Affine9TranslateERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %82 unwind label %83

82:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  ret void

83:                                               ; preds = %81, %80, %79
  %84 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  br label %85

85:                                               ; preds = %83, %78, %33, %22, %20
  %.pn27 = phi { ptr, i32 } [ %84, %83 ], [ %.pn24.pn, %78 ], [ %34, %33 ], [ %23, %22 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #6
  resume { ptr, i32 } %.pn27
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 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 @_ZN8R3Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(272), double noundef) local_unnamed_addr #2 align 2

declare void @_ZN8R3Affine9TransformERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #4

declare void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R4Matrix) align 8, ptr noundef nonnull align 8 dereferenceable(72)) local_unnamed_addr #4

declare void @_ZN8R3AffineC1ERK8R4Matrixi(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) unnamed_addr #4

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #5

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

declare void @_ZngRK8R3Vector(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { "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 "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 }

!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