; LLVM IR from optframe/optframe :: Examples/PN/src/Evaluator.ll (ZN2PN11PNEvaluatorC2ERNS_15ProblemInstanceE)

; 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.nnptr::NNShared" = type { %"class.nnptr::NotNull" }
%"class.nnptr::NotNull" = type { %"class.std::shared_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.PN::PNEvaluator" = type { %"class.optframe::Evaluator", ptr, i64 }
%"class.optframe::Evaluator" = type { %"class.optframe::GeneralEvaluator.base", %"class.optframe::IEvaluator", %"class.optframe::ICompare", %"class.nnptr::NNShared", i8, double }
%"class.optframe::GeneralEvaluator.base" = type { %"class.optframe::Component.base" }
%"class.optframe::Component.base" = type <{ ptr, ptr, ptr, i32, i8, i8, i8, i8, i8 }>
%"class.optframe::IEvaluator" = type { ptr }
%"class.optframe::ICompare" = type { ptr }

@_ZTVN2PN11PNEvaluatorE = external dso_local unnamed_addr constant { [29 x ptr], [3 x ptr], [3 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2PN11PNEvaluatorC2ERNS_15ProblemInstanceE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef nonnull align 8 dereferenceable(64) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.nnptr::NNShared", align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  %9 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 184) #6
  call void @llvm.memset.p0.i64(ptr align 16 %9, i8 0, i64 184, i1 false)
  invoke void @_ZN8optframe12MinimizationINS_10EvaluationIdEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(184) %9)
          to label %10 unwind label %16

10:                                               ; preds = %2
  call void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEEC2EPS5_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef %9)
  invoke void @_ZN8optframe9EvaluatorINS_12CopySolutionISt6vectorIbSaIbEEiEENS_10EvaluationIdEESt4pairIS5_S7_EEC2EN5nnptr8NNSharedINS_9DirectionIS7_EEEEbd(ptr noundef nonnull align 8 dereferenceable(88) %8, ptr noundef %5, i1 noundef zeroext true, double noundef 1.000000e+00)
          to label %11 unwind label %20

11:                                               ; preds = %10
  call void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  store ptr getelementptr inbounds inrange(-16, 216) ({ [29 x ptr], [3 x ptr], [3 x ptr] }, ptr @_ZTVN2PN11PNEvaluatorE, i32 0, i32 0, i32 2), ptr %8, align 8, !tbaa !9
  %12 = getelementptr inbounds i8, ptr %8, i64 40
  store ptr getelementptr inbounds inrange(-16, 8) ({ [29 x ptr], [3 x ptr], [3 x ptr] }, ptr @_ZTVN2PN11PNEvaluatorE, i32 0, i32 1, i32 2), ptr %12, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %8, i64 48
  store ptr getelementptr inbounds inrange(-16, 8) ({ [29 x ptr], [3 x ptr], [3 x ptr] }, ptr @_ZTVN2PN11PNEvaluatorE, i32 0, i32 2, i32 2), ptr %13, align 8, !tbaa !9
  %14 = getelementptr inbounds %"class.PN::PNEvaluator", ptr %8, i32 0, i32 1
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %15, ptr %14, align 8, !tbaa !5
  ret void

16:                                               ; preds = %2
  %17 = landingpad { ptr, i32 }
          cleanup
  %18 = extractvalue { ptr, i32 } %17, 0
  store ptr %18, ptr %6, align 8
  %19 = extractvalue { ptr, i32 } %17, 1
  store i32 %19, ptr %7, align 4
  call void @_ZdlPvm(ptr noundef %9, i64 noundef 184) #8
  br label %24

20:                                               ; preds = %10
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %6, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %7, align 4
  call void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #7
  br label %24

24:                                               ; preds = %20, %16
  %25 = load ptr, ptr %6, align 8
  %26 = load i32, ptr %7, align 4
  %27 = insertvalue { ptr, i32 } poison, ptr %25, 0
  %28 = insertvalue { ptr, i32 } %27, i32 %26, 1
  resume { ptr, i32 } %28
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8optframe12MinimizationINS_10EvaluationIdEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(184)) unnamed_addr #3 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEEC2EPS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8optframe9EvaluatorINS_12CopySolutionISt6vectorIbSaIbEEiEENS_10EvaluationIdEESt4pairIS5_S7_EEC2EN5nnptr8NNSharedINS_9DirectionIS7_EEEEbd(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i1 noundef zeroext, double noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5 align 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 = { nobuiltin allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { inlinehint 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 #4 = { nobuiltin 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 #5 = { inlinehint 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 #6 = { builtin allocsize(0) }
attributes #7 = { nounwind }
attributes #8 = { builtin 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}


; 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.nnptr::NNShared" = type { %"class.nnptr::NotNull" }
%"class.nnptr::NotNull" = type { %"class.std::shared_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 }

@_ZTVN2PN11PNEvaluatorE = external dso_local unnamed_addr constant { [29 x ptr], [3 x ptr], [3 x ptr] }, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN2PN11PNEvaluatorC2ERNS_15ProblemInstanceE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef nonnull align 8 dereferenceable(64) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.nnptr::NNShared", align 8
  %4 = tail call noalias noundef nonnull dereferenceable(184) ptr @_Znwm(i64 noundef 184) #6
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(184) %4, i8 0, i64 184, i1 false)
  invoke void @_ZN8optframe12MinimizationINS_10EvaluationIdEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(184) %4)
          to label %5 unwind label %10

5:                                                ; preds = %2
  call void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEEC2EPS5_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull %4)
  invoke void @_ZN8optframe9EvaluatorINS_12CopySolutionISt6vectorIbSaIbEEiEENS_10EvaluationIdEESt4pairIS5_S7_EEC2EN5nnptr8NNSharedINS_9DirectionIS7_EEEEbd(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull %3, i1 noundef zeroext true, double noundef 1.000000e+00)
          to label %6 unwind label %12

6:                                                ; preds = %5
  call void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  store ptr getelementptr inbounds inrange(-16, 216) (i8, ptr @_ZTVN2PN11PNEvaluatorE, i64 16), ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTVN2PN11PNEvaluatorE, i64 248), ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr getelementptr inbounds inrange(-16, 8) (i8, ptr @_ZTVN2PN11PNEvaluatorE, i64 272), ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %1, ptr %9, align 8, !tbaa !8
  ret void

10:                                               ; preds = %2
  %11 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %4, i64 noundef 184) #8
  br label %14

12:                                               ; preds = %5
  %13 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  br label %14

14:                                               ; preds = %12, %10
  %.pn = phi { ptr, i32 } [ %13, %12 ], [ %11, %10 ]
  resume { ptr, i32 } %.pn
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8optframe12MinimizationINS_10EvaluationIdEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(184)) unnamed_addr #3 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEEC2EPS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8optframe9EvaluatorINS_12CopySolutionISt6vectorIbSaIbEEiEENS_10EvaluationIdEESt4pairIS5_S7_EEC2EN5nnptr8NNSharedINS_9DirectionIS7_EEEEbd(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i1 noundef zeroext, double noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5nnptr8NNSharedIN8optframe9DirectionINS1_10EvaluationIdEEEEED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5 align 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 = { nobuiltin allocsize(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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { inlinehint 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 #4 = { nobuiltin 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 #5 = { inlinehint 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 #6 = { builtin allocsize(0) }
attributes #7 = { nounwind }
attributes #8 = { builtin 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"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass