; LLVM IR from artvns/SimpleFvm :: simplefvm/tests/FVMSolver_Test/CommonInitData/DataDefaultIteration1/MeshParams_D_592d0bbb (DefaultIter111createMeshVEv)

; 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.commoninitdata::MeshParams_DefaultIter1" = type { %"class.datastores::MeshParametersStore", %"class.datastores::MeshParametersStore", %"class.datastores::MeshParametersStore", %"class.fvmsolver::SolverMeshParamsMask", %"class.fvmsolver::SolverMeshParamsMask", %"class.fvmsolver::SolverMeshParamsMask", i64, i64, i64 }
%"class.datastores::MeshParametersStore" = type { %"class.datastores::ArrayAdt", %"class.datastores::ArrayAdt" }
%"class.datastores::ArrayAdt" = type { %"class.std::vector", i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.fvmsolver::SolverMeshParamsMask" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14commoninitdata23MeshParams_DefaultIter111createMeshVEv(ptr noundef nonnull align 8 dereferenceable(240) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %"class.commoninitdata::MeshParams_DefaultIter1", ptr %4, i32 0, i32 1
  %6 = getelementptr inbounds %"class.commoninitdata::MeshParams_DefaultIter1", ptr %4, i32 0, i32 7
  %7 = load i64, ptr %6, align 8, !tbaa !9
  call void @_ZN10datastores19MeshParametersStore12createArraysEm(ptr noundef nonnull align 8 dereferenceable(64) %5, i64 noundef %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 0, ptr %3, align 8, !tbaa !19
  br label %8

8:                                                ; preds = %21, %1
  %9 = load i64, ptr %3, align 8, !tbaa !19
  %10 = getelementptr inbounds %"class.commoninitdata::MeshParams_DefaultIter1", ptr %4, i32 0, i32 7
  %11 = load i64, ptr %10, align 8, !tbaa !9
  %12 = icmp ult i64 %9, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %24

14:                                               ; preds = %8
  %15 = getelementptr inbounds %"class.commoninitdata::MeshParams_DefaultIter1", ptr %4, i32 0, i32 1
  %16 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dXEv(ptr noundef nonnull align 8 dereferenceable(64) %15)
  %17 = load i64, ptr %3, align 8, !tbaa !19
  call void @_ZN10datastores8ArrayAdtIdE8setValueEmd(ptr noundef nonnull align 8 dereferenceable(32) %16, i64 noundef %17, double noundef 1.000000e-03)
  %18 = getelementptr inbounds %"class.commoninitdata::MeshParams_DefaultIter1", ptr %4, i32 0, i32 1
  %19 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dYEv(ptr noundef nonnull align 8 dereferenceable(64) %18)
  %20 = load i64, ptr %3, align 8, !tbaa !19
  call void @_ZN10datastores8ArrayAdtIdE8setValueEmd(ptr noundef nonnull align 8 dereferenceable(32) %19, i64 noundef %20, double noundef 1.000000e-03)
  br label %21

21:                                               ; preds = %14
  %22 = load i64, ptr %3, align 8, !tbaa !19
  %23 = add i64 %22, 1
  store i64 %23, ptr %3, align 8, !tbaa !19
  br label %8, !llvm.loop !20

24:                                               ; preds = %13
  ret void
}

declare void @_ZN10datastores19MeshParametersStore12createArraysEm(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) #1

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

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dXEv(ptr noundef nonnull align 8 dereferenceable(64)) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10datastores8ArrayAdtIdE8setValueEmd(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, double noundef) #0 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dYEv(ptr noundef nonnull align 8 dereferenceable(64)) #1

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

attributes #0 = { 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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !17, i64 224}
!10 = !{!"_ZTSN14commoninitdata23MeshParams_DefaultIter1E", !11, i64 0, !11, i64 64, !11, i64 128, !18, i64 192, !18, i64 200, !18, i64 208, !17, i64 216, !17, i64 224, !17, i64 232}
!11 = !{!"_ZTSN10datastores19MeshParametersStoreE", !12, i64 0, !12, i64 32}
!12 = !{!"_ZTSN10datastores8ArrayAdtIdEE", !13, i64 0, !17, i64 24}
!13 = !{!"_ZTSSt6vectorIdSaIdEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSN9fvmsolver20SolverMeshParamsMaskE", !6, i64 0}
!19 = !{!17, !17, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14commoninitdata23MeshParams_DefaultIter111createMeshVEv(ptr noundef nonnull align 8 dereferenceable(240) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 64
  %3 = getelementptr inbounds i8, ptr %0, i64 224
  %4 = load i64, ptr %3, align 8, !tbaa !5
  tail call void @_ZN10datastores19MeshParametersStore12createArraysEm(ptr noundef nonnull align 8 dereferenceable(64) %2, i64 noundef %4)
  %5 = load i64, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i64 %5, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  ret void

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.04 = phi i64 [ %8, %.lr.ph ], [ 0, %1 ]
  %6 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dXEv(ptr noundef nonnull align 8 dereferenceable(64) %2)
  tail call void @_ZN10datastores8ArrayAdtIdE8setValueEmd(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %.04, double noundef 1.000000e-03)
  %7 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dYEv(ptr noundef nonnull align 8 dereferenceable(64) %2)
  tail call void @_ZN10datastores8ArrayAdtIdE8setValueEmd(ptr noundef nonnull align 8 dereferenceable(32) %7, i64 noundef %.04, double noundef 1.000000e-03)
  %8 = add nuw i64 %.04, 1
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = icmp ult i64 %8, %9
  br i1 %10, label %.lr.ph, label %._crit_edge, !llvm.loop !18
}

declare void @_ZN10datastores19MeshParametersStore12createArraysEm(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dXEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10datastores8ArrayAdtIdE8setValueEmd(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, double noundef) local_unnamed_addr #0 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZN10datastores19MeshParametersStore6get_dYEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

attributes #0 = { 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 = { "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" }

!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, !16, i64 224}
!6 = !{!"_ZTSN14commoninitdata23MeshParams_DefaultIter1E", !7, i64 0, !7, i64 64, !7, i64 128, !17, i64 192, !17, i64 200, !17, i64 208, !16, i64 216, !16, i64 224, !16, i64 232}
!7 = !{!"_ZTSN10datastores19MeshParametersStoreE", !8, i64 0, !8, i64 32}
!8 = !{!"_ZTSN10datastores8ArrayAdtIdEE", !9, i64 0, !16, i64 24}
!9 = !{!"_ZTSSt6vectorIdSaIdEE", !10, i64 0}
!10 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !11, i64 0}
!11 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"any pointer", !14, i64 0}
!14 = !{!"omnipotent char", !15, i64 0}
!15 = !{!"Simple C++ TBAA"}
!16 = !{!"long", !14, i64 0}
!17 = !{!"_ZTSN9fvmsolver20SolverMeshParamsMaskE", !13, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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