; LLVM IR from mbrenman/TetrisPlayground :: agents/HeuristicAgent.ll (ZN14HeuristicAgent14getBestActionsEP6Tetris)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl" }
%"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl" = type { %"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Action = type { i32, i32 }

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
define dso_local void @_ZN14HeuristicAgent14getBestActionsEP6Tetris(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i1, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %class.Action, align 4
  %17 = alloca ptr, align 8
  %18 = alloca double, align 8
  %19 = alloca %class.Action, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store double 0xC197D783FC000000, ptr %7, align 8, !tbaa !9
  store i1 false, ptr %8, align 1
  call void @_ZNSt6vectorI6ActionSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %93, %3
  %22 = load i32, ptr %9, align 4, !tbaa !11
  %23 = icmp slt i32 %22, 4
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %97

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %26 = load i32, ptr %9, align 4, !tbaa !11
  store i32 %26, ptr %11, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = load i32, ptr %11, align 4, !tbaa !13
  %29 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %27, i32 noundef %28)
          to label %30 unwind label %37

30:                                               ; preds = %25
  %31 = add nsw i32 %29, 1
  store i32 %31, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %87, %30
  %33 = load i32, ptr %15, align 4, !tbaa !11
  %34 = load i32, ptr %12, align 4, !tbaa !11
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %41, label %36

36:                                               ; preds = %32
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %92

37:                                               ; preds = %25
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %13, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %14, align 4
  br label %96

41:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %42 = load i32, ptr %11, align 4, !tbaa !13
  %43 = load i32, ptr %15, align 4, !tbaa !11
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %16, i32 noundef %42, i32 noundef %43)
          to label %44 unwind label %61

44:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %45)
          to label %47 unwind label %65

47:                                               ; preds = %44
  store ptr %46, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %16, i64 8, i1 false), !tbaa.struct !15
  %48 = load ptr, ptr %17, align 8, !tbaa !5
  %49 = load i64, ptr %19, align 4
  %50 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %20, i64 %49, ptr noundef %48)
          to label %51 unwind label %69

51:                                               ; preds = %47
  %52 = fpext float %50 to double
  store double %52, ptr %18, align 8, !tbaa !9
  %53 = load double, ptr %18, align 8, !tbaa !9
  %54 = load double, ptr %7, align 8, !tbaa !9
  %55 = fcmp ogt double %53, %54
  br i1 %55, label %56, label %73

56:                                               ; preds = %51
  %57 = load double, ptr %18, align 8, !tbaa !9
  store double %57, ptr %7, align 8, !tbaa !9
  %58 = load i32, ptr %11, align 4, !tbaa !13
  %59 = load i32, ptr %15, align 4, !tbaa !11
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %58, i32 noundef %59)
          to label %60 unwind label %69

60:                                               ; preds = %56
  br label %82

61:                                               ; preds = %41
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %13, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %14, align 4
  br label %91

65:                                               ; preds = %44
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %13, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %14, align 4
  br label %90

69:                                               ; preds = %77, %56, %47
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %13, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br label %90

73:                                               ; preds = %51
  %74 = load double, ptr %18, align 8, !tbaa !9
  %75 = load double, ptr %7, align 8, !tbaa !9
  %76 = fcmp oeq double %74, %75
  br i1 %76, label %77, label %81

77:                                               ; preds = %73
  %78 = load i32, ptr %11, align 4, !tbaa !13
  %79 = load i32, ptr %15, align 4, !tbaa !11
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %78, i32 noundef %79)
          to label %80 unwind label %69

80:                                               ; preds = %77
  br label %81

81:                                               ; preds = %80, %73
  br label %82

82:                                               ; preds = %81, %60
  %83 = load ptr, ptr %17, align 8, !tbaa !5
  %84 = icmp eq ptr %83, null
  br i1 %84, label %86, label %85

85:                                               ; preds = %82
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %83) #7
  call void @_ZdlPvm(ptr noundef %83, i64 noundef 824) #8
  br label %86

86:                                               ; preds = %85, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %15, align 4, !tbaa !11
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %15, align 4, !tbaa !11
  br label %32, !llvm.loop !16

90:                                               ; preds = %69, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %91

91:                                               ; preds = %90, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %96

92:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %9, align 4, !tbaa !11
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !11
  br label %21, !llvm.loop !18

96:                                               ; preds = %91, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %101

97:                                               ; preds = %24
  store i1 true, ptr %8, align 1
  store i32 1, ptr %10, align 4
  %98 = load i1, ptr %8, align 1
  br i1 %98, label %100, label %99

99:                                               ; preds = %97
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  br label %100

100:                                              ; preds = %99, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  ret void

101:                                              ; preds = %96
  %102 = load ptr, ptr %13, align 8
  %103 = load i32, ptr %14, align 4
  %104 = insertvalue { ptr, i32 } poison, ptr %102, 0
  %105 = insertvalue { ptr, i32 } %104, i32 %103, 1
  resume { ptr, i32 } %105
}

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

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

declare noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824), i32 noundef) #3

declare void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #3

declare noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824)) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56), i64, ptr noundef) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #3

declare void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) #3

; Function Attrs: nounwind
declare void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824)) unnamed_addr #5

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS8Rotation", !7, i64 0}
!15 = !{i64 0, i64 4, !13, i64 4, i64 4, !11}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl" }
%"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl" = type { %"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Action, std::allocator<Action>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Action = type { i32, i32 }

declare i32 @__gxx_personality_v0(...)

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

; 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
define dso_local void @_ZN14HeuristicAgent14getBestActionsEP6Tetris(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(56) %1, ptr noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.Action, align 8
  tail call void @_ZNSt6vectorI6ActionSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  %5 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %2, i32 noundef 0)
          to label %.preheader unwind label %57

.preheader:                                       ; preds = %3
  %.not42 = icmp slt i32 %5, 0
  br i1 %.not42, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %73, %.preheader
  %.1.lcssa = phi double [ 0xC197D783FC000000, %.preheader ], [ %.2, %73 ]
  %6 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %2, i32 noundef 1)
          to label %.preheader.1 unwind label %57

.preheader.1:                                     ; preds = %._crit_edge
  %.not42.1 = icmp slt i32 %6, 0
  br i1 %.not42.1, label %._crit_edge.1, label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.preheader.1, %21
  %.144.1 = phi double [ %.2.1, %21 ], [ %.1.lcssa, %.preheader.1 ]
  %.02643.1 = phi i32 [ %22, %21 ], [ 0, %.preheader.1 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 1, i32 noundef %.02643.1)
          to label %7 unwind label %.loopexit.split-lp.loopexit

7:                                                ; preds = %.lr.ph.1
  %8 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %2)
          to label %9 unwind label %.loopexit.split-lp49.loopexit

9:                                                ; preds = %7
  %.sroa.0.0.copyload.1 = load i64, ptr %4, align 8
  %10 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 %.sroa.0.0.copyload.1, ptr noundef %8)
          to label %11 unwind label %.loopexit.split-lp54.loopexit

11:                                               ; preds = %9
  %12 = fpext float %10 to double
  %13 = fcmp olt double %.144.1, %12
  br i1 %13, label %17, label %14

14:                                               ; preds = %11
  %15 = fcmp oeq double %.144.1, %12
  br i1 %15, label %16, label %18

16:                                               ; preds = %14
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 1, i32 noundef %.02643.1)
          to label %18 unwind label %.loopexit.split-lp54.loopexit

17:                                               ; preds = %11
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 1, i32 noundef %.02643.1)
          to label %18 unwind label %.loopexit.split-lp54.loopexit

18:                                               ; preds = %17, %16, %14
  %.2.1 = phi double [ %12, %17 ], [ %.144.1, %16 ], [ %.144.1, %14 ]
  %19 = icmp eq ptr %8, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %18
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %8) #6
  call void @_ZdlPvm(ptr noundef nonnull %8, i64 noundef 824) #7
  br label %21

21:                                               ; preds = %20, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %22 = add nuw i32 %.02643.1, 1
  %exitcond.1.not = icmp eq i32 %.02643.1, %6
  br i1 %exitcond.1.not, label %._crit_edge.1, label %.lr.ph.1, !llvm.loop !5

._crit_edge.1:                                    ; preds = %21, %.preheader.1
  %.1.lcssa.1 = phi double [ %.1.lcssa, %.preheader.1 ], [ %.2.1, %21 ]
  %23 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %2, i32 noundef 2)
          to label %.preheader.2 unwind label %57

.preheader.2:                                     ; preds = %._crit_edge.1
  %.not42.2 = icmp slt i32 %23, 0
  br i1 %.not42.2, label %._crit_edge.2, label %.lr.ph.2

.lr.ph.2:                                         ; preds = %.preheader.2, %38
  %.144.2 = phi double [ %.2.2, %38 ], [ %.1.lcssa.1, %.preheader.2 ]
  %.02643.2 = phi i32 [ %39, %38 ], [ 0, %.preheader.2 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 2, i32 noundef %.02643.2)
          to label %24 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

24:                                               ; preds = %.lr.ph.2
  %25 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %2)
          to label %26 unwind label %.loopexit.split-lp49.loopexit.split-lp.loopexit

26:                                               ; preds = %24
  %.sroa.0.0.copyload.2 = load i64, ptr %4, align 8
  %27 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 %.sroa.0.0.copyload.2, ptr noundef %25)
          to label %28 unwind label %.loopexit.split-lp54.loopexit.split-lp.loopexit

28:                                               ; preds = %26
  %29 = fpext float %27 to double
  %30 = fcmp olt double %.144.2, %29
  br i1 %30, label %34, label %31

31:                                               ; preds = %28
  %32 = fcmp oeq double %.144.2, %29
  br i1 %32, label %33, label %35

33:                                               ; preds = %31
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 2, i32 noundef %.02643.2)
          to label %35 unwind label %.loopexit.split-lp54.loopexit.split-lp.loopexit

34:                                               ; preds = %28
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 2, i32 noundef %.02643.2)
          to label %35 unwind label %.loopexit.split-lp54.loopexit.split-lp.loopexit

35:                                               ; preds = %34, %33, %31
  %.2.2 = phi double [ %29, %34 ], [ %.144.2, %33 ], [ %.144.2, %31 ]
  %36 = icmp eq ptr %25, null
  br i1 %36, label %38, label %37

37:                                               ; preds = %35
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %25) #6
  call void @_ZdlPvm(ptr noundef nonnull %25, i64 noundef 824) #7
  br label %38

38:                                               ; preds = %37, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %39 = add nuw i32 %.02643.2, 1
  %exitcond.2.not = icmp eq i32 %.02643.2, %23
  br i1 %exitcond.2.not, label %._crit_edge.2, label %.lr.ph.2, !llvm.loop !5

._crit_edge.2:                                    ; preds = %38, %.preheader.2
  %.1.lcssa.2 = phi double [ %.1.lcssa.1, %.preheader.2 ], [ %.2.2, %38 ]
  %40 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %2, i32 noundef 3)
          to label %.preheader.3 unwind label %57

.preheader.3:                                     ; preds = %._crit_edge.2
  %.not42.3 = icmp slt i32 %40, 0
  br i1 %.not42.3, label %._crit_edge.3, label %.lr.ph.3

.lr.ph.3:                                         ; preds = %.preheader.3, %55
  %.144.3 = phi double [ %.2.3, %55 ], [ %.1.lcssa.2, %.preheader.3 ]
  %.02643.3 = phi i32 [ %56, %55 ], [ 0, %.preheader.3 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 3, i32 noundef %.02643.3)
          to label %41 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

41:                                               ; preds = %.lr.ph.3
  %42 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %2)
          to label %43 unwind label %.loopexit.split-lp49.loopexit.split-lp.loopexit.split-lp

43:                                               ; preds = %41
  %.sroa.0.0.copyload.3 = load i64, ptr %4, align 8
  %44 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 %.sroa.0.0.copyload.3, ptr noundef %42)
          to label %45 unwind label %.loopexit.split-lp54.loopexit.split-lp.loopexit.split-lp

45:                                               ; preds = %43
  %46 = fpext float %44 to double
  %47 = fcmp olt double %.144.3, %46
  br i1 %47, label %51, label %48

48:                                               ; preds = %45
  %49 = fcmp oeq double %.144.3, %46
  br i1 %49, label %50, label %52

50:                                               ; preds = %48
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 3, i32 noundef %.02643.3)
          to label %52 unwind label %.loopexit.split-lp54.loopexit.split-lp.loopexit.split-lp

51:                                               ; preds = %45
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 3, i32 noundef %.02643.3)
          to label %52 unwind label %.loopexit.split-lp54.loopexit.split-lp.loopexit.split-lp

52:                                               ; preds = %51, %50, %48
  %.2.3 = phi double [ %46, %51 ], [ %.144.3, %50 ], [ %.144.3, %48 ]
  %53 = icmp eq ptr %42, null
  br i1 %53, label %55, label %54

54:                                               ; preds = %52
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %42) #6
  call void @_ZdlPvm(ptr noundef nonnull %42, i64 noundef 824) #7
  br label %55

55:                                               ; preds = %54, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %56 = add nuw i32 %.02643.3, 1
  %exitcond.3.not = icmp eq i32 %.02643.3, %40
  br i1 %exitcond.3.not, label %._crit_edge.3, label %.lr.ph.3, !llvm.loop !5

._crit_edge.3:                                    ; preds = %55, %.preheader.3
  ret void

57:                                               ; preds = %._crit_edge.2, %._crit_edge.1, %._crit_edge, %3
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %75

.lr.ph:                                           ; preds = %.preheader, %73
  %.144 = phi double [ %.2, %73 ], [ 0xC197D783FC000000, %.preheader ]
  %.02643 = phi i32 [ %74, %73 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef 0, i32 noundef %.02643)
          to label %59 unwind label %.loopexit

59:                                               ; preds = %.lr.ph
  %60 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %2)
          to label %61 unwind label %.loopexit48

61:                                               ; preds = %59
  %.sroa.0.0.copyload = load i64, ptr %4, align 8
  %62 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %1, i64 %.sroa.0.0.copyload, ptr noundef %60)
          to label %63 unwind label %.loopexit53

63:                                               ; preds = %61
  %64 = fpext float %62 to double
  %65 = fcmp olt double %.144, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %63
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 0, i32 noundef %.02643)
          to label %70 unwind label %.loopexit53

.loopexit:                                        ; preds = %.lr.ph
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit:                      ; preds = %.lr.ph.1
  %lpad.loopexit58 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp.loopexit:    ; preds = %.lr.ph.2
  %lpad.loopexit66 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp: ; preds = %.lr.ph.3
  %lpad.loopexit.split-lp67 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit48:                                      ; preds = %59
  %lpad.loopexit50 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp49.loopexit:                    ; preds = %7
  %lpad.loopexit61 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp49.loopexit.split-lp.loopexit:  ; preds = %24
  %lpad.loopexit69 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp49.loopexit.split-lp.loopexit.split-lp: ; preds = %41
  %lpad.loopexit.split-lp70 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit53:                                      ; preds = %61, %66, %69
  %lpad.loopexit55 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp54.loopexit:                    ; preds = %17, %16, %9
  %lpad.loopexit63 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp54.loopexit.split-lp.loopexit:  ; preds = %26, %33, %34
  %lpad.loopexit72 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit.split-lp54.loopexit.split-lp.loopexit.split-lp: ; preds = %43, %50, %51
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

67:                                               ; preds = %63
  %68 = fcmp oeq double %.144, %64
  br i1 %68, label %69, label %70

69:                                               ; preds = %67
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef 0, i32 noundef %.02643)
          to label %70 unwind label %.loopexit53

70:                                               ; preds = %67, %69, %66
  %.2 = phi double [ %64, %66 ], [ %.144, %69 ], [ %.144, %67 ]
  %71 = icmp eq ptr %60, null
  br i1 %71, label %73, label %72

72:                                               ; preds = %70
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %60) #6
  call void @_ZdlPvm(ptr noundef nonnull %60, i64 noundef 824) #7
  br label %73

73:                                               ; preds = %72, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %74 = add nuw i32 %.02643, 1
  %exitcond.not = icmp eq i32 %.02643, %5
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

.loopexit.split-lp:                               ; preds = %.loopexit53, %.loopexit.split-lp54.loopexit.split-lp.loopexit, %.loopexit.split-lp54.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp54.loopexit, %.loopexit48, %.loopexit.split-lp49.loopexit.split-lp.loopexit, %.loopexit.split-lp49.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp49.loopexit, %.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit
  %.pn.pn = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit58, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit66, %.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp67, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp ], [ %lpad.loopexit50, %.loopexit48 ], [ %lpad.loopexit61, %.loopexit.split-lp49.loopexit ], [ %lpad.loopexit69, %.loopexit.split-lp49.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp70, %.loopexit.split-lp49.loopexit.split-lp.loopexit.split-lp ], [ %lpad.loopexit55, %.loopexit53 ], [ %lpad.loopexit63, %.loopexit.split-lp54.loopexit ], [ %lpad.loopexit72, %.loopexit.split-lp54.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp54.loopexit.split-lp.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %75

75:                                               ; preds = %.loopexit.split-lp, %57
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %.loopexit.split-lp ], [ %58, %57 ]
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  resume { ptr, i32 } %.pn.pn.pn
}

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

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

declare noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824), i32 noundef) local_unnamed_addr #3

declare void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #3

declare noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56), i64, ptr noundef) local_unnamed_addr #1 align 2

declare void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824)) unnamed_addr #4

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

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 "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 = { 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 #6 = { nounwind }
attributes #7 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass