; LLVM IR from bohanwang/libpgo :: src/core/volumetricMesh (volumetricMeshParser)

; 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.pgo::VolumetricMeshes::VolumetricMeshParser" = type <{ ptr, %"class.std::vector", %"class.std::__cxx11::basic_string", [96 x i8], i32, [4 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<_IO_FILE *, std::allocator<_IO_FILE *>>::_Vector_impl" }
%"struct.std::_Vector_base<_IO_FILE *, std::allocator<_IO_FILE *>>::_Vector_impl" = type { %"struct.std::_Vector_base<_IO_FILE *, std::allocator<_IO_FILE *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<_IO_FILE *, std::allocator<_IO_FILE *>>::_Vector_impl_data" = type { ptr, ptr, 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] }

@.str = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3pgo16VolumetricMeshes20VolumetricMeshParserC2EPKc(ptr noundef nonnull align 8 dereferenceable(164) %0, ptr noundef %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 0
  store ptr null, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 1
  call void @_ZNSt6vectorIP8_IO_FILESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #3
  %8 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 2
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #3
  %9 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 0
  store ptr null, ptr %9, align 8, !tbaa !9
  br label %10

10:                                               ; preds = %14, %2
  %11 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 1
  %12 = call noundef zeroext i1 @_ZNKSt6vectorIP8_IO_FILESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %13 = xor i1 %12, true
  br i1 %13, label %14, label %16

14:                                               ; preds = %10
  %15 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 1
  call void @_ZNSt6vectorIP8_IO_FILESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  br label %10, !llvm.loop !19

16:                                               ; preds = %10
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %24

19:                                               ; preds = %16
  %20 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 4
  store i32 9, ptr %20, align 8, !tbaa !21
  %21 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 3
  %22 = getelementptr inbounds [96 x i8], ptr %21, i64 0, i64 0
  %23 = call ptr @strcpy(ptr noundef %22, ptr noundef @.str) #3
  br label %33

24:                                               ; preds = %16
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call i64 @strlen(ptr noundef %25) #4
  %27 = trunc i64 %26 to i32
  %28 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 4
  store i32 %27, ptr %28, align 8, !tbaa !21
  %29 = getelementptr inbounds %"class.pgo::VolumetricMeshes::VolumetricMeshParser", ptr %5, i32 0, i32 3
  %30 = getelementptr inbounds [96 x i8], ptr %29, i64 0, i64 0
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = call ptr @strcpy(ptr noundef %30, ptr noundef %31) #3
  br label %33

33:                                               ; preds = %24, %19
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8_IO_FILESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIP8_IO_FILESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

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

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

attributes #0 = { 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 #1 = { 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 #2 = { nounwind willreturn memory(read) "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 }
attributes #4 = { nounwind willreturn memory(read) }

!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, !6, i64 0}
!10 = !{!"_ZTSN3pgo16VolumetricMeshes20VolumetricMeshParserE", !6, i64 0, !11, i64 8, !15, i64 32, !7, i64 64, !18, i64 160}
!11 = !{!"_ZTSSt6vectorIP8_IO_FILESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIP8_IO_FILESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIP8_IO_FILESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIP8_IO_FILESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !17, i64 8, !7, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !18, i64 160}


; 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 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3pgo16VolumetricMeshes20VolumetricMeshParserC2EPKc(ptr noundef nonnull align 8 dereferenceable(164) %0, ptr noundef readonly %1) unnamed_addr #0 align 2 {
  store ptr null, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZNSt6vectorIP8_IO_FILESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #3
  store ptr null, ptr %0, align 8, !tbaa !5
  %5 = tail call noundef zeroext i1 @_ZNKSt6vectorIP8_IO_FILESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  br i1 %5, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  tail call void @_ZNSt6vectorIP8_IO_FILESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %6 = tail call noundef zeroext i1 @_ZNKSt6vectorIP8_IO_FILESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  br i1 %6, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph, %2
  %7 = icmp eq ptr %1, null
  br i1 %7, label %11, label %8

8:                                                ; preds = %._crit_edge
  %9 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #4
  %10 = trunc i64 %9 to i32
  br label %11

11:                                               ; preds = %._crit_edge, %8
  %.sink = phi i32 [ %10, %8 ], [ 9, %._crit_edge ]
  %.sink4 = phi ptr [ %1, %8 ], [ @.str, %._crit_edge ]
  %12 = getelementptr inbounds i8, ptr %0, i64 160
  store i32 %.sink, ptr %12, align 8, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %0, i64 64
  %14 = tail call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) %.sink4) #3
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8_IO_FILESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIP8_IO_FILESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIP8_IO_FILESaIS1_EE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 nofree nounwind willreturn memory(argmem: read) "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 }
attributes #4 = { nounwind willreturn memory(read) }

!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 = !{!"_ZTSN3pgo16VolumetricMeshes20VolumetricMeshParserE", !7, i64 0, !10, i64 8, !14, i64 32, !8, i64 64, !17, i64 160}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIP8_IO_FILESaIS1_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseIP8_IO_FILESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIP8_IO_FILESaIS1_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIP8_IO_FILESaIS1_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !8, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!"int", !8, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !17, i64 160}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass