; LLVM IR from mbrenman/TetrisPlayground :: agents/NextPieceAgent.ll (ZN14NextPieceAgent9getActionEP6Tetris)

; 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.NextPieceAgent = 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 @_ZN14NextPieceAgent9getActionEP6Tetris(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 ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca float, align 4
  %16 = alloca %class.Action, align 4
  %17 = alloca ptr, align 8
  %18 = alloca %class.Action, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca %class.Action, align 4
  %25 = alloca %class.Action, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #7
  call void @_ZNSt6vectorI6ActionSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store float -9.999990e+05, ptr %7, align 4, !tbaa !9
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 0, i32 noundef 0)
          to label %27 unwind label %32

27:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %28

28:                                               ; preds = %161, %27
  %29 = load i32, ptr %10, align 4, !tbaa !11
  %30 = icmp slt i32 %29, 4
  br i1 %30, label %36, label %31

31:                                               ; preds = %28
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %165

32:                                               ; preds = %167, %165, %2
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %8, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %9, align 4
  br label %170

36:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %37 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %37, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load i32, ptr %12, align 4, !tbaa !13
  %40 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %38, i32 noundef %39)
          to label %41 unwind label %48

41:                                               ; preds = %36
  %42 = add nsw i32 %40, 1
  store i32 %42, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %43

43:                                               ; preds = %155, %41
  %44 = load i32, ptr %14, align 4, !tbaa !11
  %45 = load i32, ptr %13, align 4, !tbaa !11
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %52, label %47

47:                                               ; preds = %43
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %160

48:                                               ; preds = %36
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %8, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %9, align 4
  br label %164

52:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store float 0.000000e+00, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %53 = load i32, ptr %12, align 4, !tbaa !13
  %54 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %16, i32 noundef %53, i32 noundef %54)
          to label %55 unwind label %70

55:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %56)
          to label %58 unwind label %74

58:                                               ; preds = %55
  store ptr %57, ptr %17, align 8, !tbaa !5
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %16, i64 8, i1 false), !tbaa.struct !15
  %60 = load i64, ptr %18, align 4
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %59, i64 %60, i1 noundef zeroext false)
          to label %61 unwind label %74

61:                                               ; preds = %58
  %62 = load ptr, ptr %17, align 8, !tbaa !5
  %63 = invoke noundef zeroext i1 @_ZN6Tetris6isLostEv(ptr noundef nonnull align 8 dereferenceable(824) %62)
          to label %64 unwind label %74

64:                                               ; preds = %61
  br i1 %63, label %150, label %65

65:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %145, %65
  %67 = load i32, ptr %19, align 4, !tbaa !11
  %68 = icmp slt i32 %67, 4
  br i1 %68, label %78, label %69

69:                                               ; preds = %66
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %149

70:                                               ; preds = %52
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %8, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %9, align 4
  br label %159

74:                                               ; preds = %61, %58, %55
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %8, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %9, align 4
  br label %158

78:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %79 = load i32, ptr %19, align 4, !tbaa !11
  store i32 %79, ptr %20, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %80 = load ptr, ptr %17, align 8, !tbaa !5
  %81 = load i32, ptr %20, align 4, !tbaa !13
  %82 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %80, i32 noundef %81)
          to label %83 unwind label %90

83:                                               ; preds = %78
  %84 = add nsw i32 %82, 1
  store i32 %84, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  store i32 0, ptr %22, align 4, !tbaa !11
  br label %85

85:                                               ; preds = %140, %83
  %86 = load i32, ptr %22, align 4, !tbaa !11
  %87 = load i32, ptr %21, align 4, !tbaa !11
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %94, label %89

89:                                               ; preds = %85
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %144

90:                                               ; preds = %78
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %8, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %9, align 4
  br label %148

94:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %95 = load ptr, ptr %17, align 8, !tbaa !5
  %96 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %95)
          to label %97 unwind label %118

97:                                               ; preds = %94
  store ptr %96, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %98 = load i32, ptr %20, align 4, !tbaa !13
  %99 = load i32, ptr %22, align 4, !tbaa !11
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %24, i32 noundef %98, i32 noundef %99)
          to label %100 unwind label %122

100:                                              ; preds = %97
  %101 = load ptr, ptr %23, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %24, i64 8, i1 false), !tbaa.struct !15
  %102 = load i64, ptr %25, align 4
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %101, i64 %102, i1 noundef zeroext false)
          to label %103 unwind label %122

103:                                              ; preds = %100
  %104 = getelementptr inbounds %class.NextPieceAgent, ptr %26, i32 0, i32 1
  %105 = load ptr, ptr %104, align 8, !tbaa !16
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = load ptr, ptr %23, align 8, !tbaa !5
  %108 = invoke noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56) %105, ptr noundef %106, ptr noundef %107)
          to label %109 unwind label %122

109:                                              ; preds = %103
  store float %108, ptr %15, align 4, !tbaa !9
  %110 = load float, ptr %15, align 4, !tbaa !9
  %111 = load float, ptr %7, align 4, !tbaa !9
  %112 = fcmp ogt float %110, %111
  br i1 %112, label %113, label %126

113:                                              ; preds = %109
  %114 = load float, ptr %15, align 4, !tbaa !9
  store float %114, ptr %7, align 4, !tbaa !9
  %115 = load i32, ptr %12, align 4, !tbaa !13
  %116 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %115, i32 noundef %116)
          to label %117 unwind label %122

117:                                              ; preds = %113
  br label %135

118:                                              ; preds = %94
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %8, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %9, align 4
  br label %143

122:                                              ; preds = %130, %113, %103, %100, %97
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %8, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %143

126:                                              ; preds = %109
  %127 = load float, ptr %15, align 4, !tbaa !9
  %128 = load float, ptr %7, align 4, !tbaa !9
  %129 = fcmp oeq float %127, %128
  br i1 %129, label %130, label %134

130:                                              ; preds = %126
  %131 = load i32, ptr %12, align 4, !tbaa !13
  %132 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %131, i32 noundef %132)
          to label %133 unwind label %122

133:                                              ; preds = %130
  br label %134

134:                                              ; preds = %133, %126
  br label %135

135:                                              ; preds = %134, %117
  %136 = load ptr, ptr %23, align 8, !tbaa !5
  %137 = icmp eq ptr %136, null
  br i1 %137, label %139, label %138

138:                                              ; preds = %135
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %136) #7
  call void @_ZdlPvm(ptr noundef %136, i64 noundef 824) #8
  br label %139

139:                                              ; preds = %138, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %22, align 4, !tbaa !11
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %22, align 4, !tbaa !11
  br label %85, !llvm.loop !19

143:                                              ; preds = %122, %118
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  br label %148

144:                                              ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %19, align 4, !tbaa !11
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %19, align 4, !tbaa !11
  br label %66, !llvm.loop !21

148:                                              ; preds = %143, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %158

149:                                              ; preds = %69
  br label %150

150:                                              ; preds = %149, %64
  %151 = load ptr, ptr %17, align 8, !tbaa !5
  %152 = icmp eq ptr %151, null
  br i1 %152, label %154, label %153

153:                                              ; preds = %150
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %151) #7
  call void @_ZdlPvm(ptr noundef %151, i64 noundef 824) #8
  br label %154

154:                                              ; preds = %153, %150
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %14, align 4, !tbaa !11
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %14, align 4, !tbaa !11
  br label %43, !llvm.loop !22

158:                                              ; preds = %148, %74
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %159

159:                                              ; preds = %158, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %164

160:                                              ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %10, align 4, !tbaa !11
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %10, align 4, !tbaa !11
  br label %28, !llvm.loop !23

164:                                              ; preds = %159, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %170

165:                                              ; preds = %31
  %166 = invoke i64 @_ZN5Agent16pickRandomActionERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %167 unwind label %32

167:                                              ; preds = %165
  store i64 %166, ptr %3, align 4
  invoke void @_ZN5Agent15clearActionListERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %168 unwind label %32

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

170:                                              ; preds = %164, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #7
  br label %171

171:                                              ; preds = %170
  %172 = load ptr, ptr %8, align 8
  %173 = load i32, ptr %9, align 4
  %174 = insertvalue { ptr, i32 } poison, ptr %172, 0
  %175 = insertvalue { ptr, i32 } %174, i32 %173, 1
  resume { ptr, i32 } %175
}

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

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

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 void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824), i64, i1 noundef zeroext) #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

declare noundef zeroext i1 @_ZN6Tetris6isLostEv(ptr noundef nonnull align 8 dereferenceable(824)) #4

declare noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr 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

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

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 = { 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 = !{!"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 = !{i64 0, i64 4, !13, i64 4, i64 4, !11}
!16 = !{!17, !6, i64 8}
!17 = !{!"_ZTS14NextPieceAgent", !18, i64 0, !6, i64 8}
!18 = !{!"_ZTS5Agent"}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !20}


; 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 @_ZN14NextPieceAgent9getActionEP6Tetris(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
  %5 = alloca %class.Action, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  call void @_ZNSt6vectorI6ActionSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef 0, i32 noundef 0)
          to label %.preheader69 unwind label %9

.preheader69:                                     ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  br label %11

7:                                                ; preds = %._crit_edge89
  %8 = invoke i64 @_ZN5Agent16pickRandomActionERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %89 unwind label %9

9:                                                ; preds = %89, %7, %2
  %10 = landingpad { ptr, i32 }
          cleanup
  br label %91

11:                                               ; preds = %.preheader69, %._crit_edge89
  %.092 = phi float [ -9.999990e+05, %.preheader69 ], [ %.1.lcssa, %._crit_edge89 ]
  %.05591 = phi i32 [ 0, %.preheader69 ], [ %13, %._crit_edge89 ]
  %12 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %1, i32 noundef %.05591)
          to label %.preheader68 unwind label %14

.preheader68:                                     ; preds = %11
  %.not85 = icmp slt i32 %12, 0
  br i1 %.not85, label %._crit_edge89, label %.lr.ph88

._crit_edge89:                                    ; preds = %.loopexit, %.preheader68
  %.1.lcssa = phi float [ %.092, %.preheader68 ], [ %.5, %.loopexit ]
  %13 = add nuw nsw i32 %.05591, 1
  %exitcond112.not = icmp eq i32 %13, 4
  br i1 %exitcond112.not, label %7, label %11, !llvm.loop !5

14:                                               ; preds = %11
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %91

.lr.ph88:                                         ; preds = %.preheader68, %.loopexit
  %.187 = phi float [ %.5, %.loopexit ], [ %.092, %.preheader68 ]
  %.05786 = phi i32 [ %88, %.loopexit ], [ 0, %.preheader68 ]
  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 %.05591, i32 noundef %.05786)
          to label %16 unwind label %23

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

18:                                               ; preds = %16
  %.sroa.011.0.copyload = load i64, ptr %4, align 8
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %17, i64 %.sroa.011.0.copyload, i1 noundef zeroext false)
          to label %19 unwind label %25

19:                                               ; preds = %18
  %20 = invoke noundef zeroext i1 @_ZN6Tetris6isLostEv(ptr noundef nonnull align 8 dereferenceable(824) %17)
          to label %21 unwind label %25

21:                                               ; preds = %19
  br i1 %20, label %.loopexit, label %.preheader67.preheader

.preheader67.preheader:                           ; preds = %21
  %22 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %17, i32 noundef 0)
          to label %.preheader unwind label %72

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

25:                                               ; preds = %19, %18, %16
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.preheader:                                       ; preds = %.preheader67.preheader
  %.not6080 = icmp slt i32 %22, 0
  br i1 %.not6080, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %86, %.preheader
  %.3.lcssa = phi float [ %.187, %.preheader ], [ %.4, %86 ]
  %27 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %17, i32 noundef 1)
          to label %.preheader.1 unwind label %72

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

.lr.ph.1:                                         ; preds = %.preheader.1, %40
  %.382.1 = phi float [ %.4.1, %40 ], [ %.3.lcssa, %.preheader.1 ]
  %.04881.1 = phi i32 [ %41, %40 ], [ 0, %.preheader.1 ]
  %28 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %17)
          to label %29 unwind label %.loopexit.split-lp.loopexit

29:                                               ; preds = %.lr.ph.1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 1, i32 noundef %.04881.1)
          to label %30 unwind label %.loopexit.split-lp96.loopexit

30:                                               ; preds = %29
  %.sroa.0.0.copyload.1 = load i64, ptr %5, align 8
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %28, i64 %.sroa.0.0.copyload.1, i1 noundef zeroext false)
          to label %31 unwind label %.loopexit.split-lp96.loopexit

31:                                               ; preds = %30
  %32 = load ptr, ptr %6, align 8, !tbaa !7
  %33 = invoke noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56) %32, ptr noundef nonnull %1, ptr noundef nonnull %28)
          to label %34 unwind label %.loopexit.split-lp96.loopexit

34:                                               ; preds = %31
  %35 = fcmp ogt float %33, %.382.1
  br i1 %35, label %39, label %36

36:                                               ; preds = %34
  %37 = fcmp oeq float %33, %.382.1
  br i1 %37, label %38, label %40

38:                                               ; preds = %36
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %40 unwind label %.loopexit.split-lp96.loopexit

39:                                               ; preds = %34
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %40 unwind label %.loopexit.split-lp96.loopexit

40:                                               ; preds = %39, %38, %36
  %.4.1 = phi float [ %33, %39 ], [ %.382.1, %38 ], [ %.382.1, %36 ]
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %28) #6
  call void @_ZdlPvm(ptr noundef %28, i64 noundef 824) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %41 = add nuw i32 %.04881.1, 1
  %exitcond.1.not = icmp eq i32 %.04881.1, %27
  br i1 %exitcond.1.not, label %._crit_edge.1, label %.lr.ph.1, !llvm.loop !13

._crit_edge.1:                                    ; preds = %40, %.preheader.1
  %.3.lcssa.1 = phi float [ %.3.lcssa, %.preheader.1 ], [ %.4.1, %40 ]
  %42 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %17, i32 noundef 2)
          to label %.preheader.2 unwind label %72

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

.lr.ph.2:                                         ; preds = %.preheader.2, %55
  %.382.2 = phi float [ %.4.2, %55 ], [ %.3.lcssa.1, %.preheader.2 ]
  %.04881.2 = phi i32 [ %56, %55 ], [ 0, %.preheader.2 ]
  %43 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %17)
          to label %44 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit

44:                                               ; preds = %.lr.ph.2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 2, i32 noundef %.04881.2)
          to label %45 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit

45:                                               ; preds = %44
  %.sroa.0.0.copyload.2 = load i64, ptr %5, align 8
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %43, i64 %.sroa.0.0.copyload.2, i1 noundef zeroext false)
          to label %46 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit

46:                                               ; preds = %45
  %47 = load ptr, ptr %6, align 8, !tbaa !7
  %48 = invoke noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56) %47, ptr noundef nonnull %1, ptr noundef nonnull %43)
          to label %49 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit

49:                                               ; preds = %46
  %50 = fcmp ogt float %48, %.382.2
  br i1 %50, label %54, label %51

51:                                               ; preds = %49
  %52 = fcmp oeq float %48, %.382.2
  br i1 %52, label %53, label %55

53:                                               ; preds = %51
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %55 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit

54:                                               ; preds = %49
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %55 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit

55:                                               ; preds = %54, %53, %51
  %.4.2 = phi float [ %48, %54 ], [ %.382.2, %53 ], [ %.382.2, %51 ]
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %43) #6
  call void @_ZdlPvm(ptr noundef %43, i64 noundef 824) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %56 = add nuw i32 %.04881.2, 1
  %exitcond.2.not = icmp eq i32 %.04881.2, %42
  br i1 %exitcond.2.not, label %._crit_edge.2, label %.lr.ph.2, !llvm.loop !13

._crit_edge.2:                                    ; preds = %55, %.preheader.2
  %.3.lcssa.2 = phi float [ %.3.lcssa.1, %.preheader.2 ], [ %.4.2, %55 ]
  %57 = invoke noundef i32 @_ZN6Tetris22highestValidColWithRotE8Rotation(ptr noundef nonnull align 8 dereferenceable(824) %17, i32 noundef 3)
          to label %.preheader.3 unwind label %72

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

.lr.ph.3:                                         ; preds = %.preheader.3, %70
  %.382.3 = phi float [ %.4.3, %70 ], [ %.3.lcssa.2, %.preheader.3 ]
  %.04881.3 = phi i32 [ %71, %70 ], [ 0, %.preheader.3 ]
  %58 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %17)
          to label %59 unwind label %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp

59:                                               ; preds = %.lr.ph.3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 3, i32 noundef %.04881.3)
          to label %60 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp

60:                                               ; preds = %59
  %.sroa.0.0.copyload.3 = load i64, ptr %5, align 8
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %58, i64 %.sroa.0.0.copyload.3, i1 noundef zeroext false)
          to label %61 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp

61:                                               ; preds = %60
  %62 = load ptr, ptr %6, align 8, !tbaa !7
  %63 = invoke noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56) %62, ptr noundef nonnull %1, ptr noundef nonnull %58)
          to label %64 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp

64:                                               ; preds = %61
  %65 = fcmp ogt float %63, %.382.3
  br i1 %65, label %69, label %66

66:                                               ; preds = %64
  %67 = fcmp oeq float %63, %.382.3
  br i1 %67, label %68, label %70

68:                                               ; preds = %66
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %70 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp

69:                                               ; preds = %64
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %70 unwind label %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp

70:                                               ; preds = %69, %68, %66
  %.4.3 = phi float [ %63, %69 ], [ %.382.3, %68 ], [ %.382.3, %66 ]
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %58) #6
  call void @_ZdlPvm(ptr noundef %58, i64 noundef 824) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %71 = add nuw i32 %.04881.3, 1
  %exitcond.3.not = icmp eq i32 %.04881.3, %57
  br i1 %exitcond.3.not, label %.loopexit, label %.lr.ph.3, !llvm.loop !13

72:                                               ; preds = %._crit_edge.2, %._crit_edge.1, %._crit_edge, %.preheader67.preheader
  %73 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.lr.ph:                                           ; preds = %.preheader, %86
  %.382 = phi float [ %.4, %86 ], [ %.187, %.preheader ]
  %.04881 = phi i32 [ %87, %86 ], [ 0, %.preheader ]
  %74 = invoke noundef ptr @_ZN6Tetris8gameCopyEv(ptr noundef nonnull align 8 dereferenceable(824) %17)
          to label %75 unwind label %.loopexit94

75:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  invoke void @_ZN6ActionC1E8Rotationi(ptr noundef nonnull align 4 dereferenceable(8) %5, i32 noundef 0, i32 noundef %.04881)
          to label %76 unwind label %.loopexit95

76:                                               ; preds = %75
  %.sroa.0.0.copyload = load i64, ptr %5, align 8
  invoke void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824) %74, i64 %.sroa.0.0.copyload, i1 noundef zeroext false)
          to label %77 unwind label %.loopexit95

77:                                               ; preds = %76
  %78 = load ptr, ptr %6, align 8, !tbaa !7
  %79 = invoke noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56) %78, ptr noundef nonnull %1, ptr noundef nonnull %74)
          to label %80 unwind label %.loopexit95

80:                                               ; preds = %77
  %81 = fcmp ogt float %79, %.382
  br i1 %81, label %82, label %83

82:                                               ; preds = %80
  invoke void @_ZN5Agent18foundNewBestActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %86 unwind label %.loopexit95

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

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

.loopexit.split-lp.loopexit.split-lp.loopexit:    ; preds = %.lr.ph.2
  %lpad.loopexit105 = 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-lp106 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp

.loopexit95:                                      ; preds = %75, %76, %77, %82, %85
  %lpad.loopexit97 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp96

.loopexit.split-lp96.loopexit:                    ; preds = %39, %38, %31, %30, %29
  %lpad.loopexit103 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp96

.loopexit.split-lp96.loopexit.split-lp.loopexit:  ; preds = %44, %45, %46, %53, %54
  %lpad.loopexit108 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp96

.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp: ; preds = %59, %60, %61, %68, %69
  %lpad.loopexit.split-lp109 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.split-lp96

.loopexit.split-lp96:                             ; preds = %.loopexit.split-lp96.loopexit, %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp96.loopexit.split-lp.loopexit, %.loopexit95
  %lpad.phi99 = phi { ptr, i32 } [ %lpad.loopexit97, %.loopexit95 ], [ %lpad.loopexit103, %.loopexit.split-lp96.loopexit ], [ %lpad.loopexit108, %.loopexit.split-lp96.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp109, %.loopexit.split-lp96.loopexit.split-lp.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %.loopexit.split-lp

83:                                               ; preds = %80
  %84 = fcmp oeq float %79, %.382
  br i1 %84, label %85, label %86

85:                                               ; preds = %83
  invoke void @_ZN5Agent15foundTiedActionERSt6vectorI6ActionSaIS1_EE8Rotationi(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.05591, i32 noundef %.05786)
          to label %86 unwind label %.loopexit95

86:                                               ; preds = %82, %85, %83
  %.4 = phi float [ %79, %82 ], [ %.382, %85 ], [ %.382, %83 ]
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %74) #6
  call void @_ZdlPvm(ptr noundef %74, i64 noundef 824) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %87 = add nuw i32 %.04881, 1
  %exitcond.not = icmp eq i32 %.04881, %22
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.loopexit:                                        ; preds = %70, %.preheader.3, %21
  %.5 = phi float [ %.187, %21 ], [ %.3.lcssa.2, %.preheader.3 ], [ %.4.3, %70 ]
  call void @_ZN6TetrisD1Ev(ptr noundef nonnull align 8 dereferenceable(824) %17) #6
  call void @_ZdlPvm(ptr noundef %17, i64 noundef 824) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %88 = add nuw i32 %.05786, 1
  %exitcond111.not = icmp eq i32 %.05786, %12
  br i1 %exitcond111.not, label %._crit_edge89, label %.lr.ph88, !llvm.loop !14

.loopexit.split-lp:                               ; preds = %.loopexit94, %.loopexit.split-lp.loopexit.split-lp.loopexit, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp, %.loopexit.split-lp.loopexit, %25, %.loopexit.split-lp96, %72, %23
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %24, %23 ], [ %26, %25 ], [ %73, %72 ], [ %lpad.phi99, %.loopexit.split-lp96 ], [ %lpad.loopexit, %.loopexit94 ], [ %lpad.loopexit100, %.loopexit.split-lp.loopexit ], [ %lpad.loopexit105, %.loopexit.split-lp.loopexit.split-lp.loopexit ], [ %lpad.loopexit.split-lp106, %.loopexit.split-lp.loopexit.split-lp.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %91

89:                                               ; preds = %7
  invoke void @_ZN5Agent15clearActionListERSt6vectorI6ActionSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef nonnull align 8 dereferenceable(24) %3)
          to label %90 unwind label %9

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

91:                                               ; preds = %14, %.loopexit.split-lp, %9
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %10, %9 ], [ %.pn.pn.pn.pn, %.loopexit.split-lp ], [ %15, %14 ]
  call void @_ZNSt6vectorI6ActionSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  resume { ptr, i32 } %.pn.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 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 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 void @_ZN6Tetris10playActionE6Actionb(ptr noundef nonnull align 8 dereferenceable(824), i64, i1 noundef zeroext) local_unnamed_addr #4

declare noundef zeroext i1 @_ZN6Tetris6isLostEv(ptr noundef nonnull align 8 dereferenceable(824)) local_unnamed_addr #4

declare noundef float @_ZN14HeuristicAgent18valueBetweenBoardsEP6TetrisS1_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr 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

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

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 = { 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"}
!7 = !{!8, !10, i64 8}
!8 = !{!"_ZTS14NextPieceAgent", !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 = distinct !{!13, !6}
!14 = distinct !{!14, !6}


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