; LLVM IR from bldeng/AASolver :: AndersonOpt/external/OpenMesh/Core/IO/writer (OBJWriter)

; 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.OpenMesh::VectorT.28" = type { %"struct.std::array.29" }
%"struct.std::array.29" = type { [4 x float] }
%"class.OpenMesh::IO::_OBJWriter_" = type { %"class.OpenMesh::IO::BaseWriter", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::vector", %"class.std::vector.3" }
%"class.OpenMesh::IO::BaseWriter" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<OpenMesh::VectorT<float, 3>, std::allocator<OpenMesh::VectorT<float, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<OpenMesh::VectorT<float, 3>, std::allocator<OpenMesh::VectorT<float, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<OpenMesh::VectorT<float, 3>, std::allocator<OpenMesh::VectorT<float, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<OpenMesh::VectorT<float, 3>, std::allocator<OpenMesh::VectorT<float, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<OpenMesh::VectorT<float, 4>, std::allocator<OpenMesh::VectorT<float, 4>>>::_Vector_impl" }
%"struct.std::_Vector_base<OpenMesh::VectorT<float, 4>, std::allocator<OpenMesh::VectorT<float, 4>>>::_Vector_impl" = type { %"struct.std::_Vector_base<OpenMesh::VectorT<float, 4>, std::allocator<OpenMesh::VectorT<float, 4>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<OpenMesh::VectorT<float, 4>, std::allocator<OpenMesh::VectorT<float, 4>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK8OpenMesh2IO11_OBJWriter_11getMaterialENS_7VectorTIfLi4EEE(ptr noundef nonnull align 8 dereferenceable(120) %0, <2 x float> %1, <2 x float> %2) #1 align 2 {
  %4 = alloca i64, align 8
  %5 = alloca %"class.OpenMesh::VectorT.28", align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 0
  store <2 x float> %1, ptr %9, align 4
  %10 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 1
  store <2 x float> %2, ptr %10, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %26, %3
  %13 = load i64, ptr %7, align 8, !tbaa !9
  %14 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %11, i32 0, i32 4
  %15 = call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #4
  %16 = icmp ult i64 %13, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %12
  store i32 2, ptr %8, align 4
  br label %29

18:                                               ; preds = %12
  %19 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %11, i32 0, i32 4
  %20 = load i64, ptr %7, align 8, !tbaa !9
  %21 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %20) #4
  %22 = call noundef zeroext i1 @_ZNK8OpenMesh7VectorTIfLi4EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(16) %5)
  br i1 %22, label %23, label %25

23:                                               ; preds = %18
  %24 = load i64, ptr %7, align 8, !tbaa !9
  store i64 %24, ptr %4, align 8
  store i32 1, ptr %8, align 4
  br label %29

25:                                               ; preds = %18
  br label %26

26:                                               ; preds = %25
  %27 = load i64, ptr %7, align 8, !tbaa !9
  %28 = add i64 %27, 1
  store i64 %28, ptr %7, align 8, !tbaa !9
  br label %12, !llvm.loop !11

29:                                               ; preds = %23, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %30 = load i32, ptr %8, align 4
  switch i32 %30, label %38 [
    i32 2, label %31
    i32 1, label %36
  ]

31:                                               ; preds = %29
  %32 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %11, i32 0, i32 4
  call void @_ZNSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 4 dereferenceable(16) %5)
  %33 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %11, i32 0, i32 4
  %34 = call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %33) #4
  %35 = sub i64 %34, 1
  store i64 %35, ptr %4, align 8
  br label %36

36:                                               ; preds = %31, %29
  %37 = load i64, ptr %4, align 8
  ret i64 %37

38:                                               ; preds = %29
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh7VectorTIfLi4EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

%"class.OpenMesh::VectorT.28" = type { %"struct.std::array.29" }
%"struct.std::array.29" = type { [4 x float] }

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK8OpenMesh2IO11_OBJWriter_11getMaterialENS_7VectorTIfLi4EEE(ptr noundef nonnull align 8 dereferenceable(120) %0, <2 x float> %1, <2 x float> %2) local_unnamed_addr #0 align 2 {
  %4 = alloca %"class.OpenMesh::VectorT.28", align 8
  store <2 x float> %1, ptr %4, align 8
  %5 = getelementptr inbounds i8, ptr %4, i64 8
  store <2 x float> %2, ptr %5, align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 96
  %7 = tail call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %3, %10
  %.0613 = phi i64 [ %11, %10 ], [ 0, %3 ]
  %8 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %.0613) #3
  %9 = call noundef zeroext i1 @_ZNK8OpenMesh7VectorTIfLi4EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(16) %4)
  br i1 %9, label %.loopexit, label %10

10:                                               ; preds = %.lr.ph
  %11 = add nuw i64 %.0613, 1
  %12 = call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %13 = icmp ult i64 %11, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %10, %3
  call void @_ZNSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 4 dereferenceable(16) %4)
  %14 = call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi4EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %15 = add i64 %14, -1
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %._crit_edge
  %.1 = phi i64 [ %15, %._crit_edge ], [ %.0613, %.lr.ph ]
  ret i64 %.1
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh7VectorTIfLi4EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 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 = { 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 #3 = { 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"}


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