; LLVM IR from atlantis13579/Riemann :: Src/Geometry (MeshSimplification)

; 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.Riemann::MeshQEMOptimizer" = type { %"class.std::vector.5", %"class.std::vector.10", %"class.std::vector.0", %"class.Riemann::FaceMap", %"class.Riemann::PriorityPool", i32, i32, i32, %"class.std::vector.25" }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Riemann::FaceMap" = type { %"class.std::unordered_map" }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.Riemann::PriorityPool" = type <{ %"class.std::vector.20", i32, [4 x i8] }>
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.25" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.Riemann::Face" = type { [3 x i32] }
%"class.Maths::TVector3" = type { float, float, float }

@.str = external hidden unnamed_addr constant [81 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__._ZN7Riemann12SimplifyMeshEPKN5Maths8TVector3IfEEPKviibRKNS_20SimplificationConfigERSt6vectorIS2_SaIS2_EERSA_IiSaIiEE = external hidden unnamed_addr constant [148 x i8], align 1

; 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
define dso_local noundef zeroext i1 @_ZN7Riemann12SimplifyMeshEPKN5Maths8TVector3IfEEPKviibRKNS_20SimplificationConfigERSt6vectorIS2_SaIS2_EERSA_IiSaIiEE(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i1 noundef zeroext %4, ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7) #1 personality ptr @__gxx_personality_v0 {
  %9 = alloca i1, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %"class.Riemann::MeshQEMOptimizer", align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca [3 x i32], align 4
  %26 = alloca %"class.Riemann::Face", align 4
  %27 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store i32 %2, ptr %12, align 4, !tbaa !9
  store i32 %3, ptr %13, align 4, !tbaa !9
  %28 = zext i1 %4 to i8
  store i8 %28, ptr %14, align 1, !tbaa !11
  store ptr %5, ptr %15, align 8, !tbaa !5
  store ptr %6, ptr %16, align 8, !tbaa !5
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 216, ptr %18) #4
  call void @_ZN7Riemann16MeshQEMOptimizerC2Ev(ptr noundef nonnull align 8 dereferenceable(216) %18)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %41, %8
  %30 = load i32, ptr %19, align 4, !tbaa !9
  %31 = load i32, ptr %12, align 4, !tbaa !9
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %48

34:                                               ; preds = %29
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = load i32, ptr %19, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds %"class.Maths::TVector3", ptr %35, i64 %37
  %39 = invoke noundef i32 @_ZN7Riemann16MeshQEMOptimizer9AddVertexERKN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(216) %18, ptr noundef nonnull align 4 dereferenceable(12) %38)
          to label %40 unwind label %44

40:                                               ; preds = %34
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %19, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %19, align 4, !tbaa !9
  br label %29, !llvm.loop !13

44:                                               ; preds = %34
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %20, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %174

48:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %49 = load i8, ptr %14, align 1, !tbaa !11, !range !15, !noundef !16
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %53

51:                                               ; preds = %48
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  br label %54

53:                                               ; preds = %48
  br label %54

54:                                               ; preds = %53, %51
  %55 = phi ptr [ %52, %51 ], [ null, %53 ]
  store ptr %55, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %56 = load i8, ptr %14, align 1, !tbaa !11, !range !15, !noundef !16
  %57 = trunc i8 %56 to i1
  br i1 %57, label %58, label %59

58:                                               ; preds = %54
  br label %61

59:                                               ; preds = %54
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %59, %58
  %62 = phi ptr [ null, %58 ], [ %60, %59 ]
  store ptr %62, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %151, %61
  %64 = load i32, ptr %24, align 4, !tbaa !9
  %65 = load i32, ptr %13, align 4, !tbaa !9
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %158

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 12, ptr %25) #4
  %69 = load ptr, ptr %22, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %99

71:                                               ; preds = %68
  %72 = load ptr, ptr %22, align 8, !tbaa !5
  %73 = load i32, ptr %24, align 4, !tbaa !9
  %74 = mul nsw i32 %73, 3
  %75 = add nsw i32 %74, 0
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i16, ptr %72, i64 %76
  %78 = load i16, ptr %77, align 2, !tbaa !17
  %79 = zext i16 %78 to i32
  %80 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 0
  store i32 %79, ptr %80, align 4, !tbaa !9
  %81 = load ptr, ptr %22, align 8, !tbaa !5
  %82 = load i32, ptr %24, align 4, !tbaa !9
  %83 = mul nsw i32 %82, 3
  %84 = add nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i16, ptr %81, i64 %85
  %87 = load i16, ptr %86, align 2, !tbaa !17
  %88 = zext i16 %87 to i32
  %89 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 1
  store i32 %88, ptr %89, align 4, !tbaa !9
  %90 = load ptr, ptr %22, align 8, !tbaa !5
  %91 = load i32, ptr %24, align 4, !tbaa !9
  %92 = mul nsw i32 %91, 3
  %93 = add nsw i32 %92, 2
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i16, ptr %90, i64 %94
  %96 = load i16, ptr %95, align 2, !tbaa !17
  %97 = zext i16 %96 to i32
  %98 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 2
  store i32 %97, ptr %98, align 4, !tbaa !9
  br label %124

99:                                               ; preds = %68
  %100 = load ptr, ptr %23, align 8, !tbaa !5
  %101 = load i32, ptr %24, align 4, !tbaa !9
  %102 = mul nsw i32 %101, 3
  %103 = add nsw i32 %102, 0
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %100, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 0
  store i32 %106, ptr %107, align 4, !tbaa !9
  %108 = load ptr, ptr %23, align 8, !tbaa !5
  %109 = load i32, ptr %24, align 4, !tbaa !9
  %110 = mul nsw i32 %109, 3
  %111 = add nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds i32, ptr %108, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 1
  store i32 %114, ptr %115, align 4, !tbaa !9
  %116 = load ptr, ptr %23, align 8, !tbaa !5
  %117 = load i32, ptr %24, align 4, !tbaa !9
  %118 = mul nsw i32 %117, 3
  %119 = add nsw i32 %118, 2
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr %116, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !9
  %123 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 2
  store i32 %122, ptr %123, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %99, %71
  %125 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 0
  %126 = load i32, ptr %125, align 4, !tbaa !9
  %127 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 1
  %128 = load i32, ptr %127, align 4, !tbaa !9
  %129 = icmp ne i32 %126, %128
  br i1 %129, label %130, label %142

130:                                              ; preds = %124
  %131 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 0
  %132 = load i32, ptr %131, align 4, !tbaa !9
  %133 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 1
  %134 = load i32, ptr %133, align 4, !tbaa !9
  %135 = icmp ne i32 %132, %134
  br i1 %135, label %136, label %142

136:                                              ; preds = %130
  %137 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 1
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 2
  %140 = load i32, ptr %139, align 4, !tbaa !9
  %141 = icmp ne i32 %138, %140
  br label %142

142:                                              ; preds = %136, %130, %124
  %143 = phi i1 [ false, %130 ], [ false, %124 ], [ %141, %136 ]
  br i1 %143, label %144, label %145

144:                                              ; preds = %142
  br label %147

145:                                              ; preds = %142
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 805, ptr noundef @__PRETTY_FUNCTION__._ZN7Riemann12SimplifyMeshEPKN5Maths8TVector3IfEEPKviibRKNS_20SimplificationConfigERSt6vectorIS2_SaIS2_EERSA_IiSaIiEE) #5
  unreachable

146:                                              ; No predecessors!
  br label %147

147:                                              ; preds = %146, %144
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #4
  %148 = getelementptr inbounds [3 x i32], ptr %25, i64 0, i64 0
  invoke void @_ZN7Riemann4FaceC2EPKi(ptr noundef nonnull align 4 dereferenceable(12) %26, ptr noundef %148)
          to label %149 unwind label %154

149:                                              ; preds = %147
  invoke void @_ZN7Riemann16MeshQEMOptimizer7AddFaceERKNS_4FaceE(ptr noundef nonnull align 8 dereferenceable(216) %18, ptr noundef nonnull align 4 dereferenceable(12) %26)
          to label %150 unwind label %154

150:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #4
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %24, align 4, !tbaa !9
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %24, align 4, !tbaa !9
  br label %63, !llvm.loop !19

154:                                              ; preds = %149, %147
  %155 = landingpad { ptr, i32 }
          cleanup
  %156 = extractvalue { ptr, i32 } %155, 0
  store ptr %156, ptr %20, align 8
  %157 = extractvalue { ptr, i32 } %155, 1
  store i32 %157, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %173

158:                                              ; preds = %67
  %159 = load ptr, ptr %15, align 8, !tbaa !5
  %160 = invoke noundef zeroext i1 @_ZN7Riemann16MeshQEMOptimizer8SimplifyERKNS_20SimplificationConfigE(ptr noundef nonnull align 8 dereferenceable(216) %18, ptr noundef nonnull align 4 dereferenceable(8) %159)
          to label %161 unwind label %163

161:                                              ; preds = %158
  br i1 %160, label %167, label %162

162:                                              ; preds = %161
  store i1 false, ptr %9, align 1
  store i32 1, ptr %27, align 4
  br label %171

163:                                              ; preds = %167, %158
  %164 = landingpad { ptr, i32 }
          cleanup
  %165 = extractvalue { ptr, i32 } %164, 0
  store ptr %165, ptr %20, align 8
  %166 = extractvalue { ptr, i32 } %164, 1
  store i32 %166, ptr %21, align 4
  br label %173

167:                                              ; preds = %161
  %168 = load ptr, ptr %16, align 8, !tbaa !5
  %169 = load ptr, ptr %17, align 8, !tbaa !5
  invoke void @_ZN7Riemann16MeshQEMOptimizer14GetNewVerticesERSt6vectorIN5Maths8TVector3IfEESaIS4_EERS1_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(216) %18, ptr noundef nonnull align 8 dereferenceable(24) %168, ptr noundef nonnull align 8 dereferenceable(24) %169)
          to label %170 unwind label %163

170:                                              ; preds = %167
  store i1 true, ptr %9, align 1
  store i32 1, ptr %27, align 4
  br label %171

171:                                              ; preds = %170, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @_ZN7Riemann16MeshQEMOptimizerD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %18) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr %18) #4
  %172 = load i1, ptr %9, align 1
  ret i1 %172

173:                                              ; preds = %163, %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  br label %174

174:                                              ; preds = %173, %44
  call void @_ZN7Riemann16MeshQEMOptimizerD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %18) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr %18) #4
  br label %175

