; 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" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 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_7VectorTIfLi3EEE(ptr noundef nonnull align 8 dereferenceable(120) %0, <2 x float> %1, float %2) #1 align 2 {
  %4 = alloca i64, align 8
  %5 = alloca %"class.OpenMesh::VectorT", align 4
  %6 = alloca { <2 x float>, float }, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = getelementptr inbounds { <2 x float>, float }, ptr %6, i32 0, i32 0
  store <2 x float> %1, ptr %10, align 4
  %11 = getelementptr inbounds { <2 x float>, float }, ptr %6, i32 0, i32 1
  store float %2, ptr %11, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %6, i64 12, i1 false)
  store ptr %0, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 0, ptr %8, align 8, !tbaa !9
  br label %13

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

18:                                               ; preds = %13
  store i32 2, ptr %9, align 4
  br label %30

19:                                               ; preds = %13
  %20 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %12, i32 0, i32 3
  %21 = load i64, ptr %8, align 8, !tbaa !9
  %22 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %21) #5
  %23 = call noundef zeroext i1 @_ZNK8OpenMesh7VectorTIfLi3EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %22, ptr noundef nonnull align 4 dereferenceable(12) %5)
  br i1 %23, label %24, label %26

24:                                               ; preds = %19
  %25 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %25, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %30

26:                                               ; preds = %19
  br label %27

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

30:                                               ; preds = %24, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %31 = load i32, ptr %9, align 4
  switch i32 %31, label %39 [
    i32 2, label %32
    i32 1, label %37
  ]

32:                                               ; preds = %30
  %33 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %12, i32 0, i32 3
  call void @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 4 dereferenceable(12) %5)
  %34 = getelementptr inbounds %"class.OpenMesh::IO::_OBJWriter_", ptr %12, i32 0, i32 3
  %35 = call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #5
  %36 = sub i64 %35, 1
  store i64 %36, ptr %4, align 8
  br label %37

37:                                               ; preds = %32, %30
  %38 = load i64, ptr %4, align 8
  ret i64 %38

39:                                               ; preds = %30
  unreachable
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) #4 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!"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" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }

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

.lr.ph:                                           ; preds = %3, %9
  %.0613 = phi i64 [ %10, %9 ], [ 0, %3 ]
  %7 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.0613) #3
  %8 = call noundef zeroext i1 @_ZNK8OpenMesh7VectorTIfLi3EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %4)
  br i1 %8, label %.loopexit, label %9

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

._crit_edge:                                      ; preds = %9, %3
  call void @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 4 dereferenceable(12) %4)
  %13 = call noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %14 = add i64 %13, -1
  br label %.loopexit

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_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(12) ptr @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_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 @_ZNK8OpenMesh7VectorTIfLi3EEeqERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN8OpenMesh7VectorTIfLi3EEESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) 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