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

; 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.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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN12TriangleMesh20_loadPLYTriangleDataEPSt14basic_ifstreamIcSt11char_traitsIcEERNSt7__cxx1112basic_stringIcS2_SaIcEEE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %struct.Triangle, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #7
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = call noundef zeroext i1 @_ZN12TriangleMesh26_getNumVerticesInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPi(ptr noundef nonnull align 8 dereferenceable(232) %24, ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef %8)
  %27 = zext i1 %26 to i8
  store i8 %27, ptr %9, align 1, !tbaa !9
  %28 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %29 = trunc i8 %28 to i1
  br i1 %29, label %31, label %30

30:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %164

31:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #7
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZN12TriangleMesh33_isVertexColorsEnabledInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(232) %24, ptr noundef nonnull align 8 dereferenceable(32) %32)
  %34 = zext i1 %33 to i8
  store i8 %34, ptr %11, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 12, ptr %12, align 4, !tbaa !13
  %35 = load i8, ptr %11, align 1, !tbaa !9, !range !11, !noundef !12
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %38

37:                                               ; preds = %31
  store i32 15, ptr %12, align 4, !tbaa !13
  br label %38

38:                                               ; preds = %37, %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %39 = load i32, ptr %8, align 4, !tbaa !13
  %40 = load i32, ptr %12, align 4, !tbaa !13
  %41 = mul nsw i32 %39, %40
  store i32 %41, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %42) #7
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %14, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = call noundef zeroext i1 @_ZN12TriangleMesh23_getNumFacesInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPi(ptr noundef nonnull align 8 dereferenceable(232) %24, ptr noundef nonnull align 8 dereferenceable(32) %45, ptr noundef %15)
  %47 = zext i1 %46 to i8
  store i8 %47, ptr %9, align 1, !tbaa !9
  %48 = load i8, ptr %9, align 1, !tbaa !9, !range !11, !noundef !12
  %49 = trunc i8 %48 to i1
  br i1 %49, label %51, label %50

50:                                               ; preds = %38
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %163

51:                                               ; preds = %38
  %52 = load i32, ptr %15, align 4, !tbaa !13
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %51
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %163

55:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 13, ptr %16, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %56 = load i32, ptr %15, align 4, !tbaa !13
  %57 = load i32, ptr %16, align 4, !tbaa !13
  %58 = mul nsw i32 %56, %57
  store i32 %58, ptr %17, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %59 = load i32, ptr %14, align 4, !tbaa !13
  %60 = load i32, ptr %13, align 4, !tbaa !13
  %61 = add nsw i32 %59, %60
  store i32 %61, ptr %18, align 4, !tbaa !13
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load i32, ptr %18, align 4, !tbaa !13
  %64 = sext i32 %63 to i64
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgElSt12_Ios_Seekdir(ptr noundef nonnull align 8 dereferenceable(16) %62, i64 noundef %64, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %66 = load i32, ptr %17, align 4, !tbaa !13
  %67 = sext i32 %66 to i64
  %68 = call noalias noundef nonnull ptr @_Znam(i64 noundef %67) #8
  store ptr %68, ptr %19, align 8, !tbaa !5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %19, align 8, !tbaa !5
  %71 = load i32, ptr %17, align 4, !tbaa !13
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %69, ptr noundef %70, i64 noundef %72)
  %74 = load ptr, ptr %73, align 8, !tbaa !15
  %75 = getelementptr i8, ptr %74, i64 -24
  %76 = load i64, ptr %75, align 8
  %77 = getelementptr inbounds i8, ptr %73, i64 %76
  %78 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEntEv(ptr noundef nonnull align 8 dereferenceable(264) %77)
  br i1 %78, label %79, label %80

79:                                               ; preds = %55
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %162

80:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #7
  call void @_ZN8TriangleC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %21)
  %81 = getelementptr inbounds %class.TriangleMesh, ptr %24, i32 0, i32 3
  %82 = load i32, ptr %15, align 4, !tbaa !13
  %83 = sext i32 %82 to i64
  call void @_ZNSt6vectorI8TriangleSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %81, i64 noundef %83)
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !13
  br label %84

84:                                               ; preds = %151, %80
  %85 = load i32, ptr %22, align 4, !tbaa !13
  %86 = load i32, ptr %15, align 4, !tbaa !13
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 2, ptr %10, align 4
  br label %154

89:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %90 = load ptr, ptr %19, align 8, !tbaa !5
  %91 = load i32, ptr %20, align 4, !tbaa !13
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i8, ptr %90, i64 %92
  %94 = load i8, ptr %93, align 1, !tbaa !17
  %95 = sext i8 %94 to i32
  store i32 %95, ptr %23, align 4, !tbaa !13
  %96 = load i32, ptr %20, align 4, !tbaa !13
  %97 = sext i32 %96 to i64
  %98 = add i64 %97, 1
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %20, align 4, !tbaa !13
  %100 = load i32, ptr %23, align 4, !tbaa !13
  %101 = icmp ne i32 %100, 3
  br i1 %101, label %102, label %103

102:                                              ; preds = %89
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %148

103:                                              ; preds = %89
  %104 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %105 = load ptr, ptr %19, align 8, !tbaa !5
  %106 = load i32, ptr %20, align 4, !tbaa !13
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i8, ptr %105, i64 %107
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %104, ptr align 1 %108, i64 12, i1 false)
  %109 = load i32, ptr %20, align 4, !tbaa !13
  %110 = sext i32 %109 to i64
  %111 = add i64 %110, 12
  %112 = trunc i64 %111 to i32
  store i32 %112, ptr %20, align 4, !tbaa !13
  %113 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %114 = getelementptr inbounds [3 x i32], ptr %113, i64 0, i64 0
  %115 = load i32, ptr %114, align 4, !tbaa !13
  %116 = icmp slt i32 %115, 0
  br i1 %116, label %145, label %117

117:                                              ; preds = %103
  %118 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %119 = getelementptr inbounds [3 x i32], ptr %118, i64 0, i64 0
  %120 = load i32, ptr %119, align 4, !tbaa !13
  %121 = load i32, ptr %8, align 4, !tbaa !13
  %122 = icmp sge i32 %120, %121
  br i1 %122, label %145, label %123

123:                                              ; preds = %117
  %124 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %125 = getelementptr inbounds [3 x i32], ptr %124, i64 0, i64 1
  %126 = load i32, ptr %125, align 4, !tbaa !13
  %127 = icmp slt i32 %126, 0
  br i1 %127, label %145, label %128

128:                                              ; preds = %123
  %129 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %130 = getelementptr inbounds [3 x i32], ptr %129, i64 0, i64 1
  %131 = load i32, ptr %130, align 4, !tbaa !13
  %132 = load i32, ptr %8, align 4, !tbaa !13
  %133 = icmp sge i32 %131, %132
  br i1 %133, label %145, label %134

134:                                              ; preds = %128
  %135 = getelementptr inbounds %struct.Triangle, ptr %21, i32 0, i32 0
  %136 = getelementptr inbounds [3 x i32], ptr %135, i64 0, i64 2
  %137 = load i32, ptr %136, align 4, !tbaa !13
  %138 = icmp slt i32 %137, 0
  br i1 %138, label %145, label %139

139:                                              ; preds = %134
  %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 !13
  %143 = load i32, ptr %8, align 4, !tbaa !13
  %144 = icmp sge i32 %142, %143
  br i1 %144, label %145, label %146

145:                                              ; preds = %139, %134, %128, %123, %117, %103
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %148

146:                                              ; preds = %139
  %147 = getelementptr inbounds %class.TriangleMesh, ptr %24, i32 0, i32 3
  call void @_ZNSt6vectorI8TriangleSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %147, ptr noundef nonnull align 4 dereferenceable(12) %21)
  store i32 0, ptr %10, align 4
  br label %148

148:                                              ; preds = %146, %145, %102
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  %149 = load i32, ptr %10, align 4
  switch i32 %149, label %154 [
    i32 0, label %150
  ]

150:                                              ; preds = %148
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %22, align 4, !tbaa !13
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %22, align 4, !tbaa !13
  br label %84, !llvm.loop !18

154:                                              ; preds = %148, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  %155 = load i32, ptr %10, align 4
  switch i32 %155, label %161 [
    i32 2, label %156
  ]

156:                                              ; preds = %154
  %157 = load ptr, ptr %19, align 8, !tbaa !5
  %158 = icmp eq ptr %157, null
  br i1 %158, label %160, label %159

159:                                              ; preds = %156
  call void @_ZdaPv(ptr noundef %157) #9
  br label %160

160:                                              ; preds = %159, %156
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %161

161:                                              ; preds = %160, %154
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %162

162:                                              ; preds = %161, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %163

163:                                              ; preds = %162, %54, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #7
  br label %164

164:                                              ; preds = %163, %30
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  %165 = load i1, ptr %4, align 1
  ret i1 %165
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) #2

; 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) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8TriangleC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #6 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)) #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgElSt12_Ios_Seekdir(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN12TriangleMesh26_getNumVerticesInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPi(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN12TriangleMesh23_getNumFacesInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPi(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN12TriangleMesh33_isVertexColorsEnabledInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEntEv(ptr noundef nonnull align 8 dereferenceable(264)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI8TriangleSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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"

%struct.Triangle = type { [3 x i32] }

; 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 uwtable
define dso_local noundef zeroext i1 @_ZN12TriangleMesh20_loadPLYTriangleDataEPSt14basic_ifstreamIcSt11char_traitsIcEERNSt7__cxx1112basic_stringIcS2_SaIcEEE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(32) %2) local_unnamed_addr #1 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.Triangle, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %7 = call noundef zeroext i1 @_ZN12TriangleMesh26_getNumVerticesInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPi(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull %4)
  br i1 %7, label %8, label %62

8:                                                ; preds = %3
  %9 = call noundef zeroext i1 @_ZN12TriangleMesh33_isVertexColorsEnabledInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(32) %2)
  %spec.store.select = select i1 %9, i32 15, i32 12
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = mul nsw i32 %10, %spec.store.select
  %12 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %2) #7
  %13 = trunc i64 %12 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %14 = call noundef zeroext i1 @_ZN12TriangleMesh23_getNumFacesInPLYHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPi(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull %5)
  br i1 %14, label %15, label %61

15:                                               ; preds = %8
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %61, label %18

18:                                               ; preds = %15
  %19 = mul nsw i32 %16, 13
  %20 = add nsw i32 %11, %13
  %21 = sext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgElSt12_Ios_Seekdir(ptr noundef nonnull align 8 dereferenceable(16) %1, i64 noundef %21, i32 noundef 0)
  %23 = sext i32 %19 to i64
  %24 = call noalias noundef nonnull ptr @_Znam(i64 noundef %23) #8
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %24, i64 noundef %23)
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr i8, ptr %26, i64 -24
  %28 = load i64, ptr %27, align 8
  %29 = getelementptr inbounds i8, ptr %25, i64 %28
  %30 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEntEv(ptr noundef nonnull align 8 dereferenceable(264) %29)
  br i1 %30, label %61, label %31

31:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  call void @_ZN8TriangleC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
  %32 = getelementptr inbounds i8, ptr %0, i64 72
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  call void @_ZNSt6vectorI8TriangleSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %34)
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %.not5059 = icmp slt i32 %35, 1
  br i1 %.not5059, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %31
  %36 = getelementptr inbounds i8, ptr %6, i64 4
  %37 = getelementptr inbounds i8, ptr %6, i64 8
  br label %38

38:                                               ; preds = %.lr.ph, %58
  %.03861 = phi i32 [ 0, %.lr.ph ], [ %59, %58 ]
  %.03960 = phi i64 [ 0, %.lr.ph ], [ %45, %58 ]
  %sext = shl i64 %.03960, 32
  %39 = ashr exact i64 %sext, 32
  %40 = getelementptr inbounds i8, ptr %24, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %.not = icmp eq i8 %41, 3
  br i1 %.not, label %42, label %.loopexit

42:                                               ; preds = %38
  %sext48 = add i64 %sext, 4294967296
  %43 = ashr exact i64 %sext48, 32
  %44 = getelementptr inbounds i8, ptr %24, i64 %43
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 1 dereferenceable(12) %44, i64 12, i1 false)
  %45 = add nsw i64 %43, 12
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 0
  br i1 %47, label %.loopexit, label %48

48:                                               ; preds = %42
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = icmp sge i32 %46, %49
  %51 = load i32, ptr %36, align 4
  %52 = icmp slt i32 %51, 0
  %or.cond = select i1 %50, i1 true, i1 %52
  br i1 %or.cond, label %.loopexit, label %53

53:                                               ; preds = %48
  %54 = icmp ult i32 %51, %49
  %55 = load i32, ptr %37, align 4
  %56 = icmp sgt i32 %55, -1
  %.not49 = icmp slt i32 %55, %49
  %57 = and i1 %56, %.not49
  %or.cond51 = select i1 %54, i1 %57, i1 false
  br i1 %or.cond51, label %58, label %.loopexit

58:                                               ; preds = %53
  call void @_ZNSt6vectorI8TriangleSaIS0_EE9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 4 dereferenceable(12) %6)
  %59 = add nuw nsw i32 %.03861, 1
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %.not50.not = icmp slt i32 %59, %60
  br i1 %.not50.not, label %38, label %.critedge, !llvm.loop !12

.critedge:                                        ; preds = %58, %31
  call void @_ZdaPv(ptr noundef nonnull %24) #9
  br label %.loopexit

.loopexit:                                        ; preds = %42, %48, %53, %38, %.critedge
  %.not5058 = phi i1 [ true, %.critedge ], [ false, %38 ], [ false, %53 ], [ false, %48 ], [ false, %42 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %61

61:                                               ; preds = %.loopexit, %18, %15, %8
  %.5 = phi i1 [ false, %8 ], [ true, %15 ], [ %.not5058, %.loopexit ], [ false, %18 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %62

62:                                               ; preds = %3, %61
  %.6 = phi i1 [ %.5, %61 ], [ false, %3 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  ret i1 %.6
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi4readEPcl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) local_unnamed_addr #2

; 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) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8TriangleC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #6 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 #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSi5seekgElSt12_Ios_Seekdir(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #6 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEntEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI8TriangleSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 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 = { "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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