; LLVM IR from zeux/meshoptimizer :: gltf/mesh.ll (Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings)

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

%struct.Mesh = type { i32, %"class.std::vector", %"class.std::vector.0", ptr, ptr, %struct.cgltf_extras, i32, %"class.std::vector.5", %"class.std::vector.10", i8, [2 x i64], i64, %"class.std::vector.15", %"class.std::vector.20", %"class.std::vector.25" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<cgltf_node *, std::allocator<cgltf_node *>>::_Vector_impl" }
%"struct.std::_Vector_base<cgltf_node *, std::allocator<cgltf_node *>>::_Vector_impl" = type { %"struct.std::_Vector_base<cgltf_node *, std::allocator<cgltf_node *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cgltf_node *, std::allocator<cgltf_node *>>::_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<Transform, std::allocator<Transform>>::_Vector_impl" }
%"struct.std::_Vector_base<Transform, std::allocator<Transform>>::_Vector_impl" = type { %"struct.std::_Vector_base<Transform, std::allocator<Transform>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Transform, std::allocator<Transform>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.cgltf_extras = type { i64, i64, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Stream, std::allocator<Stream>>::_Vector_impl" }
%"struct.std::_Vector_base<Stream, std::allocator<Stream>>::_Vector_impl" = type { %"struct.std::_Vector_base<Stream, std::allocator<Stream>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Stream, std::allocator<Stream>>::_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<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl" = type { %"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<const char *, std::allocator<const char *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.25" = type { %"struct.std::_Vector_base.26" }
%"struct.std::_Vector_base.26" = type { %"struct.std::_Vector_base<cgltf_material_mapping, std::allocator<cgltf_material_mapping>>::_Vector_impl" }
%"struct.std::_Vector_base<cgltf_material_mapping, std::allocator<cgltf_material_mapping>>::_Vector_impl" = type { %"struct.std::_Vector_base<cgltf_material_mapping, std::allocator<cgltf_material_mapping>>::_Vector_impl_data" }
%"struct.std::_Vector_base<cgltf_material_mapping, std::allocator<cgltf_material_mapping>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.Stream = type { i32, i32, i32, ptr, %"class.std::vector.30" }
%"class.std::vector.30" = type { %"struct.std::_Vector_base.31" }
%"struct.std::_Vector_base.31" = type { %"struct.std::_Vector_base<Attr, std::allocator<Attr>>::_Vector_impl" }
%"struct.std::_Vector_base<Attr, std::allocator<Attr>>::_Vector_impl" = type { %"struct.std::_Vector_base<Attr, std::allocator<Attr>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Attr, std::allocator<Attr>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [49 x i8], align 1
@__PRETTY_FUNCTION__._Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings = external hidden unnamed_addr constant [56 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 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 nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI6StreamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; 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 @_ZNSt6vectorI6StreamSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI4AttrSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIjSaIjEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL11mergeMeshesR4MeshRKS_(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 8 dereferenceable(256)) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(148) %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %158, %2
  %17 = load i64, ptr %5, align 8, !tbaa !9
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #4
  %20 = icmp ult i64 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %161

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load i64, ptr %5, align 8, !tbaa !9
  %25 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %24) #4
  store ptr %25, ptr %7, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.Mesh, ptr %26, i32 0, i32 7
  %28 = call noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #4
  br i1 %28, label %29, label %30

29:                                               ; preds = %22
  store i32 4, ptr %6, align 4
  br label %155

30:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.Mesh, ptr %31, i32 0, i32 7
  %33 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef 0) #4
  %34 = getelementptr inbounds %struct.Stream, ptr %33, i32 0, i32 4
  %35 = call noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #4
  store i64 %35, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Mesh, ptr %36, i32 0, i32 8
  %38 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %37) #4
  store i64 %38, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %39 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %39, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %40 = load i64, ptr %5, align 8, !tbaa !9
  %41 = add i64 %40, 1
  store i64 %41, ptr %11, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %75, %30
  %43 = load i64, ptr %11, align 8, !tbaa !9
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = call noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #4
  %46 = icmp ult i64 %43, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %42
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %78

48:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = load i64, ptr %11, align 8, !tbaa !9
  %51 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %50) #4
  store ptr %51, ptr %12, align 8, !tbaa !5
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.Mesh, ptr %52, i32 0, i32 7
  %54 = call noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #4
  br i1 %54, label %74, label %55

55:                                               ; preds = %48
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = call noundef zeroext i1 @_ZL14canMergeMeshesRK4MeshS1_RK8Settings(ptr noundef nonnull align 8 dereferenceable(256) %56, ptr noundef nonnull align 8 dereferenceable(256) %57, ptr noundef nonnull align 4 dereferenceable(148) %58)
  br i1 %59, label %60, label %74

60:                                               ; preds = %55
  %61 = load ptr, ptr %12, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.Mesh, ptr %61, i32 0, i32 7
  %63 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef 0) #4
  %64 = getelementptr inbounds %struct.Stream, ptr %63, i32 0, i32 4
  %65 = call noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %64) #4
  %66 = load i64, ptr %8, align 8, !tbaa !9
  %67 = add i64 %66, %65
  store i64 %67, ptr %8, align 8, !tbaa !9
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Mesh, ptr %68, i32 0, i32 8
  %70 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %69) #4
  %71 = load i64, ptr %9, align 8, !tbaa !9
  %72 = add i64 %71, %70
  store i64 %72, ptr %9, align 8, !tbaa !9
  %73 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %73, ptr %10, align 8, !tbaa !9
  br label %74

74:                                               ; preds = %60, %55, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %75

75:                                               ; preds = %74
  %76 = load i64, ptr %11, align 8, !tbaa !9
  %77 = add i64 %76, 1
  store i64 %77, ptr %11, align 8, !tbaa !9
  br label %42, !llvm.loop !11

78:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %93, %78
  %80 = load i64, ptr %13, align 8, !tbaa !9
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.Mesh, ptr %81, i32 0, i32 7
  %83 = call noundef i64 @_ZNKSt6vectorI6StreamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %82) #4
  %84 = icmp ult i64 %80, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %79
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %96

86:                                               ; preds = %79
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.Mesh, ptr %87, i32 0, i32 7
  %89 = load i64, ptr %13, align 8, !tbaa !9
  %90 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %88, i64 noundef %89) #4
  %91 = getelementptr inbounds %struct.Stream, ptr %90, i32 0, i32 4
  %92 = load i64, ptr %8, align 8, !tbaa !9
  call void @_ZNSt6vectorI4AttrSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %91, i64 noundef %92)
  br label %93

93:                                               ; preds = %86
  %94 = load i64, ptr %13, align 8, !tbaa !9
  %95 = add i64 %94, 1
  store i64 %95, ptr %13, align 8, !tbaa !9
  br label %79, !llvm.loop !13

96:                                               ; preds = %85
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.Mesh, ptr %97, i32 0, i32 8
  %99 = load i64, ptr %9, align 8, !tbaa !9
  call void @_ZNSt6vectorIjSaIjEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %98, i64 noundef %99)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %100 = load i64, ptr %5, align 8, !tbaa !9
  %101 = add i64 %100, 1
  store i64 %101, ptr %14, align 8, !tbaa !9
  br label %102

102:                                              ; preds = %131, %96
  %103 = load i64, ptr %14, align 8, !tbaa !9
  %104 = load i64, ptr %10, align 8, !tbaa !9
  %105 = icmp ule i64 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %134

107:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = load i64, ptr %14, align 8, !tbaa !9
  %110 = call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %108, i64 noundef %109) #4
  store ptr %110, ptr %15, align 8, !tbaa !5
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.Mesh, ptr %111, i32 0, i32 7
  %113 = call noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %112) #4
  br i1 %113, label %130, label %114

114:                                              ; preds = %107
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = load ptr, ptr %15, align 8, !tbaa !5
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = call noundef zeroext i1 @_ZL14canMergeMeshesRK4MeshS1_RK8Settings(ptr noundef nonnull align 8 dereferenceable(256) %115, ptr noundef nonnull align 8 dereferenceable(256) %116, ptr noundef nonnull align 4 dereferenceable(148) %117)
  br i1 %118, label %119, label %130

119:                                              ; preds = %114
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZL11mergeMeshesR4MeshRKS_(ptr noundef nonnull align 8 dereferenceable(256) %120, ptr noundef nonnull align 8 dereferenceable(256) %121)
  %122 = load ptr, ptr %15, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.Mesh, ptr %122, i32 0, i32 7
  call void @_ZNSt6vectorI6StreamSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %123) #4
  %124 = load ptr, ptr %15, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.Mesh, ptr %124, i32 0, i32 8
  call void @_ZNSt6vectorIjSaIjEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %125) #4
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.Mesh, ptr %126, i32 0, i32 1
  call void @_ZNSt6vectorIP10cgltf_nodeSaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %127) #4
  %128 = load ptr, ptr %15, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.Mesh, ptr %128, i32 0, i32 2
  call void @_ZNSt6vectorI9TransformSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %129) #4
  br label %130

130:                                              ; preds = %119, %114, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %131

131:                                              ; preds = %130
  %132 = load i64, ptr %14, align 8, !tbaa !9
  %133 = add i64 %132, 1
  store i64 %133, ptr %14, align 8, !tbaa !9
  br label %102, !llvm.loop !14

134:                                              ; preds = %106
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.Mesh, ptr %135, i32 0, i32 7
  %137 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %136, i64 noundef 0) #4
  %138 = getelementptr inbounds %struct.Stream, ptr %137, i32 0, i32 4
  %139 = call noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %138) #4
  %140 = load i64, ptr %8, align 8, !tbaa !9
  %141 = icmp eq i64 %139, %140
  br i1 %141, label %142, label %143

142:                                              ; preds = %134
  br label %145

143:                                              ; preds = %134
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 519, ptr noundef @__PRETTY_FUNCTION__._Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings) #5
  unreachable

144:                                              ; No predecessors!
  br label %145

145:                                              ; preds = %144, %142
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.Mesh, ptr %146, i32 0, i32 8
  %148 = call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %147) #4
  %149 = load i64, ptr %9, align 8, !tbaa !9
  %150 = icmp eq i64 %148, %149
  br i1 %150, label %151, label %152

151:                                              ; preds = %145
  br label %154

152:                                              ; preds = %145
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 520, ptr noundef @__PRETTY_FUNCTION__._Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings) #5
  unreachable

153:                                              ; No predecessors!
  br label %154

154:                                              ; preds = %153, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  store i32 0, ptr %6, align 4
  br label %155

155:                                              ; preds = %154, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %156 = load i32, ptr %6, align 4
  switch i32 %156, label %162 [
    i32 0, label %157
    i32 4, label %158
  ]

157:                                              ; preds = %155
  br label %158

158:                                              ; preds = %157, %155
  %159 = load i64, ptr %5, align 8, !tbaa !9
  %160 = add i64 %159, 1
  store i64 %160, ptr %5, align 8, !tbaa !9
  br label %16, !llvm.loop !15

161:                                              ; preds = %21
  ret void

162:                                              ; preds = %155
  unreachable
}

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL14canMergeMeshesRK4MeshS1_RK8Settings(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 4 dereferenceable(148)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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

@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [49 x i8], align 1
@__PRETTY_FUNCTION__._Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings = external hidden unnamed_addr constant [56 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI6StreamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL11mergeMeshesR4MeshRKS_(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 8 dereferenceable(256)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(148) %1) local_unnamed_addr #2 {
  %3 = tail call noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %.not77 = icmp eq i64 %3, 0
  br i1 %.not77, label %._crit_edge76, label %.lr.ph75

._crit_edge76:                                    ; preds = %59, %2
  ret void

.lr.ph75:                                         ; preds = %2, %59
  %.072 = phi i64 [ %.pre-phi, %59 ], [ 0, %2 ]
  %4 = tail call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.072) #3
  %5 = getelementptr inbounds i8, ptr %4, i64 104
  %6 = tail call noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  br i1 %6, label %.lr.ph75._crit_edge, label %7

.lr.ph75._crit_edge:                              ; preds = %.lr.ph75
  %.pre = add nuw i64 %.072, 1
  br label %59

7:                                                ; preds = %.lr.ph75
  %8 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef 0) #3
  %9 = getelementptr inbounds i8, ptr %8, i64 24
  %10 = tail call noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #3
  %11 = getelementptr inbounds i8, ptr %4, i64 128
  %12 = tail call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %13 = add nuw i64 %.072, 1
  %14 = tail call noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %15 = icmp ult i64 %13, %14
  br i1 %15, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %30, %7
  %.057.lcssa = phi i64 [ %10, %7 ], [ %.158, %30 ]
  %.055.lcssa = phi i64 [ %12, %7 ], [ %.156, %30 ]
  %.054.lcssa = phi i64 [ %.072, %7 ], [ %.1, %30 ]
  %16 = tail call noundef i64 @_ZNKSt6vectorI6StreamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %.not78 = icmp eq i64 %16, 0
  br i1 %.not78, label %._crit_edge, label %.lr.ph66

.lr.ph:                                           ; preds = %7, %30
  %.05362 = phi i64 [ %31, %30 ], [ %13, %7 ]
  %.05461 = phi i64 [ %.1, %30 ], [ %.072, %7 ]
  %.05560 = phi i64 [ %.156, %30 ], [ %12, %7 ]
  %.05759 = phi i64 [ %.158, %30 ], [ %10, %7 ]
  %17 = tail call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.05362) #3
  %18 = getelementptr inbounds i8, ptr %17, i64 104
  %19 = tail call noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #3
  br i1 %19, label %30, label %20

20:                                               ; preds = %.lr.ph
  %21 = tail call noundef zeroext i1 @_ZL14canMergeMeshesRK4MeshS1_RK8Settings(ptr noundef nonnull align 8 dereferenceable(256) %4, ptr noundef nonnull align 8 dereferenceable(256) %17, ptr noundef nonnull align 4 dereferenceable(148) %1)
  br i1 %21, label %22, label %30

22:                                               ; preds = %20
  %23 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef 0) #3
  %24 = getelementptr inbounds i8, ptr %23, i64 24
  %25 = tail call noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #3
  %26 = add i64 %25, %.05759
  %27 = getelementptr inbounds i8, ptr %17, i64 128
  %28 = tail call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #3
  %29 = add i64 %28, %.05560
  br label %30

30:                                               ; preds = %22, %20, %.lr.ph
  %.158 = phi i64 [ %.05759, %.lr.ph ], [ %26, %22 ], [ %.05759, %20 ]
  %.156 = phi i64 [ %.05560, %.lr.ph ], [ %29, %22 ], [ %.05560, %20 ]
  %.1 = phi i64 [ %.05461, %.lr.ph ], [ %.05362, %22 ], [ %.05461, %20 ]
  %31 = add nuw i64 %.05362, 1
  %32 = tail call noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %33 = icmp ult i64 %31, %32
  br i1 %33, label %.lr.ph, label %.preheader, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph66, %.preheader
  tail call void @_ZNSt6vectorIjSaIjEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef %.055.lcssa)
  %.not67.not = icmp ult i64 %.072, %.054.lcssa
  br i1 %.not67.not, label %.lr.ph70, label %._crit_edge71

.lr.ph66:                                         ; preds = %.preheader, %.lr.ph66
  %.05265 = phi i64 [ %36, %.lr.ph66 ], [ 0, %.preheader ]
  %34 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.05265) #3
  %35 = getelementptr inbounds i8, ptr %34, i64 24
  tail call void @_ZNSt6vectorI4AttrSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef %.057.lcssa)
  %36 = add nuw i64 %.05265, 1
  %37 = tail call noundef i64 @_ZNKSt6vectorI6StreamSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %38 = icmp ult i64 %36, %37
  br i1 %38, label %.lr.ph66, label %._crit_edge, !llvm.loop !7

