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

; 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.135 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.177 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.178 = external hidden unnamed_addr constant [8 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: 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

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

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

declare i32 @fclose(ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Mesh12WriteIfsFileEPKc(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1) unnamed_addr #4 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca [3 x float], align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca [3 x i32], align 4
  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 4, ptr %6) #5
  store float 1.000000e+00, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %22 = call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  store i32 %22, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %23 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  store i32 %23, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call noalias ptr @fopen(ptr noundef %24, ptr noundef @.str.177)
  store ptr %25, ptr %9, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %29, label %27

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

29:                                               ; preds = %2
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef %30, ptr noundef @.str.135)
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = call i64 @fwrite(ptr noundef %6, i64 noundef 4, i64 noundef 1, ptr noundef %32)
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef %34, ptr noundef @.str.178)
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef %36, ptr noundef @.str.141)
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = call i64 @fwrite(ptr noundef %7, i64 noundef 4, i64 noundef 1, ptr noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %40

40:                                               ; preds = %64, %29
  %41 = load i32, ptr %11, align 4, !tbaa !11
  %42 = load i32, ptr %7, align 4, !tbaa !11
  %43 = icmp ult i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %67

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %46 = load i32, ptr %11, align 4, !tbaa !11
  %47 = call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %21, i32 noundef %46)
  store ptr %47, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %48)
  store ptr %49, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %14) #5
  %50 = load ptr, ptr %13, align 8, !tbaa !5
  %51 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %50)
  %52 = fptrunc double %51 to float
  %53 = getelementptr inbounds [3 x float], ptr %14, i64 0, i64 0
  store float %52, ptr %53, align 4, !tbaa !9
  %54 = load ptr, ptr %13, align 8, !tbaa !5
  %55 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %54)
  %56 = fptrunc double %55 to float
  %57 = getelementptr inbounds [3 x float], ptr %14, i64 0, i64 1
  store float %56, ptr %57, align 4, !tbaa !9
  %58 = load ptr, ptr %13, align 8, !tbaa !5
  %59 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %58)
  %60 = fptrunc double %59 to float
  %61 = getelementptr inbounds [3 x float], ptr %14, i64 0, i64 2
  store float %60, ptr %61, align 4, !tbaa !9
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = call i64 @fwrite(ptr noundef %14, i64 noundef 4, i64 noundef 3, ptr noundef %62)
  call void @llvm.lifetime.end.p0(i64 12, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %64

64:                                               ; preds = %45
  %65 = load i32, ptr %11, align 4, !tbaa !11
  %66 = add i32 %65, 1
  store i32 %66, ptr %11, align 4, !tbaa !11
  br label %40, !llvm.loop !13

67:                                               ; preds = %44
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef %68, ptr noundef @.str.146)
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = call i64 @fwrite(ptr noundef %8, i64 noundef 4, i64 noundef 1, ptr noundef %70)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %72

72:                                               ; preds = %100, %67
  %73 = load i32, ptr %15, align 4, !tbaa !11
  %74 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %103

77:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %78 = load i32, ptr %15, align 4, !tbaa !11
  %79 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %21, i32 noundef %78)
  store ptr %79, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %80 = load ptr, ptr %16, align 8, !tbaa !5
  %81 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %80, i32 noundef 0)
  store ptr %81, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %82, i32 noundef 1)
  store ptr %83, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %84 = load ptr, ptr %16, align 8, !tbaa !5
  %85 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %21, ptr noundef %84, i32 noundef 2)
  store ptr %85, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %20) #5
  %86 = load ptr, ptr %17, align 8, !tbaa !5
  %87 = getelementptr inbounds %class.R3MeshVertex, ptr %86, i32 0, i32 7
  %88 = load i32, ptr %87, align 8, !tbaa !15
  %89 = getelementptr inbounds [3 x i32], ptr %20, i64 0, i64 0
  store i32 %88, ptr %89, align 4, !tbaa !11
  %90 = load ptr, ptr %18, align 8, !tbaa !5
  %91 = getelementptr inbounds %class.R3MeshVertex, ptr %90, i32 0, i32 7
  %92 = load i32, ptr %91, align 8, !tbaa !15
  %93 = getelementptr inbounds [3 x i32], ptr %20, i64 0, i64 1
  store i32 %92, ptr %93, align 4, !tbaa !11
  %94 = load ptr, ptr %19, align 8, !tbaa !5
  %95 = getelementptr inbounds %class.R3MeshVertex, ptr %94, i32 0, i32 7
  %96 = load i32, ptr %95, align 8, !tbaa !15
  %97 = getelementptr inbounds [3 x i32], ptr %20, i64 0, i64 2
  store i32 %96, ptr %97, align 4, !tbaa !11
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = call i64 @fwrite(ptr noundef %20, i64 noundef 4, i64 noundef 3, ptr noundef %98)
  call void @llvm.lifetime.end.p0(i64 12, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %100

100:                                              ; preds = %77
  %101 = load i32, ptr %15, align 4, !tbaa !11
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %15, align 4, !tbaa !11
  br label %72, !llvm.loop !26

103:                                              ; preds = %76
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = call i32 @fclose(ptr noundef %104)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %106

106:                                              ; preds = %103, %27
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %107 = load i32, ptr %3, align 4
  ret i32 %107
}

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef, ptr noundef) #4

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

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


; 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.135 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.177 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.178 = external hidden unnamed_addr constant [8 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: 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: 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 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

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 #4

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK6R3Mesh12WriteIfsFileEPKc(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1) unnamed_addr #5 align 2 {
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [3 x float], align 8
  %7 = alloca [3 x i32], align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store float 1.000000e+00, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %8 = tail call noundef i32 @_ZNK6R3Mesh9NVerticesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  store i32 %8, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %9 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  store i32 %9, ptr %5, align 4, !tbaa !9
  %10 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.177)
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %11, label %12

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

12:                                               ; preds = %2
  %13 = tail call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef nonnull %10, ptr noundef nonnull @.str.135)
  %14 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %10)
  %15 = tail call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef nonnull %10, ptr noundef nonnull @.str.178)
  %16 = tail call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef nonnull %10, ptr noundef nonnull @.str.141)
  %17 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %10)
  %18 = load i32, ptr %4, align 4, !tbaa !9
  %.not37 = icmp eq i32 %18, 0
  br i1 %.not37, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %12
  %19 = getelementptr inbounds i8, ptr %6, i64 8
  br label %26

._crit_edge:                                      ; preds = %26, %12
  %20 = tail call noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef nonnull %10, ptr noundef nonnull @.str.146)
  %21 = call i64 @fwrite(ptr noundef nonnull %5, i64 noundef 4, i64 noundef 1, ptr noundef nonnull %10)
  %22 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph35, label %._crit_edge36

.lr.ph35:                                         ; preds = %._crit_edge
  %24 = getelementptr inbounds i8, ptr %7, i64 4
  %25 = getelementptr inbounds i8, ptr %7, i64 8
  br label %39

26:                                               ; preds = %.lr.ph, %26
  %.02932 = phi i32 [ 0, %.lr.ph ], [ %37, %26 ]
  %27 = tail call noundef ptr @_ZNK6R3Mesh6VertexEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.02932)
  %28 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #6
  %29 = tail call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %30 = tail call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %31 = insertelement <2 x double> poison, double %29, i64 0
  %32 = insertelement <2 x double> %31, double %30, i64 1
  %33 = fptrunc <2 x double> %32 to <2 x float>
  store <2 x float> %33, ptr %6, align 8, !tbaa !5
  %34 = tail call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %35 = fptrunc double %34 to float
  store float %35, ptr %19, align 8, !tbaa !5
  %36 = call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 4, i64 noundef 3, ptr noundef nonnull %10)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #6
  %37 = add nuw i32 %.02932, 1
  %exitcond.not = icmp eq i32 %37, %18
  br i1 %exitcond.not, label %._crit_edge, label %26, !llvm.loop !11

._crit_edge36:                                    ; preds = %39, %._crit_edge
  %38 = tail call i32 @fclose(ptr noundef nonnull %10)
  br label %54

39:                                               ; preds = %.lr.ph35, %39
  %.03033 = phi i32 [ 0, %.lr.ph35 ], [ %51, %39 ]
  %40 = tail call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.03033)
  %41 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 0)
  %42 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 1)
  %43 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #6
  %44 = getelementptr inbounds i8, ptr %41, i64 120
  %45 = load i32, ptr %44, align 8, !tbaa !13
  store i32 %45, ptr %7, align 4, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %42, i64 120
  %47 = load i32, ptr %46, align 8, !tbaa !13
  store i32 %47, ptr %24, align 4, !tbaa !9
  %48 = getelementptr inbounds i8, ptr %43, i64 120
  %49 = load i32, ptr %48, align 8, !tbaa !13
  store i32 %49, ptr %25, align 4, !tbaa !9
  %50 = call i64 @fwrite(ptr noundef nonnull %7, i64 noundef 4, i64 noundef 3, ptr noundef nonnull %10)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #6
  %51 = add nuw nsw i32 %.03033, 1
  %52 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %39, label %._crit_edge36, !llvm.loop !25

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

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL14WriteIfsStringP8_IO_FILEPKc(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture 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 = { "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 = { 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 #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 = !{!"float", !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 = !{!14, !10, i64 120}
!14 = !{!"_ZTS12R3MeshVertex", !15, 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, !17, i64 152}
!15 = !{!"_ZTS7RNArrayIP10R3MeshEdgeE", !16, i64 0}
!16 = !{!"_ZTS8RNVArray", !17, i64 0, !10, i64 8, !10, i64 12}
!17 = !{!"any pointer", !7, i64 0}
!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}


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