; LLVM IR from buresjan/optim_lbm :: nomad/src/Eval (EvalPoint)

; 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::EvalPoint" = type { %"class.NOMAD_4_3::Point", [3 x %"class.std::unique_ptr"], i32, i32, i16, %"class.std::shared_ptr", %"class.std::vector", %"class.std::shared_ptr.8", %"class.NOMAD_4_3::Double", %"class.std::shared_ptr.11" }
%"class.NOMAD_4_3::Point" = type { %"class.NOMAD_4_3::ArrayOfDouble" }
%"class.NOMAD_4_3::ArrayOfDouble" = type { ptr, i64, ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.4" }
%"struct.std::_Head_base.4" = type { ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl" }
%"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl" = type { %"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl_data" }
%"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::shared_ptr.8" = type { %"class.std::__shared_ptr.9" }
%"class.std::__shared_ptr.9" = type { ptr, %"class.std::__shared_count" }
%"class.NOMAD_4_3::Double" = type <{ ptr, double, i8, [7 x i8] }>
%"class.std::shared_ptr.11" = type { %"class.std::__shared_ptr.12" }
%"class.std::__shared_ptr.12" = 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

declare i32 @__gxx_personality_v0(...)

; 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
declare dso_local noundef nonnull align 8 dereferenceable(160) ptr @_ZN9NOMAD_4_39EvalPointaSERKS0_(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(160)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK9NOMAD_4_39EvalPoint27makeFullSpacePointFromFixedERKNS_5PointE(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::EvalPoint") align 8, ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9NOMAD_4_322convertPointListToFullERSt6vectorINS_9EvalPointESaIS1_EERKNS_5PointE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.NOMAD_4_3::EvalPoint", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 0, ptr %5, align 8, !tbaa !9
  br label %9

9:                                                ; preds = %41, %2
  %10 = load i64, ptr %5, align 8, !tbaa !9
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call noundef i64 @_ZNKSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  %13 = icmp ult i64 %10, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %44

15:                                               ; preds = %9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = load i64, ptr %5, align 8, !tbaa !9
  %18 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZNSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %17) #4
  %19 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble9nbDefinedEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %24 = sub i64 %21, %23
  %25 = icmp eq i64 %19, %24
  br i1 %25, label %26, label %40

26:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 160, ptr %6) #4
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load i64, ptr %5, align 8, !tbaa !9
  %29 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZNSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %28) #4
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNK9NOMAD_4_39EvalPoint27makeFullSpacePointFromFixedERKNS_5PointE(ptr dead_on_unwind writable sret(%"class.NOMAD_4_3::EvalPoint") align 8 %6, ptr noundef nonnull align 8 dereferenceable(160) %29, ptr noundef nonnull align 8 dereferenceable(24) %30)
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = load i64, ptr %5, align 8, !tbaa !9
  %33 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZNSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %32) #4
  %34 = invoke noundef nonnull align 8 dereferenceable(160) ptr @_ZN9NOMAD_4_39EvalPointaSERKS0_(ptr noundef nonnull align 8 dereferenceable(160) %33, ptr noundef nonnull align 8 dereferenceable(160) %6)
          to label %35 unwind label %36

35:                                               ; preds = %26
  call void @_ZN9NOMAD_4_39EvalPointD1Ev(ptr noundef nonnull align 8 dereferenceable(160) %6) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr %6) #4
  br label %40

36:                                               ; preds = %26
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %7, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %8, align 4
  call void @_ZN9NOMAD_4_39EvalPointD1Ev(ptr noundef nonnull align 8 dereferenceable(160) %6) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %45

40:                                               ; preds = %35, %15
  br label %41

41:                                               ; preds = %40
  %42 = load i64, ptr %5, align 8, !tbaa !9
  %43 = add i64 %42, 1
  store i64 %43, ptr %5, align 8, !tbaa !9
  br label %9, !llvm.loop !11

44:                                               ; preds = %14
  ret void

45:                                               ; preds = %36
  %46 = load ptr, ptr %7, align 8
  %47 = load i32, ptr %8, align 4
  %48 = insertvalue { ptr, i32 } poison, ptr %46, 0
  %49 = insertvalue { ptr, i32 } %48, i32 %47, 1
  resume { ptr, i32 } %49
}

declare noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble9nbDefinedEv(ptr noundef nonnull align 8 dereferenceable(24)) #3

declare void @_ZN9NOMAD_4_39EvalPointD1Ev(ptr)

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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.NOMAD_4_3::EvalPoint" = type { %"class.NOMAD_4_3::Point", [3 x %"class.std::unique_ptr"], i32, i32, i16, %"class.std::shared_ptr", %"class.std::vector", %"class.std::shared_ptr.8", %"class.NOMAD_4_3::Double", %"class.std::shared_ptr.11" }
%"class.NOMAD_4_3::Point" = type { %"class.NOMAD_4_3::ArrayOfDouble" }
%"class.NOMAD_4_3::ArrayOfDouble" = type { ptr, i64, ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.4" }
%"struct.std::_Head_base.4" = type { ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl" }
%"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl" = type { %"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl_data" }
%"struct.std::_Vector_base<NOMAD_4_3::StepType, std::allocator<NOMAD_4_3::StepType>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::shared_ptr.8" = type { %"class.std::__shared_ptr.9" }
%"class.std::__shared_ptr.9" = type { ptr, %"class.std::__shared_count" }
%"class.NOMAD_4_3::Double" = type <{ ptr, double, i8, [7 x i8] }>
%"class.std::shared_ptr.11" = type { %"class.std::__shared_ptr.12" }
%"class.std::__shared_ptr.12" = type { ptr, %"class.std::__shared_count" }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(160) ptr @_ZN9NOMAD_4_39EvalPointaSERKS0_(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(160)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK9NOMAD_4_39EvalPoint27makeFullSpacePointFromFixedERKNS_5PointE(ptr dead_on_unwind noalias writable sret(%"class.NOMAD_4_3::EvalPoint") align 8, ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9NOMAD_4_322convertPointListToFullERSt6vectorINS_9EvalPointESaIS1_EERKNS_5PointE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.NOMAD_4_3::EvalPoint", align 8
  %4 = tail call noundef i64 @_ZNKSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %.not = icmp eq i64 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %18, %2
  ret void

.lr.ph:                                           ; preds = %2, %18
  %.013 = phi i64 [ %19, %18 ], [ 0, %2 ]
  %5 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZNSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.013) #4
  %6 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %7 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %8 = call noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble9nbDefinedEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %9 = sub i64 %7, %8
  %10 = icmp eq i64 %6, %9
  br i1 %10, label %11, label %18

11:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %3) #4
  %12 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZNSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.013) #4
  call void @_ZNK9NOMAD_4_39EvalPoint27makeFullSpacePointFromFixedERKNS_5PointE(ptr dead_on_unwind nonnull writable sret(%"class.NOMAD_4_3::EvalPoint") align 8 %3, ptr noundef nonnull align 8 dereferenceable(160) %12, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %13 = call noundef nonnull align 8 dereferenceable(160) ptr @_ZNSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.013) #4
  %14 = invoke noundef nonnull align 8 dereferenceable(160) ptr @_ZN9NOMAD_4_39EvalPointaSERKS0_(ptr noundef nonnull align 8 dereferenceable(160) %13, ptr noundef nonnull align 8 dereferenceable(160) %3)
          to label %15 unwind label %16

15:                                               ; preds = %11
  call void @_ZN9NOMAD_4_39EvalPointD1Ev(ptr noundef nonnull align 8 dereferenceable(160) %3) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %3) #4
  br label %18

16:                                               ; preds = %11
  %17 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN9NOMAD_4_39EvalPointD1Ev(ptr noundef nonnull align 8 dereferenceable(160) %3) #4
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %3) #4
  resume { ptr, i32 } %17

18:                                               ; preds = %.lr.ph, %15
  %19 = add nuw i64 %.013, 1
  %20 = call noundef i64 @_ZNKSt6vectorIN9NOMAD_4_39EvalPointESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %21 = icmp ult i64 %19, %20
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !5
}

declare noundef i64 @_ZNK9NOMAD_4_313ArrayOfDouble9nbDefinedEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3

declare void @_ZN9NOMAD_4_39EvalPointD1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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