; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes (R3Align)

; 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] }

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; 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 @_ZNK7R3Point6VectorEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z29R3NormalizationTransformationRK7RNArrayIP7R3PointEiii(ptr dead_on_unwind noalias writable sret(%class.R3Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #1 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
  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) #7
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void @_Z10R3CentroidRK7RNArrayIP7R3PointEPKd(ptr dead_on_unwind writable sret(%class.R3Point) 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 24, ptr %15) #7
  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) #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 %147

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) #7
  br label %147

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 @_Z17R3AverageDistanceRK7R3PointRK7RNArrayIPS_EPKd(ptr noundef nonnull align 8 dereferenceable(24) %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 @_ZN8R3Affine5ScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %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 %147

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

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 72, 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 @_Z15R3PrincipleAxesRK7R3PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind writable sret(%class.R3Triad) align 8 %18, ptr noundef nonnull align 8 dereferenceable(24) %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 272, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr %20) #7
  invoke void @_ZNK7R3Triad13InverseMatrixEv(ptr dead_on_unwind writable sret(%class.R4Matrix) align 8 %20, ptr noundef nonnull align 8 dereferenceable(72) %18)
          to label %77 unwind label %84

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

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

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

80:                                               ; preds = %118, %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 %137

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 @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %19) #7
  br label %92

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

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

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 @_ZN8R3Affine6XScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %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 @_ZN8R3Affine6YScaleEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %112)
          to label %113 unwind label %80

113:                                              ; preds = %109
  br label %114

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

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

122:                                              ; preds = %118
  br label %123

123:                                              ; preds = %122, %114
  br label %124

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

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

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

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

128:                                              ; preds = %125, %124
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %13, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %14, align 4
  br label %136

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

136:                                              ; preds = %132, %128
  call void @llvm.lifetime.end.p0(i64 128, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 272, ptr %21) #7
  br label %137

137:                                              ; preds = %136, %92, %80
  call void @llvm.lifetime.end.p0(i64 72, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  br label %147

138:                                              ; preds = %127, %67
  call void @llvm.lifetime.start.p0(i64 24, ptr %23) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %24) #7
  invoke void @_ZNK7R3Point6VectorEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %24, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %139 unwind label %143

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

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

141:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 24, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %23) #7
  store i1 true, ptr %11, align 1
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  %142 = load i1, ptr %11, align 1
  br i1 %142, label %149, label %148

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

147:                                              ; preds = %143, %137, %59, %36, %32
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #7
  br label %150

148:                                              ; preds = %141
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %0) #7
  br label %149

149:                                              ; preds = %148, %141
  ret void

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

; 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 #4 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)) #4 align 2

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

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

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

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

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

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

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

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

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

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 = { 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.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] }

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; 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 @_ZNK7R3Point6VectorEv(ptr dead_on_unwind noalias writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z29R3NormalizationTransformationRK7RNArrayIP7R3PointEiii(ptr dead_on_unwind noalias nonnull writable sret(%class.R3Affine) align 8 %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 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) #7
  invoke void @_Z10R3CentroidRK7RNArrayIP7R3PointEPKd(ptr dead_on_unwind nonnull writable sret(%class.R3Point) 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 24, ptr nonnull %7) #7
  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) #7
  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) #7
  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 @_Z17R3AverageDistanceRK7R3PointRK7RNArrayIPS_EPKd(ptr noundef nonnull align 8 dereferenceable(24) %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)
  %.not24 = icmp eq i32 %30, 0
  br i1 %.not24, 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) #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 72, ptr nonnull %9) #7
  invoke void @_Z15R3PrincipleAxesRK7R3PointRK7RNArrayIPS_EPKdPd(ptr dead_on_unwind nonnull writable sret(%class.R3Triad) align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %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 272, ptr nonnull %10) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %11) #7
  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) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %10) #7
  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) #7
  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) #7
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %10) #7
  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 @_ZN8R3Affine6YScaleEd(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 @_ZN8R3Affine6ZScaleEd(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) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %13) #7
  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) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %12) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  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) #7
  br label %77

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

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

79:                                               ; preds = %35, %72
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %15) #7
  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) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  ret void

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

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

; 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 #4 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 #4 align 2

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3Affine6ZScaleEd(ptr noundef nonnull align 8 dereferenceable(272), double noundef) local_unnamed_addr #4 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 #5

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 = { 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