._crit_edge71:                                    ; preds = %52, %._crit_edge
  %39 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNSt6vectorI6StreamSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef 0) #3
  %40 = getelementptr inbounds i8, ptr %39, i64 24
  %41 = tail call noundef i64 @_ZNKSt6vectorI4AttrSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #3
  %42 = icmp eq i64 %41, %.057.lcssa
  br i1 %42, label %55, label %54

.lr.ph70:                                         ; preds = %._crit_edge, %52
  %.05168 = phi i64 [ %53, %52 ], [ %13, %._crit_edge ]
  %43 = tail call noundef nonnull align 8 dereferenceable(256) ptr @_ZNSt6vectorI4MeshSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.05168) #3
  %44 = getelementptr inbounds i8, ptr %43, i64 104
  %45 = tail call noundef zeroext i1 @_ZNKSt6vectorI6StreamSaIS0_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #3
  br i1 %45, label %52, label %46

46:                                               ; preds = %.lr.ph70
  %47 = tail call noundef zeroext i1 @_ZL14canMergeMeshesRK4MeshS1_RK8Settings(ptr noundef nonnull align 8 dereferenceable(256) %4, ptr noundef nonnull align 8 dereferenceable(256) %43, ptr noundef nonnull align 4 dereferenceable(148) %1)
  br i1 %47, label %48, label %52

48:                                               ; preds = %46
  tail call void @_ZL11mergeMeshesR4MeshRKS_(ptr noundef nonnull align 8 dereferenceable(256) %4, ptr noundef nonnull align 8 dereferenceable(256) %43)
  tail call void @_ZNSt6vectorI6StreamSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #3
  %49 = getelementptr inbounds i8, ptr %43, i64 128
  tail call void @_ZNSt6vectorIjSaIjEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %49) #3
  %50 = getelementptr inbounds i8, ptr %43, i64 8
  tail call void @_ZNSt6vectorIP10cgltf_nodeSaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %50) #3
  %51 = getelementptr inbounds i8, ptr %43, i64 32
  tail call void @_ZNSt6vectorI9TransformSaIS0_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %51) #3
  br label %52

52:                                               ; preds = %48, %46, %.lr.ph70
  %53 = add i64 %.05168, 1
  %.not = icmp ugt i64 %53, %.054.lcssa
  br i1 %.not, label %._crit_edge71, label %.lr.ph70, !llvm.loop !8

54:                                               ; preds = %._crit_edge71
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 519, ptr noundef nonnull @__PRETTY_FUNCTION__._Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings) #4
  unreachable

55:                                               ; preds = %._crit_edge71
  %56 = tail call noundef i64 @_ZNKSt6vectorIjSaIjEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %57 = icmp eq i64 %56, %.055.lcssa
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 520, ptr noundef nonnull @__PRETTY_FUNCTION__._Z11mergeMeshesRSt6vectorI4MeshSaIS0_EERK8Settings) #4
  unreachable

59:                                               ; preds = %.lr.ph75._crit_edge, %55
  %.pre-phi = phi i64 [ %.pre, %.lr.ph75._crit_edge ], [ %13, %55 ]
  %60 = tail call noundef i64 @_ZNKSt6vectorI4MeshSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #3
  %61 = icmp ult i64 %.pre-phi, %60
  br i1 %61, label %.lr.ph75, label %._crit_edge76, !llvm.loop !9
}

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL14canMergeMeshesRK4MeshS1_RK8Settings(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 8 dereferenceable(256), ptr noundef nonnull align 4 dereferenceable(148)) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { 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 = { nounwind }
attributes #4 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = distinct !{!8, !6}
!9 = distinct !{!9, !6}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass