; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/trianglemesh.ll (ZN12TriangleMesh6appendERS_)

; 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.__gnu_cxx::__normal_iterator.35" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.34" = type { ptr }
%struct.Triangle = type { [3 x i32] }
%class.TriangleMesh = type { %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector.0", i32, i32, i32, double, %"class.std::vector.5", %"class.std::vector.10", %class.Array3d }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_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<Triangle, std::allocator<Triangle>>::_Vector_impl" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_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<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.15", i32, [4 x i8] }>
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12TriangleMesh6appendERS_(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(232) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.__gnu_cxx::__normal_iterator.35", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator.35", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator.35", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %20 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %21 = alloca %struct.Triangle, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %3, align 8
  %24 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 0
  %25 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 0
  %26 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #4
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.TriangleMesh, ptr %27, i32 0, i32 0
  %29 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #4
  %30 = add i64 %26, %29
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %30)
  %31 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 1
  %32 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 1
  %33 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #4
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.TriangleMesh, ptr %34, i32 0, i32 1
  %36 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %35) #4
  %37 = add i64 %33, %36
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %37)
  %38 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 2
  %39 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 2
  %40 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %39) #4
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.TriangleMesh, ptr %41, i32 0, i32 2
  %43 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %42) #4
  %44 = add i64 %40, %43
  call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %44)
  %45 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 3
  %46 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 3
  %47 = call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %46) #4
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %class.TriangleMesh, ptr %48, i32 0, i32 3
  %50 = call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %49) #4
  %51 = add i64 %47, %50
  call void @_ZNSt6vectorI8TriangleSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %51)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %52 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 0
  %53 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #4
  %54 = trunc i64 %53 to i32
  store i32 %54, ptr %5, align 4, !tbaa !9
  %55 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %56 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 0
  %57 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %56) #4
  %58 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %7, i32 0, i32 0
  store ptr %57, ptr %58, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %class.TriangleMesh, ptr %59, i32 0, i32 0
  %61 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #4
  %62 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %8, i32 0, i32 0
  store ptr %61, ptr %62, align 8
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %class.TriangleMesh, ptr %63, i32 0, i32 0
  %65 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %64) #4
  %66 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %9, i32 0, i32 0
  store ptr %65, ptr %66, align 8
  %67 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.35", ptr %6, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8
  %69 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %8, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8
  %71 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %9, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8
  %73 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE6insertIN9__gnu_cxx17__normal_iteratorIPS1_S3_EEvEES8_NS6_IPKS1_S3_EET_SC_(ptr noundef nonnull align 8 dereferenceable(24) %55, ptr %68, ptr %70, ptr %72)
  %74 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %10, i32 0, i32 0
  store ptr %73, ptr %74, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %75 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %76 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 1
  %77 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #4
  %78 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %12, i32 0, i32 0
  store ptr %77, ptr %78, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %class.TriangleMesh, ptr %79, i32 0, i32 1
  %81 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %80) #4
  %82 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %13, i32 0, i32 0
  store ptr %81, ptr %82, align 8
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %class.TriangleMesh, ptr %83, i32 0, i32 1
  %85 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %84) #4
  %86 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %14, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  %87 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.35", ptr %11, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %13, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8
  %91 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %14, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8
  %93 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE6insertIN9__gnu_cxx17__normal_iteratorIPS1_S3_EEvEES8_NS6_IPKS1_S3_EET_SC_(ptr noundef nonnull align 8 dereferenceable(24) %75, ptr %88, ptr %90, ptr %92)
  %94 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %15, i32 0, i32 0
  store ptr %93, ptr %94, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %95 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %96 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 2
  %97 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %96) #4
  %98 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %17, i32 0, i32 0
  store ptr %97, ptr %98, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #4
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %class.TriangleMesh, ptr %99, i32 0, i32 2
  %101 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %100) #4
  %102 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %18, i32 0, i32 0
  store ptr %101, ptr %102, align 8
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %class.TriangleMesh, ptr %103, i32 0, i32 2
  %105 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %104) #4
  %106 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %19, i32 0, i32 0
  store ptr %105, ptr %106, align 8
  %107 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.35", ptr %16, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8
  %109 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %18, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8
  %111 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %19, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8
  %113 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE6insertIN9__gnu_cxx17__normal_iteratorIPS1_S3_EEvEES8_NS6_IPKS1_S3_EET_SC_(ptr noundef nonnull align 8 dereferenceable(24) %95, ptr %108, ptr %110, ptr %112)
  %114 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.34", ptr %20, i32 0, i32 0
  store ptr %113, ptr %114, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #4
  call void @_ZN8TriangleC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %21)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %115

115:                                              ; preds = %145, %2
  %116 = load i32, ptr %22, align 4, !tbaa !9
  %117 = zext i32 %116 to i64
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %class.TriangleMesh, ptr %118, i32 0, i32 3
  %120 = call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %119) #4
  %121 = icmp ult i64 %117, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  br label %148

123:                                              ; preds = %115
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %class.TriangleMesh, ptr %124, i32 0, i32 3
  %126 = load i32, ptr %22, align 4, !tbaa !9
  %127 = zext i32 %126 to i64
  %128 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI8TriangleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %125, i64 noundef %127) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %128, i64 12, i1 false), !tbaa.struct !11
  %129 = load i32, ptr %5, align 4, !tbaa !9
  %130 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %131 = getelementptr inbounds [3 x i32], ptr %130, i64 0, i64 0
  %132 = load i32, ptr %131, align 4, !tbaa !9
  %133 = add nsw i32 %132, %129
  store i32 %133, ptr %131, align 4, !tbaa !9
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %136 = getelementptr inbounds [3 x i32], ptr %135, i64 0, i64 1
  %137 = load i32, ptr %136, align 4, !tbaa !9
  %138 = add nsw i32 %137, %134
  store i32 %138, ptr %136, align 4, !tbaa !9
  %139 = load i32, ptr %5, align 4, !tbaa !9
  %140 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %141 = getelementptr inbounds [3 x i32], ptr %140, i64 0, i64 2
  %142 = load i32, ptr %141, align 4, !tbaa !9
  %143 = add nsw i32 %142, %139
  store i32 %143, ptr %141, align 4, !tbaa !9
  %144 = getelementptr inbounds %class.TriangleMesh, ptr %23, i32 0, i32 3
  call void @_ZNSt6vectorI8TriangleSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %144, ptr noundef nonnull align 4 dereferenceable(12) %21)
  br label %145

145:                                              ; preds = %123
  %146 = load i32, ptr %22, align 4, !tbaa !9
  %147 = add i32 %146, 1
  store i32 %147, ptr %22, align 4, !tbaa !9
  br label %115, !llvm.loop !13

148:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = !{i64 0, i64 12, !12}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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.__gnu_cxx::__normal_iterator.35" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.34" = type { ptr }
%struct.Triangle = type { [3 x i32] }

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

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

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

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN12TriangleMesh6appendERS_(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(232) %1) local_unnamed_addr #3 align 2 {
  %3 = alloca %"class.__gnu_cxx::__normal_iterator.35", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator.35", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.35", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.34", align 8
  %9 = alloca %struct.Triangle, align 8
  %10 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %11 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %12 = add i64 %11, %10
  tail call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %12)
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #4
  %15 = getelementptr inbounds i8, ptr %1, i64 24
  %16 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  %17 = add i64 %16, %14
  tail call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %17)
  %18 = getelementptr inbounds i8, ptr %0, i64 48
  %19 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #4
  %20 = getelementptr inbounds i8, ptr %1, i64 48
  %21 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #4
  %22 = add i64 %21, %19
  tail call void @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %22)
  %23 = getelementptr inbounds i8, ptr %0, i64 72
  %24 = tail call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #4
  %25 = getelementptr inbounds i8, ptr %1, i64 72
  %26 = tail call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #4
  %27 = add i64 %26, %24
  tail call void @_ZNSt6vectorI8TriangleSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %27)
  %28 = tail call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %29 = trunc i64 %28 to i32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %30 = tail call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  store ptr %30, ptr %4, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #4
  %31 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %32 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %33 = load ptr, ptr %3, align 8
  %34 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE6insertIN9__gnu_cxx17__normal_iteratorIPS1_S3_EEvEES8_NS6_IPKS1_S3_EET_SC_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr %33, ptr %31, ptr %32)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %35 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #4
  store ptr %35, ptr %6, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  %36 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  %37 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  %38 = load ptr, ptr %5, align 8
  %39 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE6insertIN9__gnu_cxx17__normal_iteratorIPS1_S3_EEvEES8_NS6_IPKS1_S3_EET_SC_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr %38, ptr %36, ptr %37)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %40 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #4
  store ptr %40, ptr %8, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  %41 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #4
  %42 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #4
  %43 = load ptr, ptr %7, align 8
  %44 = call ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE6insertIN9__gnu_cxx17__normal_iteratorIPS1_S3_EEvEES8_NS6_IPKS1_S3_EET_SC_(ptr noundef nonnull align 8 dereferenceable(24) %18, ptr %43, ptr %41, ptr %42)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #4
  call void @_ZN8TriangleC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9)
  %45 = call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #4
  %.not = icmp eq i64 %45, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %46 = getelementptr inbounds i8, ptr %9, i64 8
  %47 = insertelement <2 x i32> poison, i32 %29, i64 0
  %48 = shufflevector <2 x i32> %47, <2 x i32> poison, <2 x i32> zeroinitializer
  br label %49

._crit_edge:                                      ; preds = %49, %2
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #4
  ret void

49:                                               ; preds = %.lr.ph, %49
  %50 = phi i64 [ 0, %.lr.ph ], [ %57, %49 ]
  %.027 = phi i32 [ 0, %.lr.ph ], [ %56, %49 ]
  %51 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI8TriangleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %50) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %51, i64 12, i1 false), !tbaa.struct !5
  %52 = load <2 x i32>, ptr %9, align 8, !tbaa !9
  %53 = add nsw <2 x i32> %52, %48
  store <2 x i32> %53, ptr %9, align 8, !tbaa !9
  %54 = load i32, ptr %46, align 8, !tbaa !9
  %55 = add nsw i32 %54, %29
  store i32 %55, ptr %46, align 8, !tbaa !9
  call void @_ZNSt6vectorI8TriangleSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 4 dereferenceable(12) %9)
  %56 = add i32 %.027, 1
  %57 = zext i32 %56 to i64
  %58 = call noundef i64 @_ZNKSt6vectorI8TriangleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #4
  %59 = icmp ugt i64 %58, %57
  br i1 %59, label %49, label %._crit_edge, !llvm.loop !11
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9__gnu_cxx17__normal_iteratorIPKN5vmath4vec3ESt6vectorIS2_SaIS2_EEEC2IPS2_vEERKNS0_IT_S7_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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 = !{i64 0, i64 12, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass