; LLVM IR from BehaviorTree/BehaviorTree.CPP :: src/controls/manual_node.ll (ZNK2BT18ManualSelectorNode11selectChildEv)

; 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.23" = type { %"struct.std::_Vector_base.24" }
%"struct.std::_Vector_base.24" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.28" = type { ptr }
%"class.BT::ControlNode" = type { %"class.BT::TreeNode", %"class.std::vector" }
%"class.BT::TreeNode" = type { ptr, %"class.std::unique_ptr" }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl" }
%"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl" = type { %"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<BT::TreeNode *, std::allocator<BT::TreeNode *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.17 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [3 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i8 @_ZNK2BT18ManualSelectorNode11selectChildEv(ptr noundef nonnull align 8 dereferenceable(48) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"class.std::vector.23", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator.28", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.28", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i64, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i8, align 1
  %20 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %21 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %22 = getelementptr inbounds %"class.BT::ControlNode", ptr %21, i32 0, i32 1
  %23 = call noundef i64 @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #5
  store i64 %23, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  %24 = load i64, ptr %3, align 8, !tbaa !9
  invoke void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %24)
          to label %25 unwind label %36

25:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %26 = getelementptr inbounds %"class.BT::ControlNode", ptr %21, i32 0, i32 1
  store ptr %26, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = call ptr @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #5
  %29 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %28, ptr %29, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call ptr @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %30) #5
  %32 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %9, i32 0, i32 0
  store ptr %31, ptr %32, align 8
  br label %33

33:                                               ; preds = %47, %25
  %34 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  br i1 %34, label %40, label %35

35:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %53

36:                                               ; preds = %1
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %5, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %6, align 4
  br label %256

40:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  store ptr %41, ptr %10, align 8, !tbaa !5
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16) %43)
          to label %45 unwind label %49

45:                                               ; preds = %40
  invoke void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(32) %44)
          to label %46 unwind label %49

46:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %47

47:                                               ; preds = %46
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  br label %33

49:                                               ; preds = %45, %40
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %5, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %256

53:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 10, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr %4, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %54) #5
  %56 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.28", ptr %13, i32 0, i32 0
  store ptr %55, ptr %56, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #5
  %59 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.28", ptr %14, i32 0, i32 0
  store ptr %58, ptr %59, align 8
  br label %60

60:                                               ; preds = %71, %53
  %61 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #5
  br i1 %61, label %63, label %62

62:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %77

63:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %64 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  store ptr %64, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %65 = load ptr, ptr %15, align 8, !tbaa !5
  %66 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %65) #5
  %67 = add i64 %66, 2
  store i64 %67, ptr %16, align 8, !tbaa !9
  %68 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %69 unwind label %73

69:                                               ; preds = %63
  %70 = load i64, ptr %68, align 8, !tbaa !9
  store i64 %70, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %71

71:                                               ; preds = %69
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  br label %60

73:                                               ; preds = %63
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %5, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %255

77:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %78 = invoke ptr @initscr()
          to label %79 unwind label %104

79:                                               ; preds = %77
  %80 = invoke i32 @cbreak()
          to label %81 unwind label %104

81:                                               ; preds = %79
  %82 = load i64, ptr %3, align 8, !tbaa !9
  %83 = add i64 %82, 6
  %84 = trunc i64 %83 to i32
  %85 = invoke ptr @newwin(i32 noundef %84, i32 noundef 70, i32 noundef 1, i32 noundef 1)
          to label %86 unwind label %104

86:                                               ; preds = %81
  store ptr %85, ptr %17, align 8, !tbaa !5
  %87 = load ptr, ptr %17, align 8, !tbaa !5
  %88 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %87, i32 noundef 0, i32 noundef 0, ptr noundef @.str.17)
          to label %89 unwind label %104

89:                                               ; preds = %86
  %90 = load ptr, ptr %17, align 8, !tbaa !5
  %91 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %90, i32 noundef 1, i32 noundef 0, ptr noundef @.str.18)
          to label %92 unwind label %104

92:                                               ; preds = %89
  %93 = load ptr, ptr %17, align 8, !tbaa !5
  %94 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %93, i32 noundef 2, i32 noundef 0, ptr noundef @.str.19)
          to label %95 unwind label %104

95:                                               ; preds = %92
  %96 = load ptr, ptr %17, align 8, !tbaa !5
  %97 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %96, i32 noundef 3, i32 noundef 0, ptr noundef @.str.20)
          to label %98 unwind label %104

98:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store i64 0, ptr %18, align 8, !tbaa !9
  br label %99

99:                                               ; preds = %120, %98
  %100 = load i64, ptr %18, align 8, !tbaa !9
  %101 = call noundef i64 @_ZNKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  %102 = icmp ult i64 %100, %101
  br i1 %102, label %108, label %103

103:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %127

104:                                              ; preds = %135, %132, %130, %127, %95, %92, %89, %86, %81, %79, %77
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %5, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %6, align 4
  br label %254

108:                                              ; preds = %99
  %109 = load ptr, ptr %17, align 8, !tbaa !5
  %110 = load i64, ptr %18, align 8, !tbaa !9
  %111 = add i64 %110, 5
  %112 = trunc i64 %111 to i32
  %113 = load i64, ptr %18, align 8, !tbaa !9
  %114 = add i64 %113, 1
  %115 = load i64, ptr %18, align 8, !tbaa !9
  %116 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %115) #5
  %117 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %116) #5
  %118 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %109, i32 noundef %112, i32 noundef 0, ptr noundef @.str.21, i64 noundef %114, ptr noundef %117)
          to label %119 unwind label %123

119:                                              ; preds = %108
  br label %120

120:                                              ; preds = %119
  %121 = load i64, ptr %18, align 8, !tbaa !9
  %122 = add i64 %121, 1
  store i64 %122, ptr %18, align 8, !tbaa !9
  br label %99, !llvm.loop !11

123:                                              ; preds = %108
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %5, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %254

127:                                              ; preds = %103
  %128 = load ptr, ptr %17, align 8, !tbaa !5
  %129 = invoke i32 @wrefresh(ptr noundef %128)
          to label %130 unwind label %104

130:                                              ; preds = %127
  %131 = invoke i32 @noecho()
          to label %132 unwind label %104

132:                                              ; preds = %130
  %133 = load ptr, ptr %17, align 8, !tbaa !5
  %134 = invoke i32 @keypad(ptr noundef %133, i1 noundef zeroext true)
          to label %135 unwind label %104

135:                                              ; preds = %132
  %136 = invoke i32 @curs_set(i32 noundef 0)
          to label %137 unwind label %104

137:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #5
  store i8 0, ptr %19, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !14
  br label %138

138:                                              ; preds = %240, %137
  br label %139

139:                                              ; preds = %138
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = invoke i32 @wattr_off(ptr noundef %140, i32 noundef 65536, ptr noundef null)
          to label %142 unwind label %169

142:                                              ; preds = %139
  %143 = load ptr, ptr %17, align 8, !tbaa !5
  %144 = load i8, ptr %19, align 1, !tbaa !13
  %145 = zext i8 %144 to i32
  %146 = add nsw i32 %145, 5
  %147 = load i8, ptr %19, align 1, !tbaa !13
  %148 = zext i8 %147 to i64
  %149 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %148) #5
  %150 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %149) #5
  %151 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %143, i32 noundef %146, i32 noundef 4, ptr noundef @.str.22, ptr noundef %150)
          to label %152 unwind label %169

152:                                              ; preds = %142
  %153 = load i32, ptr %20, align 4, !tbaa !14
  %154 = icmp eq i32 %153, 258
  br i1 %154, label %155, label %173

155:                                              ; preds = %152
  %156 = load i8, ptr %19, align 1, !tbaa !13
  %157 = zext i8 %156 to i64
  %158 = load i64, ptr %3, align 8, !tbaa !9
  %159 = sub i64 %158, 1
  %160 = icmp eq i64 %157, %159
  br i1 %160, label %161, label %162

161:                                              ; preds = %155
  br label %166

162:                                              ; preds = %155
  %163 = load i8, ptr %19, align 1, !tbaa !13
  %164 = zext i8 %163 to i32
  %165 = add nsw i32 %164, 1
  br label %166

166:                                              ; preds = %162, %161
  %167 = phi i32 [ 0, %161 ], [ %165, %162 ]
  %168 = trunc i32 %167 to i8
  store i8 %168, ptr %19, align 1, !tbaa !13
  br label %224

169:                                              ; preds = %250, %247, %244, %241, %237, %227, %224, %142, %139
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %5, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  br label %254

173:                                              ; preds = %152
  %174 = load i32, ptr %20, align 4, !tbaa !14
  %175 = icmp eq i32 %174, 259
  br i1 %175, label %176, label %191

176:                                              ; preds = %173
  %177 = load i8, ptr %19, align 1, !tbaa !13
  %178 = zext i8 %177 to i32
  %179 = icmp eq i32 %178, 0
  br i1 %179, label %180, label %183

180:                                              ; preds = %176
  %181 = load i64, ptr %3, align 8, !tbaa !9
  %182 = sub i64 %181, 1
  br label %188

183:                                              ; preds = %176
  %184 = load i8, ptr %19, align 1, !tbaa !13
  %185 = zext i8 %184 to i32
  %186 = sub nsw i32 %185, 1
  %187 = sext i32 %186 to i64
  br label %188

188:                                              ; preds = %183, %180
  %189 = phi i64 [ %182, %180 ], [ %187, %183 ]
  %190 = trunc i64 %189 to i8
  store i8 %190, ptr %19, align 1, !tbaa !13
  br label %223

191:                                              ; preds = %173
  %192 = load i32, ptr %20, align 4, !tbaa !14
  %193 = icmp eq i32 %192, 343
  br i1 %193, label %197, label %194

194:                                              ; preds = %191
  %195 = load i32, ptr %20, align 4, !tbaa !14
  %196 = icmp eq i32 %195, 10
  br i1 %196, label %197, label %198

197:                                              ; preds = %194, %191
  br label %241

198:                                              ; preds = %194
  %199 = load i32, ptr %20, align 4, !tbaa !14
  %200 = icmp eq i32 %199, 115
  br i1 %200, label %204, label %201

201:                                              ; preds = %198
  %202 = load i32, ptr %20, align 4, !tbaa !14
  %203 = icmp eq i32 %202, 83
  br i1 %203, label %204, label %205

204:                                              ; preds = %201, %198
  store i8 -3, ptr %19, align 1, !tbaa !13
  br label %241

205:                                              ; preds = %201
  %206 = load i32, ptr %20, align 4, !tbaa !14
  %207 = icmp eq i32 %206, 102
  br i1 %207, label %211, label %208

208:                                              ; preds = %205
  %209 = load i32, ptr %20, align 4, !tbaa !14
  %210 = icmp eq i32 %209, 70
  br i1 %210, label %211, label %212

211:                                              ; preds = %208, %205
  store i8 -2, ptr %19, align 1, !tbaa !13
  br label %241

212:                                              ; preds = %208
  %213 = load i32, ptr %20, align 4, !tbaa !14
  %214 = icmp eq i32 %213, 114
  br i1 %214, label %218, label %215

215:                                              ; preds = %212
  %216 = load i32, ptr %20, align 4, !tbaa !14
  %217 = icmp eq i32 %216, 82
  br i1 %217, label %218, label %219

218:                                              ; preds = %215, %212
  store i8 -1, ptr %19, align 1, !tbaa !13
  br label %241

219:                                              ; preds = %215
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222, %188
  br label %224

224:                                              ; preds = %223, %166
  %225 = load ptr, ptr %17, align 8, !tbaa !5
  %226 = invoke i32 @wattr_on(ptr noundef %225, i32 noundef 65536, ptr noundef null)
          to label %227 unwind label %169

227:                                              ; preds = %224
  %228 = load ptr, ptr %17, align 8, !tbaa !5
  %229 = load i8, ptr %19, align 1, !tbaa !13
  %230 = zext i8 %229 to i32
  %231 = add nsw i32 %230, 5
  %232 = load i8, ptr %19, align 1, !tbaa !13
  %233 = zext i8 %232 to i64
  %234 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %233) #5
  %235 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %234) #5
  %236 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %228, i32 noundef %231, i32 noundef 4, ptr noundef @.str.22, ptr noundef %235)
          to label %237 unwind label %169

237:                                              ; preds = %227
  %238 = load ptr, ptr %17, align 8, !tbaa !5
  %239 = invoke i32 @wgetch(ptr noundef %238)
          to label %240 unwind label %169

240:                                              ; preds = %237
  store i32 %239, ptr %20, align 4, !tbaa !14
  br label %138, !llvm.loop !16

241:                                              ; preds = %218, %211, %204, %197
  %242 = load ptr, ptr %17, align 8, !tbaa !5
  %243 = invoke i32 @werase(ptr noundef %242)
          to label %244 unwind label %169

244:                                              ; preds = %241
  %245 = load ptr, ptr %17, align 8, !tbaa !5
  %246 = invoke i32 @wrefresh(ptr noundef %245)
          to label %247 unwind label %169

247:                                              ; preds = %244
  %248 = load ptr, ptr %17, align 8, !tbaa !5
  %249 = invoke i32 @delwin(ptr noundef %248)
          to label %250 unwind label %169

250:                                              ; preds = %247
  %251 = invoke i32 @endwin()
          to label %252 unwind label %169

252:                                              ; preds = %250
  %253 = load i8, ptr %19, align 1, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret i8 %253

254:                                              ; preds = %169, %123, %104
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %255

255:                                              ; preds = %254, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %256

256:                                              ; preds = %255, %49, %36
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %257

257:                                              ; preds = %256
  %258 = load ptr, ptr %5, align 8
  %259 = load i32, ptr %6, align 4
  %260 = insertvalue { ptr, i32 } poison, ptr %258, 0
  %261 = insertvalue { ptr, i32 } %260, i32 %259, 1
  resume { ptr, i32 } %261
}

declare ptr @initscr() #3

declare i32 @cbreak() #3

declare ptr @newwin(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

declare i32 @mvwprintw(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ...) #3

declare i32 @wrefresh(ptr noundef) #3

declare i32 @noecho() #3

declare i32 @keypad(ptr noundef, i1 noundef zeroext) #3

declare i32 @curs_set(i32 noundef) #3

declare i32 @wgetch(ptr noundef) #3

declare i32 @werase(ptr noundef) #3

declare i32 @delwin(ptr noundef) #3

declare i32 @endwin() #3

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16)) #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

declare i32 @wattr_off(ptr noundef, i32 noundef, ptr noundef) #3

declare i32 @wattr_on(ptr noundef, i32 noundef, ptr noundef) #3

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

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


; 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.23" = type { %"struct.std::_Vector_base.24" }
%"struct.std::_Vector_base.24" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.__gnu_cxx::__normal_iterator.28" = type { ptr }

@.str.17 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [3 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i8 @_ZNK2BT18ManualSelectorNode11selectChildEv(ptr noundef nonnull align 8 dereferenceable(48) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::vector.23", align 8
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca i64, align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator.28", align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator.28", align 8
  %8 = alloca i64, align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = tail call noundef i64 @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  invoke void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %10)
          to label %11 unwind label %18

11:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %12 = call ptr @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  store ptr %12, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %13 = call ptr @_ZNKSt6vectorIPN2BT8TreeNodeESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #5
  store ptr %13, ptr %4, align 8
  %14 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %14, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %24, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store i64 10, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %15 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  store ptr %15, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %16 = call ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  store ptr %16, ptr %7, align 8
  %17 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %17, label %.lr.ph72, label %._crit_edge73

18:                                               ; preds = %1
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %116

.lr.ph:                                           ; preds = %11, %24
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16) %21)
          to label %23 unwind label %27

23:                                               ; preds = %.lr.ph
  invoke void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(32) %22)
          to label %24 unwind label %27

24:                                               ; preds = %23
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %26 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  br i1 %26, label %.lr.ph, label %._crit_edge

27:                                               ; preds = %23, %.lr.ph
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %116

._crit_edge73:                                    ; preds = %.lr.ph72, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %29 = invoke ptr @initscr()
          to label %37 unwind label %55

.lr.ph72:                                         ; preds = %._crit_edge, %.lr.ph72
  %30 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %31 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %30) #5
  %32 = add i64 %31, 2
  store i64 %32, ptr %8, align 8, !tbaa !5
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %34 = load i64, ptr %33, align 8, !tbaa !5
  store i64 %34, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  %36 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #5
  br i1 %36, label %.lr.ph72, label %._crit_edge73

37:                                               ; preds = %._crit_edge73
  %38 = invoke i32 @cbreak()
          to label %39 unwind label %55

39:                                               ; preds = %37
  %40 = trunc i64 %10 to i32
  %41 = add i32 %40, 6
  %42 = invoke ptr @newwin(i32 noundef %41, i32 noundef 70, i32 noundef 1, i32 noundef 1)
          to label %43 unwind label %55

43:                                               ; preds = %39
  %44 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @.str.17)
          to label %45 unwind label %55

45:                                               ; preds = %43
  %46 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef 1, i32 noundef 0, ptr noundef nonnull @.str.18)
          to label %47 unwind label %55

47:                                               ; preds = %45
  %48 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef 2, i32 noundef 0, ptr noundef nonnull @.str.19)
          to label %49 unwind label %55

49:                                               ; preds = %47
  %50 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef 3, i32 noundef 0, ptr noundef nonnull @.str.20)
          to label %.preheader70 unwind label %55

.preheader70:                                     ; preds = %49, %57
  %.059 = phi i64 [ %60, %57 ], [ 0, %49 ]
  %51 = call noundef i64 @_ZNKSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  %52 = icmp ult i64 %.059, %51
  br i1 %52, label %57, label %53

53:                                               ; preds = %.preheader70
  %54 = invoke i32 @wrefresh(ptr noundef %42)
          to label %66 unwind label %55

55:                                               ; preds = %70, %68, %66, %53, %49, %47, %45, %43, %39, %37, %._crit_edge73
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %115

57:                                               ; preds = %.preheader70
  %58 = trunc i64 %.059 to i32
  %59 = add i32 %58, 5
  %60 = add nuw i64 %.059, 1
  %61 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %.059) #5
  %62 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %61) #5
  %63 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef %59, i32 noundef 0, ptr noundef nonnull @.str.21, i64 noundef %60, ptr noundef %62)
          to label %.preheader70 unwind label %64, !llvm.loop !11

64:                                               ; preds = %57
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %115

66:                                               ; preds = %53
  %67 = invoke i32 @noecho()
          to label %68 unwind label %55

68:                                               ; preds = %66
  %69 = invoke i32 @keypad(ptr noundef %42, i1 noundef zeroext true)
          to label %70 unwind label %55

70:                                               ; preds = %68
  %71 = invoke i32 @curs_set(i32 noundef 0)
          to label %.preheader unwind label %55

.preheader:                                       ; preds = %70
  %72 = add i64 %10, 255
  %73 = add i64 %10, -1
  br label %74

74:                                               ; preds = %.preheader, %105
  %.058 = phi i8 [ %.1, %105 ], [ 0, %.preheader ]
  %.0 = phi i32 [ %106, %105 ], [ 0, %.preheader ]
  %75 = invoke i32 @wattr_off(ptr noundef %42, i32 noundef 65536, ptr noundef null)
          to label %76 unwind label %.loopexit

76:                                               ; preds = %74
  %77 = zext i8 %.058 to i32
  %78 = add nuw nsw i32 %77, 5
  %79 = zext i8 %.058 to i64
  %80 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %79) #5
  %81 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %80) #5
  %82 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef %78, i32 noundef 4, ptr noundef nonnull @.str.22, ptr noundef %81)
          to label %83 unwind label %.loopexit

83:                                               ; preds = %76
  switch i32 %.0, label %94 [
    i32 258, label %84
    i32 259, label %88
    i32 343, label %.fold.split
    i32 10, label %.fold.split
  ]

84:                                               ; preds = %83
  %85 = icmp eq i64 %73, %79
  %86 = add i8 %.058, 1
  %87 = select i1 %85, i8 0, i8 %86
  br label %96

.loopexit:                                        ; preds = %74, %76, %96, %98, %105
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %115

.loopexit.split-lp:                               ; preds = %.fold.split, %108, %110, %112
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %115

88:                                               ; preds = %83
  %89 = icmp eq i8 %.058, 0
  %90 = add nuw nsw i32 %77, 255
  %91 = zext nneg i32 %90 to i64
  %92 = select i1 %89, i64 %72, i64 %91
  %93 = trunc i64 %92 to i8
  br label %96

94:                                               ; preds = %83
  %95 = and i32 %.0, -33
  switch i32 %95, label %96 [
    i32 83, label %.fold.split.loopexit75
    i32 70, label %.fold.split.loopexit
    i32 82, label %.fold.split
  ]

96:                                               ; preds = %94, %88, %84
  %.1 = phi i8 [ %87, %84 ], [ %93, %88 ], [ %.058, %94 ]
  %97 = invoke i32 @wattr_on(ptr noundef %42, i32 noundef 65536, ptr noundef null)
          to label %98 unwind label %.loopexit

98:                                               ; preds = %96
  %99 = zext i8 %.1 to i32
  %100 = add nuw nsw i32 %99, 5
  %101 = zext i8 %.1 to i64
  %102 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %101) #5
  %103 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %102) #5
  %104 = invoke i32 (ptr, i32, i32, ptr, ...) @mvwprintw(ptr noundef %42, i32 noundef %100, i32 noundef 4, ptr noundef nonnull @.str.22, ptr noundef %103)
          to label %105 unwind label %.loopexit

105:                                              ; preds = %98
  %106 = invoke i32 @wgetch(ptr noundef %42)
          to label %74 unwind label %.loopexit, !llvm.loop !13

.fold.split.loopexit75:                           ; preds = %94
  br label %.fold.split

.fold.split.loopexit:                             ; preds = %94
  br label %.fold.split

.fold.split:                                      ; preds = %83, %83, %94, %.fold.split.loopexit, %.fold.split.loopexit75
  %.2 = phi i8 [ -3, %.fold.split.loopexit75 ], [ -1, %94 ], [ %.058, %83 ], [ %.058, %83 ], [ -2, %.fold.split.loopexit ]
  %107 = invoke i32 @werase(ptr noundef %42)
          to label %108 unwind label %.loopexit.split-lp

108:                                              ; preds = %.fold.split
  %109 = invoke i32 @wrefresh(ptr noundef %42)
          to label %110 unwind label %.loopexit.split-lp

110:                                              ; preds = %108
  %111 = invoke i32 @delwin(ptr noundef %42)
          to label %112 unwind label %.loopexit.split-lp

112:                                              ; preds = %110
  %113 = invoke i32 @endwin()
          to label %114 unwind label %.loopexit.split-lp

114:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  ret i8 %.2

115:                                              ; preds = %.loopexit, %.loopexit.split-lp, %64, %55
  %.pn = phi { ptr, i32 } [ %65, %64 ], [ %56, %55 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br label %116

116:                                              ; preds = %115, %27, %18
  %.pn66 = phi { ptr, i32 } [ %28, %27 ], [ %.pn, %115 ], [ %19, %18 ]
  call void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn66
}

declare ptr @initscr() local_unnamed_addr #3

declare i32 @cbreak() local_unnamed_addr #3

declare ptr @newwin(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare i32 @mvwprintw(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #3

declare i32 @wrefresh(ptr noundef) local_unnamed_addr #3

declare i32 @noecho() local_unnamed_addr #3

declare i32 @keypad(ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

declare i32 @curs_set(i32 noundef) local_unnamed_addr #3

declare i32 @wgetch(ptr noundef) local_unnamed_addr #3

declare i32 @werase(ptr noundef) local_unnamed_addr #3

declare i32 @delwin(ptr noundef) local_unnamed_addr #3

declare i32 @endwin() local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKPN2BT8TreeNodeESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNK2BT8TreeNode4nameB5cxx11Ev(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEEbRKNS_17__normal_iteratorIT_T0_EESG_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt6vectorIS6_SaIS6_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

declare i32 @wattr_off(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare i32 @wattr_on(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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 #5 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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