; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Mesh.ll (ZNK6R3Mesh12WritePlyFileEPKci)

; 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.PlyProperty = type { ptr, i32, i32, i32, i32, i32, i32, i32 }
%struct.PlyFace.12 = type { i8, ptr, i32, i32, i32 }
%struct.PlyVertex.11 = type { float, float, float, float, float, float, float, float, i8, i8, i8 }

@.str.42 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [7 x i8], align 1
@__const._ZNK6R3Mesh12WritePlyFileEPKci.elem_names = external hidden unnamed_addr constant [2 x ptr], align 16
@_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props = external hidden global [11 x %struct.PlyProperty], align 16
@_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props = external hidden global [4 x %struct.PlyProperty], align 16
@_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face = external hidden global %struct.PlyFace.12, align 8

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272)) #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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272), i32 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh12VertexNormalEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272), i32 noundef) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh12FaceMaterialEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh11FaceSegmentEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh12FaceCategoryEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 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

declare void @ply_close(ptr noundef) #4

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Mesh12WritePlyFileEPKci(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1, i32 noundef %2) unnamed_addr #5 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca [2 x ptr], align 16
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca %struct.PlyVertex.11, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %22 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %8, ptr align 16 @__const._ZNK6R3Mesh12WritePlyFileEPKci.elem_names, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  %25 = zext i1 %24 to i64
  %26 = select i1 %24, i32 4, i32 1
  store i32 %26, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds [2 x ptr], ptr %8, i64 0, i64 0
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = call ptr @ply_open_for_writing(ptr noundef %27, i32 noundef 2, ptr noundef %28, i32 noundef %29, ptr noundef %9)
  store ptr %30, ptr %11, align 8, !tbaa !5
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = icmp ne ptr %31, null
  br i1 %32, label %34, label %33

33:                                               ; preds = %3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %164

34:                                               ; preds = %3
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
  call void @ply_element_count(ptr noundef %35, ptr noundef @.str.105, i32 noundef %36)
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %37, ptr noundef @.str.105, ptr noundef @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props)
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %38, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 1))
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %39, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 2))
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %40, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 3))
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %41, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 4))
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %42, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 5))
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %43, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 6))
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %44, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 7))
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %45, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 8))
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %46, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 9))
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %47, ptr noundef @.str.105, ptr noundef getelementptr inbounds ([11 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 0, i64 10))
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
  call void @ply_element_count(ptr noundef %48, ptr noundef @.str.42, i32 noundef %49)
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %50, ptr noundef @.str.42, ptr noundef @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props)
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %51, ptr noundef @.str.42, ptr noundef getelementptr inbounds ([4 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props, i64 0, i64 1))
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %52, ptr noundef @.str.42, ptr noundef getelementptr inbounds ([4 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props, i64 0, i64 2))
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_describe_property(ptr noundef %53, ptr noundef @.str.42, ptr noundef getelementptr inbounds ([4 x %struct.PlyProperty], ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props, i64 0, i64 3))
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_header_complete(ptr noundef %54)
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_put_element_setup(ptr noundef %55, ptr noundef @.str.105)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %124, %34
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %127

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %22, i32 noundef %62)
  store ptr %63, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %64 = load ptr, ptr %14, align 8, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %64)
  store ptr %65, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh12VertexNormalEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %66)
  store ptr %67, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %68)
  store ptr %69, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %70)
  store ptr %71, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 36, ptr %19) #6
  %72 = load ptr, ptr %15, align 8, !tbaa !5
  %73 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %72)
  %74 = fptrunc double %73 to float
  %75 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 0
  store float %74, ptr %75, align 4, !tbaa !11
  %76 = load ptr, ptr %15, align 8, !tbaa !5
  %77 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %76)
  %78 = fptrunc double %77 to float
  %79 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 1
  store float %78, ptr %79, align 4, !tbaa !14
  %80 = load ptr, ptr %15, align 8, !tbaa !5
  %81 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %80)
  %82 = fptrunc double %81 to float
  %83 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 2
  store float %82, ptr %83, align 4, !tbaa !15
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  %85 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %84)
  %86 = fptrunc double %85 to float
  %87 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 3
  store float %86, ptr %87, align 4, !tbaa !16
  %88 = load ptr, ptr %16, align 8, !tbaa !5
  %89 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %88)
  %90 = fptrunc double %89 to float
  %91 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 4
  store float %90, ptr %91, align 4, !tbaa !17
  %92 = load ptr, ptr %16, align 8, !tbaa !5
  %93 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %92)
  %94 = fptrunc double %93 to float
  %95 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 5
  store float %94, ptr %95, align 4, !tbaa !18
  %96 = load ptr, ptr %17, align 8, !tbaa !5
  %97 = call noundef double @_ZNK7R2Point1XEv(ptr noundef nonnull align 8 dereferenceable(16) %96)
  %98 = fptrunc double %97 to float
  %99 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 6
  store float %98, ptr %99, align 4, !tbaa !19
  %100 = load ptr, ptr %17, align 8, !tbaa !5
  %101 = call noundef double @_ZNK7R2Point1YEv(ptr noundef nonnull align 8 dereferenceable(16) %100)
  %102 = fptrunc double %101 to float
  %103 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 7
  store float %102, ptr %103, align 4, !tbaa !20
  %104 = load ptr, ptr %16, align 8, !tbaa !5
  %105 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %104)
  %106 = fptoui double %105 to i8
  %107 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 8
  store i8 %106, ptr %107, align 4, !tbaa !21
  %108 = load ptr, ptr %18, align 8, !tbaa !5
  %109 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %108)
  %110 = fmul double 2.550000e+02, %109
  %111 = fptoui double %110 to i8
  %112 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 8
  store i8 %111, ptr %112, align 4, !tbaa !21
  %113 = load ptr, ptr %18, align 8, !tbaa !5
  %114 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %113)
  %115 = fmul double 2.550000e+02, %114
  %116 = fptoui double %115 to i8
  %117 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 9
  store i8 %116, ptr %117, align 1, !tbaa !22
  %118 = load ptr, ptr %18, align 8, !tbaa !5
  %119 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %118)
  %120 = fmul double 2.550000e+02, %119
  %121 = fptoui double %120 to i8
  %122 = getelementptr inbounds %struct.PlyVertex.11, ptr %19, i32 0, i32 10
  store i8 %121, ptr %122, align 2, !tbaa !23
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_put_element(ptr noundef %123, ptr noundef %19)
  call void @llvm.lifetime.end.p0(i64 36, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %124

124:                                              ; preds = %61
  %125 = load i32, ptr %13, align 4, !tbaa !9
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %13, align 4, !tbaa !9
  br label %56, !llvm.loop !24

127:                                              ; preds = %60
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_put_element_setup(ptr noundef %128, ptr noundef @.str.42)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %159, %127
  %130 = load i32, ptr %20, align 4, !tbaa !9
  %131 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %162

134:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %135 = load i32, ptr %20, align 4, !tbaa !9
  %136 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %22, i32 noundef %135)
  store ptr %136, ptr %21, align 8, !tbaa !5
  %137 = load ptr, ptr %21, align 8, !tbaa !5
  %138 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %137, i32 noundef 0)
  %139 = call noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %138)
  %140 = load ptr, ptr getelementptr inbounds (%struct.PlyFace.12, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i32 0, i32 1), align 8, !tbaa !26
  %141 = getelementptr inbounds i32, ptr %140, i64 0
  store i32 %139, ptr %141, align 4, !tbaa !9
  %142 = load ptr, ptr %21, align 8, !tbaa !5
  %143 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %142, i32 noundef 1)
  %144 = call noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %143)
  %145 = load ptr, ptr getelementptr inbounds (%struct.PlyFace.12, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i32 0, i32 1), align 8, !tbaa !26
  %146 = getelementptr inbounds i32, ptr %145, i64 1
  store i32 %144, ptr %146, align 4, !tbaa !9
  %147 = load ptr, ptr %21, align 8, !tbaa !5
  %148 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %147, i32 noundef 2)
  %149 = call noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %148)
  %150 = load ptr, ptr getelementptr inbounds (%struct.PlyFace.12, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i32 0, i32 1), align 8, !tbaa !26
  %151 = getelementptr inbounds i32, ptr %150, i64 2
  store i32 %149, ptr %151, align 4, !tbaa !9
  %152 = load ptr, ptr %21, align 8, !tbaa !5
  %153 = call noundef i32 @_ZNK6R3Mesh12FaceMaterialEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %152)
  store i32 %153, ptr getelementptr inbounds (%struct.PlyFace.12, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i32 0, i32 2), align 8, !tbaa !28
  %154 = load ptr, ptr %21, align 8, !tbaa !5
  %155 = call noundef i32 @_ZNK6R3Mesh11FaceSegmentEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %154)
  store i32 %155, ptr getelementptr inbounds (%struct.PlyFace.12, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i32 0, i32 3), align 4, !tbaa !29
  %156 = load ptr, ptr %21, align 8, !tbaa !5
  %157 = call noundef i32 @_ZNK6R3Mesh12FaceCategoryEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %156)
  store i32 %157, ptr getelementptr inbounds (%struct.PlyFace.12, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i32 0, i32 4), align 8, !tbaa !30
  %158 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_put_element(ptr noundef %158, ptr noundef @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face)
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %159

159:                                              ; preds = %134
  %160 = load i32, ptr %20, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %20, align 4, !tbaa !9
  br label %129, !llvm.loop !31

162:                                              ; preds = %133
  %163 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ply_close(ptr noundef %163)
  store i32 1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %164

164:                                              ; preds = %162, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  %165 = load i32, ptr %4, align 4
  ret i32 %165
}

declare ptr @ply_open_for_writing(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare void @ply_element_count(ptr noundef, ptr noundef, i32 noundef) #4

declare void @ply_describe_property(ptr noundef, ptr noundef, ptr noundef) #4

declare void @ply_header_complete(ptr noundef) #4

declare void @ply_put_element_setup(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R2Point1XEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R2Point1YEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

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

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

declare void @ply_put_element(ptr noundef, ptr noundef) #4

attributes #0 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { 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 #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSZNK6R3Mesh12WritePlyFileEPKciE9PlyVertex", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !7, i64 32, !7, i64 33, !7, i64 34}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !13, i64 4}
!15 = !{!12, !13, i64 8}
!16 = !{!12, !13, i64 12}
!17 = !{!12, !13, i64 16}
!18 = !{!12, !13, i64 20}
!19 = !{!12, !13, i64 24}
!20 = !{!12, !13, i64 28}
!21 = !{!12, !7, i64 32}
!22 = !{!12, !7, i64 33}
!23 = !{!12, !7, i64 34}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!27, !6, i64 8}
!27 = !{!"_ZTSZNK6R3Mesh12WritePlyFileEPKciE7PlyFace", !7, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24}
!28 = !{!27, !10, i64 16}
!29 = !{!27, !10, i64 20}
!30 = !{!27, !10, i64 24}
!31 = distinct !{!31, !25}


; 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.PlyProperty = type { ptr, i32, i32, i32, i32, i32, i32, i32 }
%struct.PlyFace.12 = type { i8, ptr, i32, i32, i32 }
%struct.PlyVertex.11 = type { float, float, float, float, float, float, float, float, i8, i8, i8 }

@.str.42 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [7 x i8], align 1
@__const._ZNK6R3Mesh12WritePlyFileEPKci.elem_names = external hidden unnamed_addr constant [2 x ptr], align 16
@_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props = external hidden global [11 x %struct.PlyProperty], align 16
@_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props = external hidden global [4 x %struct.PlyProperty], align 16
@_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face = external hidden global %struct.PlyFace.12, align 8

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272)) 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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh12VertexNormalEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh12FaceMaterialEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh11FaceSegmentEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh12FaceCategoryEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 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

declare void @ply_close(ptr noundef) local_unnamed_addr #4

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -1, 2) i32 @_ZNK6R3Mesh12WritePlyFileEPKci(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1, i32 noundef %2) unnamed_addr #5 align 2 {
  %4 = alloca [2 x ptr], align 16
  %5 = alloca float, align 4
  %6 = alloca %struct.PlyVertex.11, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, ptr noundef nonnull align 16 dereferenceable(16) @__const._ZNK6R3Mesh12WritePlyFileEPKci.elem_names, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %.not = icmp eq i32 %2, 0
  %7 = select i1 %.not, i32 1, i32 4
  %8 = call ptr @ply_open_for_writing(ptr noundef %1, i32 noundef 2, ptr noundef nonnull %4, i32 noundef %7, ptr noundef nonnull %5)
  %.not59 = icmp eq ptr %8, null
  br i1 %.not59, label %80, label %9

9:                                                ; preds = %3
  %10 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  call void @ply_element_count(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, i32 noundef %10)
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props)
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 40))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 80))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 120))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 160))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 200))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 240))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 280))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 320))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 360))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.105, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10vert_props, i64 400))
  %11 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  call void @ply_element_count(ptr noundef nonnull %8, ptr noundef nonnull @.str.42, i32 noundef %11)
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.42, ptr noundef nonnull @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props)
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.42, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props, i64 40))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.42, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props, i64 80))
  call void @ply_describe_property(ptr noundef nonnull %8, ptr noundef nonnull @.str.42, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE10face_props, i64 120))
  call void @ply_header_complete(ptr noundef nonnull %8)
  call void @ply_put_element_setup(ptr noundef nonnull %8, ptr noundef nonnull @.str.105)
  %12 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %9
  %14 = getelementptr inbounds i8, ptr %6, i64 4
  %15 = getelementptr inbounds i8, ptr %6, i64 8
  %16 = getelementptr inbounds i8, ptr %6, i64 12
  %17 = getelementptr inbounds i8, ptr %6, i64 16
  %18 = getelementptr inbounds i8, ptr %6, i64 20
  %19 = getelementptr inbounds i8, ptr %6, i64 24
  %20 = getelementptr inbounds i8, ptr %6, i64 28
  %21 = getelementptr inbounds i8, ptr %6, i64 32
  %22 = getelementptr inbounds i8, ptr %6, i64 33
  %23 = getelementptr inbounds i8, ptr %6, i64 34
  br label %26

._crit_edge:                                      ; preds = %26, %9
  call void @ply_put_element_setup(ptr noundef %8, ptr noundef nonnull @.str.42)
  %24 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph63, label %._crit_edge64

26:                                               ; preds = %.lr.ph, %26
  %.05760 = phi i32 [ 0, %.lr.ph ], [ %59, %26 ]
  %27 = call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.05760)
  %28 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh12VertexNormalEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
  %31 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
  call void @llvm.lifetime.start.p0(i64 36, ptr nonnull %6) #6
  %32 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %33 = fptrunc double %32 to float
  store float %33, ptr %6, align 4, !tbaa !5
  %34 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %35 = fptrunc double %34 to float
  store float %35, ptr %14, align 4, !tbaa !10
  %36 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %37 = fptrunc double %36 to float
  store float %37, ptr %15, align 4, !tbaa !11
  %38 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  %39 = fptrunc double %38 to float
  store float %39, ptr %16, align 4, !tbaa !12
  %40 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  %41 = fptrunc double %40 to float
  store float %41, ptr %17, align 4, !tbaa !13
  %42 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  %43 = fptrunc double %42 to float
  store float %43, ptr %18, align 4, !tbaa !14
  %44 = call noundef double @_ZNK7R2Point1XEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
  %45 = fptrunc double %44 to float
  store float %45, ptr %19, align 4, !tbaa !15
  %46 = call noundef double @_ZNK7R2Point1YEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
  %47 = fptrunc double %46 to float
  store float %47, ptr %20, align 4, !tbaa !16
  %48 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %29)
  %49 = fptoui double %48 to i8
  store i8 %49, ptr %21, align 4, !tbaa !17
  %50 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %31)
  %51 = fmul double %50, 2.550000e+02
  %52 = fptoui double %51 to i8
  store i8 %52, ptr %21, align 4, !tbaa !17
  %53 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %31)
  %54 = fmul double %53, 2.550000e+02
  %55 = fptoui double %54 to i8
  store i8 %55, ptr %22, align 1, !tbaa !18
  %56 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %31)
  %57 = fmul double %56, 2.550000e+02
  %58 = fptoui double %57 to i8
  store i8 %58, ptr %23, align 2, !tbaa !19
  call void @ply_put_element(ptr noundef %8, ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 36, ptr nonnull %6) #6
  %59 = add nuw nsw i32 %.05760, 1
  %60 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %26, label %._crit_edge, !llvm.loop !20

._crit_edge64:                                    ; preds = %.lr.ph63, %._crit_edge
  call void @ply_close(ptr noundef %8)
  br label %80

.lr.ph63:                                         ; preds = %._crit_edge, %.lr.ph63
  %.05661 = phi i32 [ %77, %.lr.ph63 ], [ 0, %._crit_edge ]
  %62 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.05661)
  %63 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %62, i32 noundef 0)
  %64 = call noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %63)
  %65 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i64 8), align 8, !tbaa !22
  store i32 %64, ptr %65, align 4, !tbaa !26
  %66 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %62, i32 noundef 1)
  %67 = call noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %66)
  %68 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i64 8), align 8, !tbaa !22
  %69 = getelementptr inbounds i8, ptr %68, i64 4
  store i32 %67, ptr %69, align 4, !tbaa !26
  %70 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %62, i32 noundef 2)
  %71 = call noundef i32 @_ZNK6R3Mesh8VertexIDEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %70)
  %72 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i64 8), align 8, !tbaa !22
  %73 = getelementptr inbounds i8, ptr %72, i64 8
  store i32 %71, ptr %73, align 4, !tbaa !26
  %74 = call noundef i32 @_ZNK6R3Mesh12FaceMaterialEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %62)
  store i32 %74, ptr getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i64 16), align 8, !tbaa !27
  %75 = call noundef i32 @_ZNK6R3Mesh11FaceSegmentEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %62)
  store i32 %75, ptr getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i64 20), align 4, !tbaa !28
  %76 = call noundef i32 @_ZNK6R3Mesh12FaceCategoryEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %62)
  store i32 %76, ptr getelementptr inbounds (i8, ptr @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face, i64 24), align 8, !tbaa !29
  call void @ply_put_element(ptr noundef %8, ptr noundef nonnull @_ZZNK6R3Mesh12WritePlyFileEPKciE8ply_face)
  %77 = add nuw nsw i32 %.05661, 1
  %78 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %.lr.ph63, label %._crit_edge64, !llvm.loop !30

80:                                               ; preds = %3, %._crit_edge64
  %.0 = phi i32 [ 1, %._crit_edge64 ], [ -1, %3 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  ret i32 %.0
}

declare ptr @ply_open_for_writing(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare void @ply_element_count(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare void @ply_describe_property(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @ply_header_complete(ptr noundef) local_unnamed_addr #4

declare void @ply_put_element_setup(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R2Point1XEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R2Point1YEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

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

declare void @ply_put_element(ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 = { 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 #6 = { 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, !7, i64 0}
!6 = !{!"_ZTSZNK6R3Mesh12WritePlyFileEPKciE9PlyVertex", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !8, i64 32, !8, i64 33, !8, i64 34}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!6, !7, i64 8}
!12 = !{!6, !7, i64 12}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !7, i64 20}
!15 = !{!6, !7, i64 24}
!16 = !{!6, !7, i64 28}
!17 = !{!6, !8, i64 32}
!18 = !{!6, !8, i64 33}
!19 = !{!6, !8, i64 34}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !24, i64 8}
!23 = !{!"_ZTSZNK6R3Mesh12WritePlyFileEPKciE7PlyFace", !8, i64 0, !24, i64 8, !25, i64 16, !25, i64 20, !25, i64 24}
!24 = !{!"any pointer", !8, i64 0}
!25 = !{!"int", !8, i64 0}
!26 = !{!25, !25, i64 0}
!27 = !{!23, !25, i64 16}
!28 = !{!23, !25, i64 20}
!29 = !{!23, !25, i64 24}
!30 = distinct !{!30, !21}


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