; LLVM IR from cvra/robot-software :: lib/goap (example)

; 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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%class.CutWood = type { %"class.goap::Action" }
%"class.goap::Action" = type { ptr }
%class.GrabAxe = type { %"class.goap::Action" }
%struct.ForestryGoal = type { %"class.goap::Goal" }
%"class.goap::Goal" = type { ptr }
%struct.LumberjackState = type { i8, i8 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl" }
%"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl" = type { %"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::initializer_list" = type { ptr, i64 }
%"class.std::allocator" = type { i8 }
%"class.goap::Planner" = type { [100 x %"struct.goap::VisitedState"] }
%"struct.goap::VisitedState" = type { i32, i32, %struct.LumberjackState, ptr, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [51 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %class.CutWood, align 8
  %3 = alloca %class.GrabAxe, align 8
  %4 = alloca %struct.ForestryGoal, align 8
  %5 = alloca %struct.LumberjackState, align 1
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca %"class.std::initializer_list", align 8
  %8 = alloca [2 x ptr], align 8
  %9 = alloca %"class.std::allocator", align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.goap::Planner", align 8
  %13 = alloca i32, align 4
  %14 = alloca [10 x ptr], align 16
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  call void @_ZN7CutWoodC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @_ZN7GrabAxeC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @_ZN12ForestryGoalC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #6
  call void @_ZN15LumberjackStateC2Ev(ptr noundef nonnull align 1 dereferenceable(2) %5) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  store ptr %2, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds ptr, ptr %8, i64 1
  store ptr %3, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.std::initializer_list", ptr %7, i32 0, i32 0
  store ptr %8, ptr %19, align 8, !tbaa !9
  %20 = getelementptr inbounds %"class.std::initializer_list", ptr %7, i32 0, i32 1
  store i64 2, ptr %20, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  call void @_ZNSaIPN4goap6ActionI15LumberjackStateEEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #6
  %21 = getelementptr inbounds { ptr, i64 }, ptr %7, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8
  %23 = getelementptr inbounds { ptr, i64 }, ptr %7, i32 0, i32 1
  %24 = load i64, ptr %23, align 8
  invoke void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EEC2ESt16initializer_listIS4_ERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr %22, i64 %24, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %25 unwind label %39

25:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIPN4goap6ActionI15LumberjackStateEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4000, ptr %12) #6
  call void @_ZN4goap7PlannerI15LumberjackStateLi100EEC2Ev(ptr noundef nonnull align 8 dereferenceable(4000) %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 10, ptr %13, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 80, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %26 = call noundef ptr @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  %27 = call noundef i64 @_ZNKSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  %28 = trunc i64 %27 to i32
  %29 = getelementptr inbounds [10 x ptr], ptr %14, i64 0, i64 0
  %30 = invoke noundef i32 @_ZN4goap7PlannerI15LumberjackStateLi100EE4planERKS1_RNS_4GoalIS1_EEPPNS_6ActionIS1_EEjSB_i(ptr noundef nonnull align 8 dereferenceable(4000) %12, ptr noundef nonnull align 1 dereferenceable(2) %5, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %26, i32 noundef %28, ptr noundef %29, i32 noundef 10)
          to label %31 unwind label %43

31:                                               ; preds = %25
  store i32 %30, ptr %15, align 4, !tbaa !13
  %32 = load i32, ptr %15, align 4, !tbaa !13
  %33 = icmp eq i32 %32, -1
  br i1 %33, label %34, label %47

34:                                               ; preds = %31
  %35 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
          to label %36 unwind label %43

36:                                               ; preds = %34
  %37 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %38 unwind label %43

38:                                               ; preds = %36
  store i32 1, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %79

39:                                               ; preds = %0
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %10, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %11, align 4
  call void @_ZNSt15__new_allocatorIPN4goap6ActionI15LumberjackStateEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  br label %82

43:                                               ; preds = %52, %50, %36, %34, %25
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %10, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %11, align 4
  br label %81

47:                                               ; preds = %31
  %48 = load i32, ptr %15, align 4, !tbaa !13
  %49 = icmp eq i32 %48, -2
  br i1 %49, label %50, label %55

50:                                               ; preds = %47
  %51 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
          to label %52 unwind label %43

52:                                               ; preds = %50
  %53 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %54 unwind label %43

54:                                               ; preds = %52
  store i32 1, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %79

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  store i32 0, ptr %17, align 4, !tbaa !13
  br label %56

56:                                               ; preds = %71, %55
  %57 = load i32, ptr %17, align 4, !tbaa !13
  %58 = load i32, ptr %15, align 4, !tbaa !13
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %78

61:                                               ; preds = %56
  %62 = load i32, ptr %17, align 4, !tbaa !13
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [10 x ptr], ptr %14, i64 0, i64 %63
  %65 = load ptr, ptr %64, align 8, !tbaa !5
  %66 = load ptr, ptr %65, align 8, !tbaa !15
  %67 = getelementptr inbounds ptr, ptr %66, i64 2
  %68 = load ptr, ptr %67, align 8
  %69 = invoke noundef zeroext i1 %68(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull align 1 dereferenceable(2) %5)
          to label %70 unwind label %74

70:                                               ; preds = %61
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %17, align 4, !tbaa !13
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %17, align 4, !tbaa !13
  br label %56, !llvm.loop !17

74:                                               ; preds = %61
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %10, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %81

78:                                               ; preds = %60
  store i32 0, ptr %1, align 4
  store i32 1, ptr %16, align 4
  br label %79

79:                                               ; preds = %78, %54, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4000, ptr %12) #6
  call void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #6
  call void @_ZN4goap4GoalI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %80 = load i32, ptr %1, align 4
  ret i32 %80

81:                                               ; preds = %74, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4000, ptr %12) #6
  call void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  br label %82

82:                                               ; preds = %81, %39
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #6
  call void @_ZN4goap4GoalI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %10, align 8
  %85 = load i32, ptr %11, align 4
  %86 = insertvalue { ptr, i32 } poison, ptr %84, 0
  %87 = insertvalue { ptr, i32 } %86, i32 %85, 1
  resume { ptr, i32 } %87
}

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EEC2ESt16initializer_listIS4_ERKS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

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) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4goap7PlannerI15LumberjackStateLi100EEC2Ev(ptr noundef nonnull align 8 dereferenceable(4000)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4goap7PlannerI15LumberjackStateLi100EE4planERKS1_RNS_4GoalIS1_EEPPNS_6ActionIS1_EEjSB_i(ptr noundef nonnull align 8 dereferenceable(4000), ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, ptr noundef, i32 noundef) #4 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

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

attributes #0 = { mustprogress norecurse 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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, !6, i64 0}
!10 = !{!"_ZTSSt16initializer_listIPN4goap6ActionI15LumberjackStateEEE", !6, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"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.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%class.CutWood = type { %"class.goap::Action" }
%"class.goap::Action" = type { ptr }
%class.GrabAxe = type { %"class.goap::Action" }
%struct.ForestryGoal = type { %"class.goap::Goal" }
%"class.goap::Goal" = type { ptr }
%struct.LumberjackState = type { i8, i8 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl" }
%"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl" = type { %"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<goap::Action<LumberjackState> *, std::allocator<goap::Action<LumberjackState> *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"class.goap::Planner" = type { [100 x %"struct.goap::VisitedState"] }
%"struct.goap::VisitedState" = type { i32, i32, %struct.LumberjackState, ptr, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [51 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 0, 2) i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %class.CutWood, align 8
  %2 = alloca %class.GrabAxe, align 8
  %3 = alloca %struct.ForestryGoal, align 8
  %4 = alloca %struct.LumberjackState, align 1
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca [2 x ptr], align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.goap::Planner", align 8
  %9 = alloca [10 x ptr], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @_ZN7CutWoodC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @_ZN7GrabAxeC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @_ZN12ForestryGoalC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #6
  call void @_ZN15LumberjackStateC2Ev(ptr noundef nonnull align 1 dereferenceable(2) %4) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  store ptr %1, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %2, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #6
  call void @_ZNSaIPN4goap6ActionI15LumberjackStateEEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EEC2ESt16initializer_listIS4_ERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr nonnull %6, i64 2, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %11 unwind label %19

11:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIPN4goap6ActionI15LumberjackStateEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %8) #6
  call void @_ZN4goap7PlannerI15LumberjackStateLi100EEC2Ev(ptr noundef nonnull align 8 dereferenceable(4000) %8) #6
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %9) #6
  %12 = call noundef ptr @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %13 = call noundef i64 @_ZNKSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %14 = trunc i64 %13 to i32
  %15 = invoke noundef i32 @_ZN4goap7PlannerI15LumberjackStateLi100EE4planERKS1_RNS_4GoalIS1_EEPPNS_6ActionIS1_EEjSB_i(ptr noundef nonnull align 8 dereferenceable(4000) %8, ptr noundef nonnull align 1 dereferenceable(2) %4, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef %12, i32 noundef %14, ptr noundef nonnull %9, i32 noundef 10)
          to label %16 unwind label %21

16:                                               ; preds = %11
  switch i32 %15, label %.preheader [
    i32 -1, label %18
    i32 -2, label %.invoke17
  ]

.preheader:                                       ; preds = %16
  %17 = icmp sgt i32 %15, 0
  br i1 %17, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %15 to i64
  br label %.lr.ph

18:                                               ; preds = %16
  br label %.invoke17

19:                                               ; preds = %0
  %20 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIPN4goap6ActionI15LumberjackStateEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %36

21:                                               ; preds = %.invoke17, %.invoke, %11
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %35

.invoke17:                                        ; preds = %16, %18
  %23 = phi ptr [ @.str, %18 ], [ @.str.1, %16 ]
  %24 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %23)
          to label %.invoke unwind label %21

.invoke:                                          ; preds = %.invoke17
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %.loopexit unwind label %21

.lr.ph:                                           ; preds = %.lr.ph.preheader, %32
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %32 ]
  %26 = getelementptr inbounds [10 x ptr], ptr %9, i64 0, i64 %indvars.iv
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %30 = load ptr, ptr %29, align 8
  %31 = invoke noundef zeroext i1 %30(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull align 1 dereferenceable(2) %4)
          to label %32 unwind label %33

32:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !11

33:                                               ; preds = %.lr.ph
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %35

.loopexit:                                        ; preds = %32, %.invoke, %.preheader
  %.08 = phi i32 [ 0, %.preheader ], [ 1, %.invoke ], [ 0, %32 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %8) #6
  call void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #6
  call void @_ZN4goap4GoalI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 %.08

35:                                               ; preds = %33, %21
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %8) #6
  call void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  br label %36

36:                                               ; preds = %35, %19
  %.pn.pn = phi { ptr, i32 } [ %.pn, %35 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #6
  call void @_ZN4goap4GoalI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @_ZN4goap6ActionI15LumberjackStateED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn.pn
}

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN4goap6ActionI15LumberjackStateEESaIS4_EEC2ESt16initializer_listIS4_ERKS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr, i64, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

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) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4goap7PlannerI15LumberjackStateLi100EEC2Ev(ptr noundef nonnull align 8 dereferenceable(4000)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4goap7PlannerI15LumberjackStateLi100EE4planERKS1_RNS_4GoalIS1_EEPPNS_6ActionIS1_EEjSB_i(ptr noundef nonnull align 8 dereferenceable(4000), ptr noundef nonnull align 1 dereferenceable(2), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

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

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


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