; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces/cf1579_B.ll (Z5solvev)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl" }
%"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl" = type { %"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl_data" }
%"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.movement = type { i32, i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@a = external dso_local global [55 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checki(i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5shiftiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %struct.movement, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %struct.movement, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #7
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %27, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %30

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %24
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %25)
  br label %27

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

30:                                               ; preds = %21
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %33
  store i32 1061109567, ptr %34, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #7
  call void @_ZNSt6vectorI8movementSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  br label %35

35:                                               ; preds = %158, %30
  br label %36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #7
  store i8 1, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %37 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %37, ptr %6, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %103, %36
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 1
  br i1 %40, label %41, label %44

41:                                               ; preds = %38
  %42 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %43 = trunc i8 %42 to i1
  br label %44

44:                                               ; preds = %41, %38
  %45 = phi i1 [ false, %38 ], [ %43, %41 ]
  br i1 %45, label %47, label %46

46:                                               ; preds = %44
  store i32 7, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %106

47:                                               ; preds = %44
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp sle i32 %52, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %47
  br label %103

59:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %60 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %60, ptr %8, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %98, %59
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  %65 = icmp sle i32 %62, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %61
  store i32 10, ptr %7, align 4
  br label %101

67:                                               ; preds = %61
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp sgt i32 %71, %76
  br i1 %77, label %78, label %97

78:                                               ; preds = %67
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %3, align 4, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  call void @_Z5shiftiii(i32 noundef %82, i32 noundef %84, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #7
  %85 = getelementptr inbounds %struct.movement, ptr %9, i32 0, i32 0
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sub nsw i32 %86, 1
  store i32 %87, ptr %85, align 4, !tbaa !15
  %88 = getelementptr inbounds %struct.movement, ptr %9, i32 0, i32 1
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  store i32 %90, ptr %88, align 4, !tbaa !17
  %91 = getelementptr inbounds %struct.movement, ptr %9, i32 0, i32 2
  store i32 1, ptr %91, align 4, !tbaa !18
  invoke void @_ZNSt6vectorI8movementSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 4 dereferenceable(12) %9)
          to label %92 unwind label %93

92:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  store i8 0, ptr %5, align 1, !tbaa !11
  store i32 10, ptr %7, align 4
  br label %101

93:                                               ; preds = %78
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %10, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %159

97:                                               ; preds = %67
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %8, align 4, !tbaa !5
  br label %61, !llvm.loop !19

101:                                              ; preds = %92, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %102

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102, %58
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %6, align 4, !tbaa !5
  br label %38, !llvm.loop !20

106:                                              ; preds = %46
  %107 = load i32, ptr %1, align 4, !tbaa !5
  %108 = call noundef zeroext i1 @_Z5checki(i32 noundef %107)
  br i1 %108, label %109, label %155

109:                                              ; preds = %106
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %110)
          to label %112 unwind label %124

112:                                              ; preds = %109
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %111, i8 noundef signext 10)
          to label %114 unwind label %124

114:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr %4, ptr %12, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %115 = load ptr, ptr %12, align 8, !tbaa !21
  %116 = call ptr @_ZNSt6vectorI8movementSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %115) #7
  %117 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  store ptr %116, ptr %117, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %118 = load ptr, ptr %12, align 8, !tbaa !21
  %119 = call ptr @_ZNSt6vectorI8movementSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %118) #7
  %120 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %119, ptr %120, align 8
  br label %121

121:                                              ; preds = %148, %114
  %122 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP8movementSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  br i1 %122, label %128, label %123

123:                                              ; preds = %121
  store i32 13, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %154

124:                                              ; preds = %112, %109
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %10, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %11, align 4
  br label %159

128:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #7
  %129 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP8movementSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %129, i64 12, i1 false), !tbaa.struct !23
  %130 = getelementptr inbounds %struct.movement, ptr %15, i32 0, i32 0
  %131 = load i32, ptr %130, align 4, !tbaa !15
  %132 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %131)
          to label %133 unwind label %150

133:                                              ; preds = %128
  %134 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %132, i8 noundef signext 32)
          to label %135 unwind label %150

135:                                              ; preds = %133
  %136 = getelementptr inbounds %struct.movement, ptr %15, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !17
  %138 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %134, i32 noundef %137)
          to label %139 unwind label %150

139:                                              ; preds = %135
  %140 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %138, i8 noundef signext 32)
          to label %141 unwind label %150

141:                                              ; preds = %139
  %142 = getelementptr inbounds %struct.movement, ptr %15, i32 0, i32 2
  %143 = load i32, ptr %142, align 4, !tbaa !18
  %144 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %140, i32 noundef %143)
          to label %145 unwind label %150

145:                                              ; preds = %141
  %146 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %144, i8 noundef signext 10)
          to label %147 unwind label %150

147:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #7
  br label %148

148:                                              ; preds = %147
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP8movementSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br label %121

150:                                              ; preds = %145, %141, %139, %135, %133, %128
  %151 = landingpad { ptr, i32 }
          cleanup
  %152 = extractvalue { ptr, i32 } %151, 0
  store ptr %152, ptr %10, align 8
  %153 = extractvalue { ptr, i32 } %151, 1
  store i32 %153, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %159

154:                                              ; preds = %123
  store i32 1, ptr %7, align 4
  br label %156

155:                                              ; preds = %106
  store i32 0, ptr %7, align 4
  br label %156

156:                                              ; preds = %155, %154
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #7
  %157 = load i32, ptr %7, align 4
  switch i32 %157, label %160 [
    i32 0, label %158
  ]

158:                                              ; preds = %156
  br label %35, !llvm.loop !24

159:                                              ; preds = %150, %124, %93
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #7
  call void @_ZNSt6vectorI8movementSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  br label %161

160:                                              ; preds = %156
  call void @_ZNSt6vectorI8movementSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #7
  ret void

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #4

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP8movementSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl" }
%"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl" = type { %"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl_data" }
%"struct.std::_Vector_base<movement, std::allocator<movement>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.movement = type { i32, i32, i32 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@a = external dso_local global [55 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checki(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5shiftiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %struct.movement, align 4
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %.not38 = icmp slt i32 %7, 1
  br i1 %.not38, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %7, %0 ], [ %15, %.lr.ph ]
  %8 = add nsw i32 %.lcssa, 1
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %9
  store i32 1061109567, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #6
  call void @_ZNSt6vectorI8movementSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %11 = getelementptr inbounds i8, ptr %3, i64 4
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  br label %.critedge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %13 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %indvars.iv
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %.not.not = icmp slt i64 %indvars.iv, %16
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.critedge:                                        ; preds = %._crit_edge47, %._crit_edge
  %.023 = phi i32 [ 0, %._crit_edge ], [ %.1.lcssa, %._crit_edge47 ]
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph46.preheader, label %._crit_edge47

.lr.ph46.preheader:                               ; preds = %.critedge
  %19 = zext nneg i32 %17 to i64
  %20 = load i32, ptr %1, align 4
  %21 = add nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  br label %.lr.ph46

._crit_edge47.loopexit:                           ; preds = %.loopexit, %.loopexit.thread
  %.362 = phi i32 [ %36, %.loopexit.thread ], [ %.023, %.loopexit ]
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %._crit_edge47.loopexit, %.critedge
  %23 = phi i32 [ %17, %.critedge ], [ %.pre, %._crit_edge47.loopexit ]
  %.1.lcssa = phi i32 [ %.023, %.critedge ], [ %.362, %._crit_edge47.loopexit ]
  %24 = call noundef zeroext i1 @_Z5checki(i32 noundef %23)
  br i1 %24, label %42, label %.critedge, !llvm.loop !11

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %.loopexit
  %indvars.iv55 = phi i64 [ %19, %.lr.ph46.preheader ], [ %indvars.iv.next56, %.loopexit ]
  %indvars.iv.next56 = add nsw i64 %indvars.iv55, -1
  %25 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %indvars.iv.next56
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %indvars.iv55
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %.not33 = icmp sle i32 %26, %28
  %.not3440 = icmp sgt i64 %indvars.iv55, %22
  %or.cond = select i1 %.not33, i1 true, i1 %.not3440
  br i1 %or.cond, label %.loopexit, label %.lr.ph42

.lr.ph42:                                         ; preds = %.lr.ph46, %39
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %39 ], [ %indvars.iv55, %.lr.ph46 ]
  %29 = getelementptr inbounds [55 x i32], ptr @a, i64 0, i64 %indvars.iv57
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, %26
  br i1 %31, label %32, label %39

32:                                               ; preds = %.lr.ph42
  %33 = trunc nuw i64 %indvars.iv57 to i32
  %34 = add nsw i32 %33, -1
  %35 = trunc nuw nsw i64 %indvars.iv.next56 to i32
  call void @_Z5shiftiii(i32 noundef %35, i32 noundef %34, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #6
  store i32 %35, ptr %3, align 4, !tbaa !12
  store i32 %34, ptr %11, align 4, !tbaa !14
  store i32 1, ptr %12, align 4, !tbaa !15
  invoke void @_ZNSt6vectorI8movementSaIS0_EE9push_backEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(12) %3)
          to label %.loopexit.thread unwind label %37

.loopexit.thread:                                 ; preds = %32
  %36 = add nsw i32 %.023, 1
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  br label %._crit_edge47.loopexit

37:                                               ; preds = %32
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #6
  br label %69

39:                                               ; preds = %.lr.ph42
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %40 = trunc nuw i64 %indvars.iv57 to i32
  %.not34 = icmp slt i32 %20, %40
  br i1 %.not34, label %.loopexit, label %.lr.ph42, !llvm.loop !16

.loopexit:                                        ; preds = %39, %.lr.ph46
  %41 = icmp sgt i64 %indvars.iv55, 2
  br i1 %41, label %.lr.ph46, label %._crit_edge47.loopexit, !llvm.loop !17

42:                                               ; preds = %._crit_edge47
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.1.lcssa)
          to label %44 unwind label %50

44:                                               ; preds = %42
  %45 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %43, i8 noundef signext 10)
          to label %46 unwind label %50

46:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %47 = call ptr @_ZNSt6vectorI8movementSaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  store ptr %47, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %48 = call ptr @_ZNSt6vectorI8movementSaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  store ptr %48, ptr %5, align 8
  %49 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP8movementSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %49, label %.lr.ph50, label %.loopexit63

50:                                               ; preds = %44, %42
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %69

.lr.ph50:                                         ; preds = %46, %64
  %52 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP8movementSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %.sroa.0.0.copyload = load i32, ptr %52, align 4, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %52, i64 4
  %.sroa.5.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %52, i64 8
  %.sroa.6.0.copyload = load i32, ptr %.sroa.6.0..sroa_idx, align 4, !tbaa !5
  %53 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.sroa.0.0.copyload)
          to label %54 unwind label %67

54:                                               ; preds = %.lr.ph50
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %53, i8 noundef signext 32)
          to label %56 unwind label %67

56:                                               ; preds = %54
  %57 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %55, i32 noundef %.sroa.5.0.copyload)
          to label %58 unwind label %67

58:                                               ; preds = %56
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %57, i8 noundef signext 32)
          to label %60 unwind label %67

60:                                               ; preds = %58
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %59, i32 noundef %.sroa.6.0.copyload)
          to label %62 unwind label %67

62:                                               ; preds = %60
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %61, i8 noundef signext 10)
          to label %64 unwind label %67

64:                                               ; preds = %62
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIP8movementSt6vectorIS1_SaIS1_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %66 = call noundef zeroext i1 @_ZN9__gnu_cxxneIP8movementSt6vectorIS1_SaIS1_EEEEbRKNS_17__normal_iteratorIT_T0_EESB_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br i1 %66, label %.lr.ph50, label %.loopexit63

67:                                               ; preds = %62, %60, %58, %56, %54, %.lr.ph50
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %69

69:                                               ; preds = %67, %50, %37
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %68, %67 ], [ %51, %50 ]
  call void @_ZNSt6vectorI8movementSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn

.loopexit63:                                      ; preds = %64, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNSt6vectorI8movementSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret void
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #4

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZNK9__gnu_cxx17__normal_iteratorIP8movementSt6vectorIS1_SaIS1_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

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

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


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