; LLVM IR from buresjan/optim_lbm :: nomad/src/Algos/QuadModel (QuadModelInitialization)

; 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.NOMAD_4_3::Step" = type <{ ptr, ptr, i32, [4 x i8], %"class.std::shared_ptr.3", %"class.std::shared_ptr.6", %"class.std::shared_ptr.9", %"class.NOMAD_4_3::SuccessStats", i32, [4 x i8] }>
%"class.std::shared_ptr.3" = type { %"class.std::__shared_ptr.4" }
%"class.std::__shared_ptr.4" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::shared_ptr.6" = type { %"class.std::__shared_ptr.7" }
%"class.std::__shared_ptr.7" = type { ptr, %"class.std::__shared_count" }
%"class.std::shared_ptr.9" = type { %"class.std::__shared_ptr.10" }
%"class.std::__shared_ptr.10" = type { ptr, %"class.std::__shared_count" }
%"class.NOMAD_4_3::SuccessStats" = type { %"class.std::map", i64, i64 }
%"class.std::map" = type { %"class.std::_Rb_tree.12" }
%"class.std::_Rb_tree.12" = type { %"struct.std::_Rb_tree<std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>, std::pair<const std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>, unsigned long>, std::_Select1st<std::pair<const std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>, unsigned long>>, std::less<std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>, std::pair<const std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>, unsigned long>, std::_Select1st<std::pair<const std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>, unsigned long>>, std::less<std::pair<NOMAD_4_3::StepType, NOMAD_4_3::SuccessType>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.NOMAD_4_3::QuadModelInitialization" = type { %"class.NOMAD_4_3::Initialization", %"class.NOMAD_4_3::IterationUtils", %"class.std::shared_ptr" }
%"class.NOMAD_4_3::Initialization" = type { %"class.NOMAD_4_3::Step.base", %"class.NOMAD_4_3::TrialPointStats", %"class.std::shared_ptr.26" }
%"class.NOMAD_4_3::Step.base" = type <{ ptr, ptr, i32, [4 x i8], %"class.std::shared_ptr.3", %"class.std::shared_ptr.6", %"class.std::shared_ptr.9", %"class.NOMAD_4_3::SuccessStats", i32 }>
%"class.NOMAD_4_3::TrialPointStats" = type { ptr, %"class.std::vector", %"class.std::map.20", %"class.std::map.20", %"class.std::map.20", %"class.std::map.20", i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<NOMAD_4_3::EvalType, std::allocator<NOMAD_4_3::EvalType>>::_Vector_impl" }
%"struct.std::_Vector_base<NOMAD_4_3::EvalType, std::allocator<NOMAD_4_3::EvalType>>::_Vector_impl" = type { %"struct.std::_Vector_base<NOMAD_4_3::EvalType, std::allocator<NOMAD_4_3::EvalType>>::_Vector_impl_data" }
%"struct.std::_Vector_base<NOMAD_4_3::EvalType, std::allocator<NOMAD_4_3::EvalType>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map.20" = type { %"class.std::_Rb_tree.21" }
%"class.std::_Rb_tree.21" = type { %"struct.std::_Rb_tree<NOMAD_4_3::EvalType, std::pair<const NOMAD_4_3::EvalType, unsigned long>, std::_Select1st<std::pair<const NOMAD_4_3::EvalType, unsigned long>>, std::less<NOMAD_4_3::EvalType>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<NOMAD_4_3::EvalType, std::pair<const NOMAD_4_3::EvalType, unsigned long>, std::_Select1st<std::pair<const NOMAD_4_3::EvalType, unsigned long>>, std::less<NOMAD_4_3::EvalType>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::shared_ptr.26" = type { %"class.std::__shared_ptr.27" }
%"class.std::__shared_ptr.27" = type { ptr, %"class.std::__shared_count" }
%"class.NOMAD_4_3::IterationUtils" = type { ptr, %"class.std::set", i64, ptr, ptr, ptr, %"class.NOMAD_4_3::TrialPointStats", i8, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<NOMAD_4_3::EvalPoint, NOMAD_4_3::EvalPoint, std::_Identity<NOMAD_4_3::EvalPoint>, NOMAD_4_3::EvalPointCompare>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<NOMAD_4_3::EvalPoint, NOMAD_4_3::EvalPoint, std::_Identity<NOMAD_4_3::EvalPoint>, NOMAD_4_3::EvalPointCompare>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_314AllStopReasonsELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK9NOMAD_4_34Step15getParentOfTypeIPNS_16QuadSearchMethodEEET_b(ptr noundef nonnull align 8 dereferenceable(140), i1 noundef zeroext) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9NOMAD_4_323QuadModelInitialization6runImpEv(ptr noundef nonnull align 8 dereferenceable(736) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #3
  %7 = getelementptr inbounds %"class.NOMAD_4_3::Step", ptr %6, i32 0, i32 4
  %8 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_314AllStopReasonsELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %7) #3
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds ptr, ptr %9, i64 4
  %11 = load ptr, ptr %10, align 8
  %12 = call noundef zeroext i1 %11(ptr noundef nonnull align 8 dereferenceable(24) %8)
  %13 = xor i1 %12, true
  %14 = zext i1 %13 to i8
  store i8 %14, ptr %3, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %15 = call noundef ptr @_ZNK9NOMAD_4_34Step15getParentOfTypeIPNS_16QuadSearchMethodEEET_b(ptr noundef nonnull align 8 dereferenceable(140) %6, i1 noundef zeroext false)
  store ptr %15, ptr %4, align 8, !tbaa !5
  %16 = load i8, ptr %3, align 1, !tbaa !11, !range !13, !noundef !14
  %17 = trunc i8 %16 to i1
  br i1 %17, label %18, label %41

18:                                               ; preds = %1
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %41

21:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  %22 = call noundef zeroext i1 @_ZN9NOMAD_4_323QuadModelInitialization8eval_x0sEv(ptr noundef nonnull align 8 dereferenceable(736) %6)
  %23 = zext i1 %22 to i8
  store i8 %23, ptr %5, align 1, !tbaa !11
  %24 = getelementptr inbounds %"class.NOMAD_4_3::Step", ptr %6, i32 0, i32 4
  %25 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_314AllStopReasonsELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %24) #3
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 4
  %28 = load ptr, ptr %27, align 8
  %29 = call noundef zeroext i1 %28(ptr noundef nonnull align 8 dereferenceable(24) %25)
  %30 = xor i1 %29, true
  %31 = zext i1 %30 to i8
  store i8 %31, ptr %3, align 1, !tbaa !11
  %32 = load i8, ptr %3, align 1, !tbaa !11, !range !13, !noundef !14
  %33 = trunc i8 %32 to i1
  br i1 %33, label %34, label %37

34:                                               ; preds = %21
  %35 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc i8 %35 to i1
  br i1 %36, label %40, label %37

37:                                               ; preds = %34, %21
  %38 = getelementptr inbounds %"class.NOMAD_4_3::QuadModelInitialization", ptr %6, i32 0, i32 2
  %39 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_315AlgoStopReasonsINS0_13ModelStopTypeEEELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %38) #3
  call void @_ZN9NOMAD_4_315AlgoStopReasonsINS_13ModelStopTypeEE3setES1_(ptr noundef nonnull align 8 dereferenceable(40) %39, i32 noundef 7)
  br label %40

40:                                               ; preds = %37, %34
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  br label %41

41:                                               ; preds = %40, %18, %1
  %42 = load i8, ptr %3, align 1, !tbaa !11, !range !13, !noundef !14
  %43 = trunc i8 %42 to i1
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #3
  ret i1 %43
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN9NOMAD_4_323QuadModelInitialization8eval_x0sEv(ptr noundef nonnull align 8 dereferenceable(736)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_315AlgoStopReasonsINS0_13ModelStopTypeEEELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9NOMAD_4_315AlgoStopReasonsINS_13ModelStopTypeEE3setES1_(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_314AllStopReasonsELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK9NOMAD_4_34Step15getParentOfTypeIPNS_16QuadSearchMethodEEET_b(ptr noundef nonnull align 8 dereferenceable(140), i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9NOMAD_4_323QuadModelInitialization6runImpEv(ptr noundef nonnull align 8 dereferenceable(736) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_314AllStopReasonsELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %2) #2
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 32
  %6 = load ptr, ptr %5, align 8
  %7 = tail call noundef zeroext i1 %6(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %8 = tail call noundef ptr @_ZNK9NOMAD_4_34Step15getParentOfTypeIPNS_16QuadSearchMethodEEET_b(ptr noundef nonnull align 8 dereferenceable(140) %0, i1 noundef zeroext false)
  %9 = icmp ne ptr %8, null
  %or.cond.not = or i1 %7, %9
  br i1 %or.cond.not, label %20, label %10

10:                                               ; preds = %1
  %11 = tail call noundef zeroext i1 @_ZN9NOMAD_4_323QuadModelInitialization8eval_x0sEv(ptr noundef nonnull align 8 dereferenceable(736) %0)
  %12 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_314AllStopReasonsELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %2) #2
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 32
  %15 = load ptr, ptr %14, align 8
  %16 = tail call noundef zeroext i1 %15(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %.not = xor i1 %11, true
  %brmerge = or i1 %16, %.not
  br i1 %brmerge, label %17, label %20

17:                                               ; preds = %10
  %18 = getelementptr inbounds i8, ptr %0, i64 720
  %19 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_315AlgoStopReasonsINS0_13ModelStopTypeEEELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %18) #2
  tail call void @_ZN9NOMAD_4_315AlgoStopReasonsINS_13ModelStopTypeEE3setES1_(ptr noundef nonnull align 8 dereferenceable(40) %19, i32 noundef 7)
  br label %20

20:                                               ; preds = %17, %10, %1
  %.0.in.in = phi i1 [ %7, %1 ], [ false, %10 ], [ %16, %17 ]
  %.0.in = xor i1 %.0.in.in, true
  ret i1 %.0.in
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN9NOMAD_4_323QuadModelInitialization8eval_x0sEv(ptr noundef nonnull align 8 dereferenceable(736)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt19__shared_ptr_accessIN9NOMAD_4_315AlgoStopReasonsINS0_13ModelStopTypeEEELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9NOMAD_4_315AlgoStopReasonsINS_13ModelStopTypeEE3setES1_(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #1 align 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 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass