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

; 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.R3MeshVertex = type { ptr, %class.RNArray.0, %class.R3Point, %class.R3Vector, %class.R2Point, %class.RNRgb, double, i32, %class.RNFlags, double, i32, ptr }
%class.RNArray.0 = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }
%class.R2Point = type { [2 x double] }
%class.RNRgb = type { [3 x double] }
%class.RNFlags = type { i64 }

@.str.58 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.161 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.164 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.165 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.167 = external hidden unnamed_addr constant [12 x i8], align 1

; 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 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: 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 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare void @_Z6RNFailPKcz(ptr noundef, ...) #4

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

declare i32 @fclose(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: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Mesh12WriteObjFileEPKc(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1) unnamed_addr #5 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call noalias ptr @fopen(ptr noundef %22, ptr noundef @.str.161)
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %27, label %25

25:                                               ; preds = %2
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef @.str.58, ptr noundef %26)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %150

27:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %46, %27
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i32 2, ptr %7, align 4
  br label %49

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %21, i32 noundef %34)
  store ptr %35, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %36)
  store ptr %37, ptr %11, align 8, !tbaa !5
  %38 = load ptr, ptr %11, align 8, !tbaa !5
  %39 = call noundef i32 @_ZNK7R2Point6IsZeroEv(ptr noundef nonnull align 8 dereferenceable(16) %38)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %42, label %41

41:                                               ; preds = %33
  store i32 1, ptr %8, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %43

42:                                               ; preds = %33
  store i32 0, ptr %7, align 4
  br label %43

43:                                               ; preds = %42, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %44 = load i32, ptr %7, align 4
  switch i32 %44, label %49 [
    i32 0, label %45
  ]

45:                                               ; preds = %43
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %9, align 4, !tbaa !9
  br label %28, !llvm.loop !11

49:                                               ; preds = %43, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %81, %50
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %84

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %57 = load i32, ptr %12, align 4, !tbaa !9
  %58 = call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %21, i32 noundef %57)
  store ptr %58, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %59)
  store ptr %60, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %61)
  store ptr %62, ptr %15, align 8, !tbaa !5
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %72

65:                                               ; preds = %56
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = call noundef double @_ZNK7R2Point1XEv(ptr noundef nonnull align 8 dereferenceable(16) %67)
  %69 = load ptr, ptr %15, align 8, !tbaa !5
  %70 = call noundef double @_ZNK7R2Point1YEv(ptr noundef nonnull align 8 dereferenceable(16) %69)
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.164, double noundef %68, double noundef %70) #6
  br label %72

72:                                               ; preds = %65, %56
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %74)
  %76 = load ptr, ptr %14, align 8, !tbaa !5
  %77 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %76)
  %78 = load ptr, ptr %14, align 8, !tbaa !5
  %79 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %78)
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef @.str.165, double noundef %75, double noundef %77, double noundef %79) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %81

81:                                               ; preds = %72
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %12, align 4, !tbaa !9
  br label %51, !llvm.loop !13

84:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %144, %84
  %86 = load i32, ptr %16, align 4, !tbaa !9
  %87 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

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

90:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %91 = load i32, ptr %16, align 4, !tbaa !9
  %92 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %21, i32 noundef %91)
  store ptr %92, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %93 = load ptr, ptr %17, align 8, !tbaa !5
  %94 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %93, i32 noundef 0)
  store ptr %94, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %95, i32 noundef 1)
  store ptr %96, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %97 = load ptr, ptr %17, align 8, !tbaa !5
  %98 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %97, i32 noundef 2)
  store ptr %98, ptr %20, align 8, !tbaa !5
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %128

101:                                              ; preds = %90
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load ptr, ptr %18, align 8, !tbaa !5
  %104 = getelementptr inbounds %class.R3MeshVertex, ptr %103, i32 0, i32 7
  %105 = load i32, ptr %104, align 8, !tbaa !14
  %106 = add nsw i32 %105, 1
  %107 = load ptr, ptr %19, align 8, !tbaa !5
  %108 = getelementptr inbounds %class.R3MeshVertex, ptr %107, i32 0, i32 7
  %109 = load i32, ptr %108, align 8, !tbaa !14
  %110 = add nsw i32 %109, 1
  %111 = load ptr, ptr %20, align 8, !tbaa !5
  %112 = getelementptr inbounds %class.R3MeshVertex, ptr %111, i32 0, i32 7
  %113 = load i32, ptr %112, align 8, !tbaa !14
  %114 = add nsw i32 %113, 1
  %115 = load ptr, ptr %18, align 8, !tbaa !5
  %116 = getelementptr inbounds %class.R3MeshVertex, ptr %115, i32 0, i32 7
  %117 = load i32, ptr %116, align 8, !tbaa !14
  %118 = add nsw i32 %117, 1
  %119 = load ptr, ptr %19, align 8, !tbaa !5
  %120 = getelementptr inbounds %class.R3MeshVertex, ptr %119, i32 0, i32 7
  %121 = load i32, ptr %120, align 8, !tbaa !14
  %122 = add nsw i32 %121, 1
  %123 = load ptr, ptr %20, align 8, !tbaa !5
  %124 = getelementptr inbounds %class.R3MeshVertex, ptr %123, i32 0, i32 7
  %125 = load i32, ptr %124, align 8, !tbaa !14
  %126 = add nsw i32 %125, 1
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef @.str.166, i32 noundef %106, i32 noundef %110, i32 noundef %114, i32 noundef %118, i32 noundef %122, i32 noundef %126) #6
  br label %143

128:                                              ; preds = %90
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = load ptr, ptr %18, align 8, !tbaa !5
  %131 = getelementptr inbounds %class.R3MeshVertex, ptr %130, i32 0, i32 7
  %132 = load i32, ptr %131, align 8, !tbaa !14
  %133 = add nsw i32 %132, 1
  %134 = load ptr, ptr %19, align 8, !tbaa !5
  %135 = getelementptr inbounds %class.R3MeshVertex, ptr %134, i32 0, i32 7
  %136 = load i32, ptr %135, align 8, !tbaa !14
  %137 = add nsw i32 %136, 1
  %138 = load ptr, ptr %20, align 8, !tbaa !5
  %139 = getelementptr inbounds %class.R3MeshVertex, ptr %138, i32 0, i32 7
  %140 = load i32, ptr %139, align 8, !tbaa !14
  %141 = add nsw i32 %140, 1
  %142 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.167, i32 noundef %133, i32 noundef %137, i32 noundef %141) #6
  br label %143

143:                                              ; preds = %128, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, 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
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %16, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %16, align 4, !tbaa !9
  br label %85, !llvm.loop !25

147:                                              ; preds = %89
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = call i32 @fclose(ptr noundef %148)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %150

150:                                              ; preds = %147, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %151 = load i32, ptr %3, align 4
  ret i32 %151
}

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

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 = { 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 #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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !10, i64 120}
!15 = !{!"_ZTS12R3MeshVertex", !16, i64 8, !18, i64 24, !19, i64 48, !20, i64 72, !21, i64 88, !22, i64 112, !10, i64 120, !23, i64 128, !22, i64 136, !10, i64 144, !6, i64 152}
!16 = !{!"_ZTS7RNArrayIP10R3MeshEdgeE", !17, i64 0}
!17 = !{!"_ZTS8RNVArray", !6, i64 0, !10, i64 8, !10, i64 12}
!18 = !{!"_ZTS7R3Point", !7, i64 0}
!19 = !{!"_ZTS8R3Vector", !7, i64 0}
!20 = !{!"_ZTS7R2Point", !7, i64 0}
!21 = !{!"_ZTS5RNRgb", !7, i64 0}
!22 = !{!"double", !7, i64 0}
!23 = !{!"_ZTS7RNFlags", !24, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = distinct !{!25, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.58 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.161 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.164 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.165 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.166 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.167 = external hidden unnamed_addr constant [12 x i8], align 1

; 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: 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 #1 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 #1 align 2

; 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 #1 align 2

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare void @_Z6RNFailPKcz(ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK6R3Mesh12WriteObjFileEPKc(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1) unnamed_addr #4 align 2 {
  %3 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.161)
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %5, label %.preheader51

.preheader51:                                     ; preds = %2
  %4 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %.not50.not52 = icmp sgt i32 %4, 0
  br i1 %.not50.not52, label %.lr.ph, label %._crit_edge.thread

5:                                                ; preds = %2
  tail call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef nonnull @.str.58, ptr noundef %1)
  br label %78

6:                                                ; preds = %.lr.ph
  %7 = add nuw nsw i32 %.04353, 1
  %8 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %.not50.not = icmp slt i32 %7, %8
  br i1 %.not50.not, label %.lr.ph, label %._crit_edge, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader51, %6
  %.04353 = phi i32 [ %7, %6 ], [ 0, %.preheader51 ]
  %9 = tail call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.04353)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %9)
  %11 = tail call noundef i32 @_ZNK7R2Point6IsZeroEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %.not47.not = icmp eq i32 %11, 0
  br i1 %.not47.not, label %._crit_edge, label %6

._crit_edge:                                      ; preds = %.lr.ph, %6
  %12 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph59, label %.preheader

._crit_edge.thread:                               ; preds = %.preheader51
  %14 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph59.split.preheader, label %.preheader.thread

.lr.ph59:                                         ; preds = %._crit_edge
  br i1 %.not47.not, label %.lr.ph59.split.us, label %.lr.ph59.split.preheader

.lr.ph59.split.preheader:                         ; preds = %._crit_edge.thread, %.lr.ph59
  br label %.lr.ph59.split

.lr.ph59.split.us:                                ; preds = %.lr.ph59, %.lr.ph59.split.us
  %.04557.us = phi i32 [ %26, %.lr.ph59.split.us ], [ 0, %.lr.ph59 ]
  %16 = tail call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.04557.us)
  %17 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %16)
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %16)
  %19 = tail call noundef double @_ZNK7R2Point1XEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
  %20 = tail call noundef double @_ZNK7R2Point1YEv(ptr noundef nonnull align 8 dereferenceable(16) %18)
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.164, double noundef %19, double noundef %20) #5
  %22 = tail call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %17)
  %23 = tail call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %17)
  %24 = tail call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %17)
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.165, double noundef %22, double noundef %23, double noundef %24) #5
  %26 = add nuw nsw i32 %.04557.us, 1
  %27 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph59.split.us, label %.preheader, !llvm.loop !7

.preheader:                                       ; preds = %.lr.ph59.split, %.lr.ph59.split.us, %._crit_edge
  %.not50.not.lcssa67 = phi i1 [ %.not47.not, %._crit_edge ], [ %.not47.not, %.lr.ph59.split.us ], [ false, %.lr.ph59.split ]
  %29 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph61, label %._crit_edge62

.preheader.thread:                                ; preds = %._crit_edge.thread
  %31 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph61.split.preheader, label %._crit_edge62

.lr.ph61:                                         ; preds = %.preheader
  br i1 %.not50.not.lcssa67, label %.lr.ph61.split.us, label %.lr.ph61.split.preheader

.lr.ph61.split.preheader:                         ; preds = %.preheader.thread, %.lr.ph61
  br label %.lr.ph61.split

.lr.ph61.split.us:                                ; preds = %.lr.ph61, %.lr.ph61.split.us
  %.04460.us = phi i32 [ %47, %.lr.ph61.split.us ], [ 0, %.lr.ph61 ]
  %33 = tail call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.04460.us)
  %34 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %33, i32 noundef 0)
  %35 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %33, i32 noundef 1)
  %36 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %33, i32 noundef 2)
  %37 = getelementptr inbounds i8, ptr %34, i64 120
  %38 = load i32, ptr %37, align 8, !tbaa !8
  %39 = add nsw i32 %38, 1
  %40 = getelementptr inbounds i8, ptr %35, i64 120
  %41 = load i32, ptr %40, align 8, !tbaa !8
  %42 = add nsw i32 %41, 1
  %43 = getelementptr inbounds i8, ptr %36, i64 120
  %44 = load i32, ptr %43, align 8, !tbaa !8
  %45 = add nsw i32 %44, 1
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.166, i32 noundef %39, i32 noundef %42, i32 noundef %45, i32 noundef %39, i32 noundef %42, i32 noundef %45) #5
  %47 = add nuw nsw i32 %.04460.us, 1
  %48 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %.lr.ph61.split.us, label %._crit_edge62, !llvm.loop !23

.lr.ph59.split:                                   ; preds = %.lr.ph59.split.preheader, %.lr.ph59.split
  %.04557 = phi i32 [ %57, %.lr.ph59.split ], [ 0, %.lr.ph59.split.preheader ]
  %50 = tail call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.04557)
  %51 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %50)
  %52 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %50)
  %53 = tail call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
  %54 = tail call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
  %55 = tail call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %51)
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.165, double noundef %53, double noundef %54, double noundef %55) #5
  %57 = add nuw nsw i32 %.04557, 1
  %58 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %.lr.ph59.split, label %.preheader, !llvm.loop !7

._crit_edge62:                                    ; preds = %.lr.ph61.split, %.lr.ph61.split.us, %.preheader.thread, %.preheader
  %60 = tail call i32 @fclose(ptr noundef nonnull %3)
  br label %78

.lr.ph61.split:                                   ; preds = %.lr.ph61.split.preheader, %.lr.ph61.split
  %.04460 = phi i32 [ %75, %.lr.ph61.split ], [ 0, %.lr.ph61.split.preheader ]
  %61 = tail call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.04460)
  %62 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %61, i32 noundef 0)
  %63 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %61, i32 noundef 1)
  %64 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %61, i32 noundef 2)
  %65 = getelementptr inbounds i8, ptr %62, i64 120
  %66 = load i32, ptr %65, align 8, !tbaa !8
  %67 = add nsw i32 %66, 1
  %68 = getelementptr inbounds i8, ptr %63, i64 120
  %69 = load i32, ptr %68, align 8, !tbaa !8
  %70 = add nsw i32 %69, 1
  %71 = getelementptr inbounds i8, ptr %64, i64 120
  %72 = load i32, ptr %71, align 8, !tbaa !8
  %73 = add nsw i32 %72, 1
  %74 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %3, ptr noundef nonnull @.str.167, i32 noundef %67, i32 noundef %70, i32 noundef %73) #5
  %75 = add nuw nsw i32 %.04460, 1
  %76 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %.lr.ph61.split, label %._crit_edge62, !llvm.loop !23

78:                                               ; preds = %._crit_edge62, %5
  %.0 = phi i32 [ 1, %._crit_edge62 ], [ 0, %5 ]
  ret i32 %.0
}

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

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 = { 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { 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 #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !15, i64 120}
!9 = !{!"_ZTS12R3MeshVertex", !10, i64 8, !16, i64 24, !17, i64 48, !18, i64 72, !19, i64 88, !20, i64 112, !15, i64 120, !21, i64 128, !20, i64 136, !15, i64 144, !12, i64 152}
!10 = !{!"_ZTS7RNArrayIP10R3MeshEdgeE", !11, i64 0}
!11 = !{!"_ZTS8RNVArray", !12, i64 0, !15, i64 8, !15, i64 12}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"int", !13, i64 0}
!16 = !{!"_ZTS7R3Point", !13, i64 0}
!17 = !{!"_ZTS8R3Vector", !13, i64 0}
!18 = !{!"_ZTS7R2Point", !13, i64 0}
!19 = !{!"_ZTS5RNRgb", !13, i64 0}
!20 = !{!"double", !13, i64 0}
!21 = !{!"_ZTS7RNFlags", !22, i64 0}
!22 = !{!"long", !13, i64 0}
!23 = distinct !{!23, !6}


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