175:                                              ; preds = %174
  %176 = load ptr, ptr %20, align 8
  %177 = load i32, ptr %21, align 4
  %178 = insertvalue { ptr, i32 } poison, ptr %176, 0
  %179 = insertvalue { ptr, i32 } %178, i32 %177, 1
  resume { ptr, i32 } %179
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann16MeshQEMOptimizerC2Ev(ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Riemann16MeshQEMOptimizer9AddVertexERKN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann4FaceC2EPKi(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann16MeshQEMOptimizer7AddFaceERKNS_4FaceE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 4 dereferenceable(12)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Riemann16MeshQEMOptimizer8SimplifyERKNS_20SimplificationConfigE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann16MeshQEMOptimizer14GetNewVerticesERSt6vectorIN5Maths8TVector3IfEESaIS4_EERS1_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

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 = { noreturn 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 #3 = { 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 = { nounwind }
attributes #5 = { noreturn 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 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = distinct !{!19, !14}


; 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.Riemann::MeshQEMOptimizer" = type { %"class.std::vector.5", %"class.std::vector.10", %"class.std::vector.0", %"class.Riemann::FaceMap", %"class.Riemann::PriorityPool", i32, i32, i32, %"class.std::vector.25" }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Vertex, std::allocator<Riemann::Vertex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Face, std::allocator<Riemann::Face>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Edge, std::allocator<Riemann::Edge>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Riemann::FaceMap" = type { %"class.std::unordered_map" }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.Riemann::PriorityPool" = type <{ %"class.std::vector.20", i32, [4 x i8] }>
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Edge *, std::allocator<Riemann::Edge *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.25" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.Riemann::Face" = type { [3 x i32] }
%"class.Maths::TVector3" = type { float, float, float }

@.str = external hidden unnamed_addr constant [81 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__._ZN7Riemann12SimplifyMeshEPKN5Maths8TVector3IfEEPKviibRKNS_20SimplificationConfigERSt6vectorIS2_SaIS2_EERSA_IiSaIiEE = external hidden unnamed_addr constant [148 x i8], align 1

; 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
define dso_local noundef zeroext i1 @_ZN7Riemann12SimplifyMeshEPKN5Maths8TVector3IfEEPKviibRKNS_20SimplificationConfigERSt6vectorIS2_SaIS2_EERSA_IiSaIiEE(ptr noundef %0, ptr noundef readonly %1, i32 noundef %2, i32 noundef %3, i1 noundef zeroext %4, ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %9 = alloca %"class.Riemann::MeshQEMOptimizer", align 8
  %10 = alloca [3 x i32], align 4
  %11 = alloca %"class.Riemann::Face", align 4
  call void @llvm.lifetime.start.p0(i64 216, ptr nonnull %9) #4
  call void @_ZN7Riemann16MeshQEMOptimizerC2Ev(ptr noundef nonnull align 8 dereferenceable(216) %9)
  %12 = icmp sgt i32 %2, 0
  br i1 %12, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %8
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %29, %8
  %13 = select i1 %4, ptr %1, ptr null
  %14 = select i1 %4, ptr null, ptr %1
  %15 = icmp sgt i32 %3, 0
  br i1 %15, label %.lr.ph46, label %._crit_edge47

.lr.ph46:                                         ; preds = %._crit_edge
  %.not = icmp eq ptr %13, null
  %16 = getelementptr inbounds i8, ptr %10, i64 4
  %17 = getelementptr inbounds i8, ptr %10, i64 8
  %wide.trip.count59 = zext nneg i32 %3 to i64
  br i1 %.not, label %.lr.ph46.split.us, label %.lr.ph46.split

.lr.ph46.split.us:                                ; preds = %.lr.ph46, %25
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %25 ], [ 0, %.lr.ph46 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #4
  %.idx61 = mul i64 %indvars.iv56, 12
  %18 = getelementptr inbounds i8, ptr %14, i64 %.idx61
  %19 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %19, ptr %10, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %18, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !5
  store i32 %21, ptr %16, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %18, i64 8
  %23 = load i32, ptr %22, align 4, !tbaa !5
  store i32 %23, ptr %17, align 4, !tbaa !5
  %.not37.us = icmp eq i32 %19, %21
  %.not38.us = icmp eq i32 %21, %23
  %or.cond.us = select i1 %.not37.us, i1 true, i1 %.not38.us
  br i1 %or.cond.us, label %.critedge, label %24

24:                                               ; preds = %.lr.ph46.split.us
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #4
  call void @_ZN7Riemann4FaceC2EPKi(ptr noundef nonnull align 4 dereferenceable(12) %11, ptr noundef nonnull %10)
  invoke void @_ZN7Riemann16MeshQEMOptimizer7AddFaceERKNS_4FaceE(ptr noundef nonnull align 8 dereferenceable(216) %9, ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %25 unwind label %.split.us

25:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %exitcond60.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count59
  br i1 %exitcond60.not, label %._crit_edge47, label %.lr.ph46.split.us, !llvm.loop !9

.split.us:                                        ; preds = %24
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %45

.lr.ph:                                           ; preds = %.lr.ph.preheader, %29
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %29 ]
  %27 = getelementptr inbounds %"class.Maths::TVector3", ptr %0, i64 %indvars.iv
  %28 = invoke noundef i32 @_ZN7Riemann16MeshQEMOptimizer9AddVertexERKN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(216) %9, ptr noundef nonnull align 4 dereferenceable(12) %27)
          to label %29 unwind label %30

29:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

30:                                               ; preds = %.lr.ph
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %51

._crit_edge47:                                    ; preds = %43, %25, %._crit_edge
  %32 = invoke noundef zeroext i1 @_ZN7Riemann16MeshQEMOptimizer8SimplifyERKNS_20SimplificationConfigE(ptr noundef nonnull align 8 dereferenceable(216) %9, ptr noundef nonnull align 4 dereferenceable(8) %5)
          to label %46 unwind label %47

.lr.ph46.split:                                   ; preds = %.lr.ph46, %43
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %43 ], [ 0, %.lr.ph46 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #4
  %.idx = mul i64 %indvars.iv51, 6
  %33 = getelementptr inbounds i8, ptr %13, i64 %.idx
  %34 = load i16, ptr %33, align 2, !tbaa !12
  %35 = zext i16 %34 to i32
  store i32 %35, ptr %10, align 4, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %33, i64 2
  %37 = load i16, ptr %36, align 2, !tbaa !12
  %38 = zext i16 %37 to i32
  store i32 %38, ptr %16, align 4, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %33, i64 4
  %40 = load i16, ptr %39, align 2, !tbaa !12
  %41 = zext i16 %40 to i32
  store i32 %41, ptr %17, align 4, !tbaa !5
  %.not37 = icmp eq i16 %34, %37
  %.not38 = icmp eq i16 %37, %40
  %or.cond = select i1 %.not37, i1 true, i1 %.not38
  br i1 %or.cond, label %.critedge, label %42

.critedge:                                        ; preds = %.lr.ph46.split, %.lr.ph46.split.us
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 805, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7Riemann12SimplifyMeshEPKN5Maths8TVector3IfEEPKviibRKNS_20SimplificationConfigERSt6vectorIS2_SaIS2_EERSA_IiSaIiEE) #5
  unreachable

42:                                               ; preds = %.lr.ph46.split
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #4
  call void @_ZN7Riemann4FaceC2EPKi(ptr noundef nonnull align 4 dereferenceable(12) %11, ptr noundef nonnull %10)
  invoke void @_ZN7Riemann16MeshQEMOptimizer7AddFaceERKNS_4FaceE(ptr noundef nonnull align 8 dereferenceable(216) %9, ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %43 unwind label %.split

43:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count59
  br i1 %exitcond55.not, label %._crit_edge47, label %.lr.ph46.split, !llvm.loop !9

.split:                                           ; preds = %42
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %45

45:                                               ; preds = %.split.us, %.split
  %.us-phi = phi { ptr, i32 } [ %44, %.split ], [ %26, %.split.us ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #4
  br label %51

46:                                               ; preds = %._crit_edge47
  br i1 %32, label %49, label %50

47:                                               ; preds = %49, %._crit_edge47
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %51

49:                                               ; preds = %46
  invoke void @_ZN7Riemann16MeshQEMOptimizer14GetNewVerticesERSt6vectorIN5Maths8TVector3IfEESaIS4_EERS1_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(216) %9, ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %50 unwind label %47

50:                                               ; preds = %49, %46
  call void @_ZN7Riemann16MeshQEMOptimizerD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %9) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %9) #4
  ret i1 %32

51:                                               ; preds = %45, %47, %30
  %.pn40 = phi { ptr, i32 } [ %31, %30 ], [ %.us-phi, %45 ], [ %48, %47 ]
  call void @_ZN7Riemann16MeshQEMOptimizerD2Ev(ptr noundef nonnull align 8 dereferenceable(216) %9) #4
  call void @llvm.lifetime.end.p0(i64 216, ptr nonnull %9) #4
  resume { ptr, i32 } %.pn40
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann16MeshQEMOptimizerC2Ev(ptr noundef nonnull align 8 dereferenceable(216)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Riemann16MeshQEMOptimizer9AddVertexERKN5Maths8TVector3IfEE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann4FaceC2EPKi(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann16MeshQEMOptimizer7AddFaceERKNS_4FaceE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Riemann16MeshQEMOptimizer8SimplifyERKNS_20SimplificationConfigE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Riemann16MeshQEMOptimizer14GetNewVerticesERSt6vectorIN5Maths8TVector3IfEESaIS4_EERS1_IiSaIiEE(ptr noundef nonnull align 8 dereferenceable(216), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

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 = { noreturn 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 #3 = { 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 = { nounwind }
attributes #5 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass