; LLVM IR from mbrenman/TetrisPlayground :: agents/RolloutAgent.ll (ZN12RolloutAgent9getActionEP6Tetris)

; 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.Action = type { i32, i32 }
%"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.RolloutAgent = type { %class.Agent, ptr }
%class.Agent = type { ptr }

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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

; 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 i64 @_ZN12RolloutAgent9getActionEP6Tetris(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.Action, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca float, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca i32, align 4
  %17 = alloca %class.Action, align 4
  %18 = alloca ptr, align 8
  %19 = alloca %class.Action, align 4
  %20 = alloca i32, align 4
  %21 = alloca %class.Action, align 4
  %22 = alloca %class.Action, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #9
  call void @_ZNSt6vectorI6ActionSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store float -1.000000e+08, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %24

24:                                               ; preds = %147, %2
  %25 = load i32, ptr %8, align 4, !tbaa !11
  %26 = icmp slt i32 %25, 4
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  %29 = load i32, ptr %8, align 4, !tbaa !11
  store i32 %29, ptr %10, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i32, ptr %10, align 4, !tbaa !13
  %32 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %30, i32 noundef %31)
          to label %33 unwind label %40

33:                                               ; preds = %28
  %34 = add nsw i32 %32, 1
  store i32 %34, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %142, %33
  %36 = load i32, ptr %14, align 4, !tbaa !11
  %37 = load i32, ptr %11, align 4, !tbaa !11
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %44, label %39

39:                                               ; preds = %35
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %146

40:                                               ; preds = %28
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %12, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %13, align 4
  br label %150

44:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store float 0.000000e+00, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %112, %44
  %46 = load i32, ptr %16, align 4, !tbaa !11
  %47 = icmp slt i32 %46, 50
  br i1 %47, label %49, label %48

48:                                               ; preds = %45
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %117

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #9
  %50 = load i32, ptr %10, align 4, !tbaa !13
  %51 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %17, i32 noundef %50, i32 noundef %51)
          to label %52 unwind label %68

52:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %53)
          to label %55 unwind label %72

55:                                               ; preds = %52
  store ptr %54, ptr %18, align 8, !tbaa !5
  %56 = getelementptr inbounds %class.RolloutAgent, ptr %23, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !18
  %58 = load ptr, ptr %18, align 8, !tbaa !5
  %59 = load i64, ptr %19, align 4
  %60 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %57, i64 %59, ptr noundef %58)
          to label %61 unwind label %72

61:                                               ; preds = %55
  %62 = load float, ptr %15, align 4, !tbaa !9
  %63 = fadd float %62, %60
  store float %63, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %64

64:                                               ; preds = %100, %61
  %65 = load i32, ptr %20, align 4, !tbaa !11
  %66 = icmp slt i32 %65, 5
  br i1 %66, label %76, label %67

67:                                               ; preds = %64
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %107

68:                                               ; preds = %49
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %12, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %13, align 4
  br label %116

72:                                               ; preds = %55, %52
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %12, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %13, align 4
  br label %115

76:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  %77 = getelementptr inbounds %class.RolloutAgent, ptr %23, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !15
  %79 = load ptr, ptr %18, align 8, !tbaa !5
  %80 = load ptr, ptr %78, align 8, !tbaa !19
  %81 = getelementptr inbounds ptr, ptr %80, i64 0
  %82 = load ptr, ptr %81, align 8
  %83 = invoke i64 %82(ptr noundef nonnull align 8 dereferenceable(56) %78, ptr noundef %79)
          to label %84 unwind label %103

84:                                               ; preds = %76
  store i64 %83, ptr %21, align 4
  %85 = load i32, ptr %20, align 4, !tbaa !11
  %86 = add nsw i32 %85, 1
  %87 = invoke noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef 0x3FE99999A0000000, i32 noundef %86)
          to label %88 unwind label %103

88:                                               ; preds = %84
  %89 = getelementptr inbounds %class.RolloutAgent, ptr %23, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %21, i64 8, i1 false), !tbaa.struct !18
  %91 = load ptr, ptr %18, align 8, !tbaa !5
  %92 = load i64, ptr %22, align 4
  %93 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %90, i64 %92, ptr noundef %91)
          to label %94 unwind label %103

94:                                               ; preds = %88
  %95 = fpext float %93 to double
  %96 = load float, ptr %15, align 4, !tbaa !9
  %97 = fpext float %96 to double
  %98 = call double @llvm.fmuladd.f64(double %87, double %95, double %97)
  %99 = fptrunc double %98 to float
  store float %99, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  br label %100

100:                                              ; preds = %94
  %101 = load i32, ptr %20, align 4, !tbaa !11
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %20, align 4, !tbaa !11
  br label %64, !llvm.loop !21

103:                                              ; preds = %88, %84, %76
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %12, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %115

107:                                              ; preds = %67
  %108 = load ptr, ptr %18, align 8, !tbaa !5
  %109 = icmp eq ptr %108, null
  br i1 %109, label %111, label %110

110:                                              ; preds = %107
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %108) #9
  call void @_ZdlPvm(ptr noundef %108, i64 noundef 824) #10
  br label %111

111:                                              ; preds = %110, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %16, align 4, !tbaa !11
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %16, align 4, !tbaa !11
  br label %45, !llvm.loop !23

115:                                              ; preds = %103, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %116

116:                                              ; preds = %115, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %145

117:                                              ; preds = %48
  %118 = load float, ptr %15, align 4, !tbaa !9
  %119 = fdiv float %118, 5.000000e+01
  store float %119, ptr %15, align 4, !tbaa !9
  %120 = load float, ptr %15, align 4, !tbaa !9
  %121 = load float, ptr %7, align 4, !tbaa !9
  %122 = fcmp ogt float %120, %121
  br i1 %122, label %123, label %132

123:                                              ; preds = %117
  %124 = load float, ptr %15, align 4, !tbaa !9
  store float %124, ptr %7, align 4, !tbaa !9
  %125 = load i32, ptr %10, align 4, !tbaa !13
  %126 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %125, i32 noundef %126)
          to label %127 unwind label %128

127:                                              ; preds = %123
  br label %141

128:                                              ; preds = %136, %123
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %12, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %13, align 4
  br label %145

132:                                              ; preds = %117
  %133 = load float, ptr %15, align 4, !tbaa !9
  %134 = load float, ptr %7, align 4, !tbaa !9
  %135 = fcmp oeq float %133, %134
  br i1 %135, label %136, label %140

136:                                              ; preds = %132
  %137 = load i32, ptr %10, align 4, !tbaa !13
  %138 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %137, i32 noundef %138)
          to label %139 unwind label %128

139:                                              ; preds = %136
  br label %140

140:                                              ; preds = %139, %132
  br label %141

141:                                              ; preds = %140, %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %14, align 4, !tbaa !11
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %14, align 4, !tbaa !11
  br label %35, !llvm.loop !24

145:                                              ; preds = %128, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %150

146:                                              ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %8, align 4, !tbaa !11
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %8, align 4, !tbaa !11
  br label %24, !llvm.loop !25

150:                                              ; preds = %145, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  br label %160

151:                                              ; preds = %27
  %152 = invoke i64 @_ZN5Agent16pickRandomActionERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %153 unwind label %156

153:                                              ; preds = %151
  store i64 %152, ptr %3, align 4
  invoke void @_ZN5Agent15clearActionListERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %154 unwind label %156

154:                                              ; preds = %153
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #9
  %155 = load i64, ptr %3, align 4
  ret i64 %155

156:                                              ; preds = %153, %151
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %12, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %13, align 4
  br label %160

160:                                              ; preds = %156, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #9
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr %12, align 8
  %163 = load i32, ptr %13, align 4
  %164 = insertvalue { ptr, i32 } poison, ptr %162, 0
  %165 = insertvalue { ptr, i32 } %164, i32 %163, 1
  resume { ptr, i32 } %165
}

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

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

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

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

declare noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56), i64, ptr noundef) #4

; 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) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef, i32 noundef) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

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

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

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

declare i64 @_ZN5Agent16pickRandomActionERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24)) #4

declare void @_ZN5Agent15clearActionListERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24)) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 #9 = { nounwind }
attributes #10 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTS8Rotation", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTS12RolloutAgent", !17, i64 0, !6, i64 8}
!17 = !{!"_ZTS5Agent"}
!18 = !{i64 0, i64 4, !13, i64 4, i64 4, !11}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}
!25 = distinct !{!25, !22}


; 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

; 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 i64 @_ZN12RolloutAgent9getActionEP6Tetris(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %class.Action, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #8
  call void @_ZNSt6vectorI6ActionSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #8
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  br label %8

6:                                                ; preds = %._crit_edge
  %7 = invoke i64 @_ZN5Agent16pickRandomActionERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %108 unwind label %110

8:                                                ; preds = %2, %._crit_edge
  %.076 = phi float [ -1.000000e+08, %2 ], [ %.1.lcssa, %._crit_edge ]
  %.03775 = phi i32 [ 0, %2 ], [ %10, %._crit_edge ]
  %9 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %1, i32 noundef %.03775)
          to label %.preheader59 unwind label %11

.preheader59:                                     ; preds = %8
  %.not72 = icmp slt i32 %9, 0
  br i1 %.not72, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %.preheader59, %106
  %.174 = phi float [ %.2, %106 ], [ %.076, %.preheader59 ]
  %.04573 = phi i32 [ %107, %106 ], [ 0, %.preheader59 ]
  br label %16

._crit_edge:                                      ; preds = %106, %.preheader59
  %.1.lcssa = phi float [ %.076, %.preheader59 ], [ %.2, %106 ]
  %10 = add nuw nsw i32 %.03775, 1
  %exitcond78.not = icmp eq i32 %10, 4
  br i1 %exitcond78.not, label %6, label %8, !llvm.loop !5

11:                                               ; preds = %8
  %12 = landingpad { ptr, i32 }
          cleanup
  br label %112

13:                                               ; preds = %97
  %14 = fdiv float %92, 5.000000e+01
  %15 = fcmp ogt float %14, %.174
  br i1 %15, label %100, label %103

16:                                               ; preds = %.preheader, %97
  %.04271 = phi i32 [ 0, %.preheader ], [ %98, %97 ]
  %.04370 = phi float [ 0.000000e+00, %.preheader ], [ %92, %97 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef %.03775, i32 noundef %.04573)
          to label %17 unwind label %28

17:                                               ; preds = %16
  %18 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %1)
          to label %19 unwind label %30

19:                                               ; preds = %17
  %20 = load ptr, ptr %5, align 8, !tbaa !7
  %.sroa.04.0.copyload = load i64, ptr %4, align 8
  %21 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %20, i64 %.sroa.04.0.copyload, ptr noundef %18)
          to label %22 unwind label %30

22:                                               ; preds = %19
  %23 = fadd float %.04370, %21
  %24 = load ptr, ptr %5, align 8, !tbaa !7
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  %26 = load ptr, ptr %25, align 8
  %27 = invoke i64 %26(ptr noundef nonnull align 8 dereferenceable(56) %24, ptr noundef %18)
          to label %32 unwind label %94

28:                                               ; preds = %16
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %99

30:                                               ; preds = %19, %17
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %99

32:                                               ; preds = %22
  %33 = call noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef 0x3FE99999A0000000, i32 noundef 1)
  %34 = load ptr, ptr %5, align 8, !tbaa !7
  %35 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %34, i64 %27, ptr noundef %18)
          to label %36 unwind label %94

36:                                               ; preds = %32
  %37 = fpext float %35 to double
  %38 = fpext float %23 to double
  %39 = call double @llvm.fmuladd.f64(double %33, double %37, double %38)
  %40 = fptrunc double %39 to float
  %41 = load ptr, ptr %5, align 8, !tbaa !7
  %42 = load ptr, ptr %41, align 8, !tbaa !13
  %43 = load ptr, ptr %42, align 8
  %44 = invoke i64 %43(ptr noundef nonnull align 8 dereferenceable(56) %41, ptr noundef %18)
          to label %45 unwind label %94

45:                                               ; preds = %36
  %46 = call noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef 0x3FE99999A0000000, i32 noundef 2)
  %47 = load ptr, ptr %5, align 8, !tbaa !7
  %48 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %47, i64 %44, ptr noundef %18)
          to label %49 unwind label %94

49:                                               ; preds = %45
  %50 = fpext float %48 to double
  %51 = fpext float %40 to double
  %52 = call double @llvm.fmuladd.f64(double %46, double %50, double %51)
  %53 = fptrunc double %52 to float
  %54 = load ptr, ptr %5, align 8, !tbaa !7
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = load ptr, ptr %55, align 8
  %57 = invoke i64 %56(ptr noundef nonnull align 8 dereferenceable(56) %54, ptr noundef %18)
          to label %58 unwind label %94

58:                                               ; preds = %49
  %59 = call noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef 0x3FE99999A0000000, i32 noundef 3)
  %60 = load ptr, ptr %5, align 8, !tbaa !7
  %61 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %60, i64 %57, ptr noundef %18)
          to label %62 unwind label %94

62:                                               ; preds = %58
  %63 = fpext float %61 to double
  %64 = fpext float %53 to double
  %65 = call double @llvm.fmuladd.f64(double %59, double %63, double %64)
  %66 = fptrunc double %65 to float
  %67 = load ptr, ptr %5, align 8, !tbaa !7
  %68 = load ptr, ptr %67, align 8, !tbaa !13
  %69 = load ptr, ptr %68, align 8
  %70 = invoke i64 %69(ptr noundef nonnull align 8 dereferenceable(56) %67, ptr noundef %18)
          to label %71 unwind label %94

71:                                               ; preds = %62
  %72 = call noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef 0x3FE99999A0000000, i32 noundef 4)
  %73 = load ptr, ptr %5, align 8, !tbaa !7
  %74 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %73, i64 %70, ptr noundef %18)
          to label %75 unwind label %94

75:                                               ; preds = %71
  %76 = fpext float %74 to double
  %77 = fpext float %66 to double
  %78 = call double @llvm.fmuladd.f64(double %72, double %76, double %77)
  %79 = fptrunc double %78 to float
  %80 = load ptr, ptr %5, align 8, !tbaa !7
  %81 = load ptr, ptr %80, align 8, !tbaa !13
  %82 = load ptr, ptr %81, align 8
  %83 = invoke i64 %82(ptr noundef nonnull align 8 dereferenceable(56) %80, ptr noundef %18)
          to label %84 unwind label %94

84:                                               ; preds = %75
  %85 = call noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef 0x3FE99999A0000000, i32 noundef 5)
  %86 = load ptr, ptr %5, align 8, !tbaa !7
  %87 = invoke noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56) %86, i64 %83, ptr noundef %18)
          to label %88 unwind label %94

88:                                               ; preds = %84
  %89 = fpext float %87 to double
  %90 = fpext float %79 to double
  %91 = call double @llvm.fmuladd.f64(double %85, double %89, double %90)
  %92 = fptrunc double %91 to float
  %93 = icmp eq ptr %18, null
  br i1 %93, label %97, label %96

94:                                               ; preds = %84, %75, %71, %62, %58, %49, %45, %36, %32, %22
  %95 = landingpad { ptr, i32 }
          cleanup
  br label %99

96:                                               ; preds = %88
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %18) #8
  call void @_ZdlPvm(ptr noundef nonnull %18, i64 noundef 824) #9
  br label %97

97:                                               ; preds = %96, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %98 = add nuw nsw i32 %.04271, 1
  %exitcond.not = icmp eq i32 %98, 50
  br i1 %exitcond.not, label %13, label %16, !llvm.loop !15

99:                                               ; preds = %30, %94, %28
  %.pn.pn = phi { ptr, i32 } [ %29, %28 ], [ %95, %94 ], [ %31, %30 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  br label %112

100:                                              ; preds = %13
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.03775, i32 noundef %.04573)
          to label %106 unwind label %101

101:                                              ; preds = %105, %100
  %102 = landingpad { ptr, i32 }
          cleanup
  br label %112

103:                                              ; preds = %13
  %104 = fcmp oeq float %14, %.174
  br i1 %104, label %105, label %106

105:                                              ; preds = %103
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.03775, i32 noundef %.04573)
          to label %106 unwind label %101

106:                                              ; preds = %103, %105, %100
  %.2 = phi float [ %14, %100 ], [ %.174, %105 ], [ %.174, %103 ]
  %107 = add nuw i32 %.04573, 1
  %exitcond77.not = icmp eq i32 %.04573, %9
  br i1 %exitcond77.not, label %._crit_edge, label %.preheader, !llvm.loop !16

108:                                              ; preds = %6
  invoke void @_ZN5Agent15clearActionListERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %109 unwind label %110

109:                                              ; preds = %108
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #8
  ret i64 %7

110:                                              ; preds = %108, %6
  %111 = landingpad { ptr, i32 }
          cleanup
  br label %112

112:                                              ; preds = %11, %101, %99, %110
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %111, %110 ], [ %12, %11 ], [ %.pn.pn, %99 ], [ %102, %101 ]
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #8
  resume { ptr, i32 } %.pn.pn.pn.pn.pn
}

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

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

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

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

declare noundef float @_ZN14HeuristicAgent20valueOfActionOnBoardE6ActionP6Tetris(ptr noundef nonnull align 8 dereferenceable(56), i64, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIfiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(float noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

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

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 #4

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 #4

declare i64 @_ZN5Agent16pickRandomActionERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

declare void @_ZN5Agent15clearActionListERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { 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"}
!7 = !{!8, !10, i64 8}
!8 = !{!"_ZTS12RolloutAgent", !9, i64 0, !10, i64 8}
!9 = !{!"_ZTS5Agent"}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !12, i64 0}
!15 = distinct !{!15, !6}
!16 = distinct !{!16, !6}


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