; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 11/2009. Canteen Line (main)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator.0" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@posle = external dso_local global [1005 x %"class.std::vector"], align 16
@groups = external dso_local global [1005 x %"class.std::vector"], align 16
@as = external dso_local global %"class.std::vector", align 8
@bs = external dso_local global %"class.std::vector", align 8
@ans = external dso_local global [1005 x i32], align 16
@groupTime = external dso_local global [1005 x i32], align 16
@pos = external dso_local global [1005 x i32], align 16
@squad = external dso_local global [1005 x i32], align 16
@currGroups = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6recalcv() #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %20 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @pos, ptr noundef getelementptr inbounds (i32, ptr @pos, i64 1005), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %41, %0
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %44

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

28:                                               ; preds = %34, %27
  br label %29

29:                                               ; preds = %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %4)
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  br label %40

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1005 x %"class.std::vector"], ptr @posle, i64 0, i64 %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  store i32 %39, ptr %5, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %28, !llvm.loop !9

40:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !5
  br label %22, !llvm.loop !11

44:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %72, %44
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8, ptr noundef %9)
  %52 = load i32, ptr %8, align 4, !tbaa !5
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %54
  store i32 %52, ptr %55, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %68, %50
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %71

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %11)
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1005 x %"class.std::vector"], ptr @groups, i64 0, i64 %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %66 = load i32, ptr %11, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  store i32 %67, ptr %12, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %65, ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %68

68:                                               ; preds = %61
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %10, align 4, !tbaa !5
  br label %56, !llvm.loop !12

71:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %6, align 4, !tbaa !5
  br label %45, !llvm.loop !13

75:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %156, %102, %75
  br label %77

77:                                               ; preds = %76
  %78 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %79 = icmp eq i64 %78, 0
  br i1 %79, label %80, label %88

80:                                               ; preds = %77
  %81 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %82 = icmp eq i64 %81, 0
  br i1 %82, label %83, label %88

83:                                               ; preds = %80
  %84 = load i32, ptr @currGroups, align 4, !tbaa !5
  %85 = load i32, ptr @m, align 4, !tbaa !5
  %86 = icmp sge i32 %84, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %83
  br label %159

88:                                               ; preds = %83, %80, %77
  %89 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %90 = icmp eq i64 %89, 0
  br i1 %90, label %91, label %108

91:                                               ; preds = %88
  %92 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %93 = icmp eq i64 %92, 0
  br i1 %93, label %94, label %108

94:                                               ; preds = %91
  %95 = load i32, ptr %13, align 4, !tbaa !5
  %96 = load i32, ptr @currGroups, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = icmp slt i32 %95, %100
  br i1 %101, label %102, label %108

102:                                              ; preds = %94
  %103 = load i32, ptr @currGroups, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = sub nsw i32 %106, 1
  store i32 %107, ptr %13, align 4, !tbaa !5
  br label %76, !llvm.loop !14

108:                                              ; preds = %94, %91, %88
  %109 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %110 = icmp ugt i64 %109, 0
  br i1 %110, label %111, label %123

111:                                              ; preds = %108
  %112 = load i32, ptr %13, align 4, !tbaa !5
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @as, i64 noundef 0) #6
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1005 x i32], ptr @ans, i64 0, i64 %115
  store i32 %112, ptr %116, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %117 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %118 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  store ptr %117, ptr %118, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEC2IPivEERKNS0_IT_S5_EE(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  %119 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.0", ptr %14, i32 0, i32 0
  %120 = load ptr, ptr %119, align 8
  %121 = call ptr @_ZNSt6vectorIiSaIiEE5eraseEN9__gnu_cxx17__normal_iteratorIPKiS1_EE(ptr noundef nonnull align 8 dereferenceable(24) @as, ptr %120)
  %122 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %16, i32 0, i32 0
  store ptr %121, ptr %122, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %123

123:                                              ; preds = %111, %108
  %124 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %125 = icmp ugt i64 %124, 0
  br i1 %125, label %126, label %138

126:                                              ; preds = %123
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @bs, i64 noundef 0) #6
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1005 x i32], ptr @ans, i64 0, i64 %130
  store i32 %127, ptr %131, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %132 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %133 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %132, ptr %133, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEC2IPivEERKNS0_IT_S5_EE(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #6
  %134 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.0", ptr %17, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8
  %136 = call ptr @_ZNSt6vectorIiSaIiEE5eraseEN9__gnu_cxx17__normal_iteratorIPKiS1_EE(ptr noundef nonnull align 8 dereferenceable(24) @bs, ptr %135)
  %137 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %19, i32 0, i32 0
  store ptr %136, ptr %137, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  br label %138

138:                                              ; preds = %126, %123
  call void @_Z6recalcv()
  br label %139

139:                                              ; preds = %152, %138
  %140 = load i32, ptr @currGroups, align 4, !tbaa !5
  %141 = load i32, ptr @m, align 4, !tbaa !5
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %143, label %150

143:                                              ; preds = %139
  %144 = load i32, ptr @currGroups, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = load i32, ptr %13, align 4, !tbaa !5
  %149 = icmp eq i32 %147, %148
  br label %150

150:                                              ; preds = %143, %139
  %151 = phi i1 [ false, %139 ], [ %149, %143 ]
  br i1 %151, label %152, label %156

152:                                              ; preds = %150
  %153 = load i32, ptr @currGroups, align 4, !tbaa !5
  call void @_Z8addGroupi(i32 noundef %153)
  %154 = load i32, ptr @currGroups, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr @currGroups, align 4, !tbaa !5
  br label %139, !llvm.loop !15

156:                                              ; preds = %150
  %157 = load i32, ptr %13, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %13, align 4, !tbaa !5
  br label %76, !llvm.loop !14

159:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %181, %159
  %161 = load i32, ptr %20, align 4, !tbaa !5
  %162 = load i32, ptr @n, align 4, !tbaa !5
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %184

165:                                              ; preds = %160
  %166 = load i32, ptr %20, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1005 x i32], ptr @ans, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %169)
  %171 = load i32, ptr %20, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [1005 x i32], ptr @squad, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = icmp eq i32 %174, 0
  br i1 %175, label %176, label %178

176:                                              ; preds = %165
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  br label %180

178:                                              ; preds = %165
  %179 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %180

180:                                              ; preds = %178, %176
  br label %181

181:                                              ; preds = %180
  %182 = load i32, ptr %20, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %20, align 4, !tbaa !5
  br label %160, !llvm.loop !16

184:                                              ; preds = %164
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  %185 = load i32, ptr %1, align 4
  ret i32 %185
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

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

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

declare i32 @printf(ptr noundef, ...) #5

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse 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 = { "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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.__gnu_cxx::__normal_iterator.0" = type { ptr }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@posle = external dso_local global [1005 x %"class.std::vector"], align 16
@groups = external dso_local global [1005 x %"class.std::vector"], align 16
@as = external dso_local global %"class.std::vector", align 8
@bs = external dso_local global %"class.std::vector", align 8
@ans = external dso_local local_unnamed_addr global [1005 x i32], align 16
@groupTime = external dso_local local_unnamed_addr global [1005 x i32], align 16
@pos = external dso_local global [1005 x i32], align 16
@squad = external dso_local local_unnamed_addr global [1005 x i32], align 16
@currGroups = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6recalcv() local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

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

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.0", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 -1, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @pos, ptr noundef nonnull getelementptr inbounds (i8, ptr @pos, i64 4020), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph32, label %.preheader29

.preheader29:                                     ; preds = %._crit_edge, %0
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph38, label %.preheader28.preheader

.preheader28.preheader:                           ; preds = %._crit_edge36, %.preheader29
  br label %.preheader28

.lr.ph32:                                         ; preds = %0, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %2)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph32
  %20 = getelementptr inbounds [1005 x %"class.std::vector"], ptr @posle, i64 0, i64 %indvars.iv
  br label %21

21:                                               ; preds = %.lr.ph, %21
  %22 = phi i32 [ %18, %.lr.ph ], [ %25, %21 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr %3, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %2)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %._crit_edge, label %21, !llvm.loop !9

._crit_edge:                                      ; preds = %21, %.lr.ph32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %.lr.ph32, label %.preheader29, !llvm.loop !11

.lr.ph38:                                         ; preds = %.preheader29, %._crit_edge36
  %indvars.iv46 = phi i64 [ %indvars.iv.next47, %._crit_edge36 ], [ 0, %.preheader29 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %indvars.iv46
  store i32 %31, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph35, label %._crit_edge36

.lr.ph35:                                         ; preds = %.lr.ph38
  %35 = getelementptr inbounds [1005 x %"class.std::vector"], ptr @groups, i64 0, i64 %indvars.iv46
  br label %39

._crit_edge36:                                    ; preds = %39, %.lr.ph38
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %36 = load i32, ptr @m, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next47, %37
  br i1 %38, label %.lr.ph38, label %.preheader28.preheader, !llvm.loop !12

39:                                               ; preds = %.lr.ph35, %39
  %.02333 = phi i32 [ 0, %.lr.ph35 ], [ %43, %39 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %7, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %43 = add nuw nsw i32 %.02333, 1
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %39, label %._crit_edge36, !llvm.loop !13

.preheader28:                                     ; preds = %.preheader28.backedge, %.preheader28.preheader
  %.022 = phi i32 [ 0, %.preheader28.preheader ], [ %.022.be, %.preheader28.backedge ]
  %46 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %47 = icmp eq i64 %46, 0
  br i1 %47, label %48, label %56

48:                                               ; preds = %.preheader28
  %49 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %48
  %52 = load i32, ptr @currGroups, align 4, !tbaa !5
  %53 = load i32, ptr @m, align 4, !tbaa !5
  %.not = icmp slt i32 %52, %53
  br i1 %.not, label %56, label %.preheader

.preheader:                                       ; preds = %51
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp sgt i32 %54, 0
  br i1 %55, label %.lr.ph43, label %._crit_edge44

56:                                               ; preds = %51, %48, %.preheader28
  %57 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %58 = icmp eq i64 %57, 0
  br i1 %58, label %59, label %69

59:                                               ; preds = %56
  %60 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %61 = icmp eq i64 %60, 0
  br i1 %61, label %62, label %69

62:                                               ; preds = %59
  %63 = load i32, ptr @currGroups, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %66, -1
  %68 = icmp slt i32 %.022, %67
  br i1 %68, label %.preheader28.backedge, label %69

69:                                               ; preds = %62, %59, %56
  %70 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  %.not26 = icmp eq i64 %70, 0
  br i1 %.not26, label %79, label %71

71:                                               ; preds = %69
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @as, i64 noundef 0) #6
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1005 x i32], ptr @ans, i64 0, i64 %74
  store i32 %.022, ptr %75, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %76 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @as) #6
  store ptr %76, ptr %9, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEC2IPivEERKNS0_IT_S5_EE(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %77 = load ptr, ptr %8, align 8
  %78 = call ptr @_ZNSt6vectorIiSaIiEE5eraseEN9__gnu_cxx17__normal_iteratorIPKiS1_EE(ptr noundef nonnull align 8 dereferenceable(24) @as, ptr %77)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %79

79:                                               ; preds = %71, %69
  %80 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  %.not27 = icmp eq i64 %80, 0
  br i1 %.not27, label %89, label %81

81:                                               ; preds = %79
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @bs, i64 noundef 0) #6
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1005 x i32], ptr @ans, i64 0, i64 %84
  store i32 %.022, ptr %85, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  %86 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @bs) #6
  store ptr %86, ptr %11, align 8
  call void @_ZN9__gnu_cxx17__normal_iteratorIPKiSt6vectorIiSaIiEEEC2IPivEERKNS0_IT_S5_EE(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %87 = load ptr, ptr %10, align 8
  %88 = call ptr @_ZNSt6vectorIiSaIiEE5eraseEN9__gnu_cxx17__normal_iteratorIPKiS1_EE(ptr noundef nonnull align 8 dereferenceable(24) @bs, ptr %87)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  br label %89

89:                                               ; preds = %81, %79
  call void @_Z6recalcv()
  %90 = load i32, ptr @currGroups, align 4, !tbaa !5
  %91 = load i32, ptr @m, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %.lr.ph40, label %.critedge

.lr.ph40:                                         ; preds = %89, %98
  %93 = phi i32 [ %100, %98 ], [ %90, %89 ]
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1005 x i32], ptr @groupTime, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp eq i32 %96, %.022
  br i1 %97, label %98, label %.critedge

98:                                               ; preds = %.lr.ph40
  call void @_Z8addGroupi(i32 noundef %93)
  %99 = load i32, ptr @currGroups, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr @currGroups, align 4, !tbaa !5
  %101 = load i32, ptr @m, align 4, !tbaa !5
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %.lr.ph40, label %.critedge, !llvm.loop !14

.critedge:                                        ; preds = %.lr.ph40, %98, %89
  %103 = add nuw nsw i32 %.022, 1
  br label %.preheader28.backedge

.preheader28.backedge:                            ; preds = %.critedge, %62
  %.022.be = phi i32 [ %103, %.critedge ], [ %67, %62 ]
  br label %.preheader28, !llvm.loop !15

._crit_edge44:                                    ; preds = %.lr.ph43, %.preheader
  ret i32 0

.lr.ph43:                                         ; preds = %.preheader, %.lr.ph43
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph43 ], [ 0, %.preheader ]
  %104 = getelementptr inbounds [1005 x i32], ptr @ans, i64 0, i64 %indvars.iv49
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %105)
  %107 = getelementptr inbounds [1005 x i32], ptr @squad, i64 0, i64 %indvars.iv49
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = icmp eq i32 %108, 0
  %.str.8..str.9 = select i1 %109, ptr @.str.8, ptr @.str.9
  %110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.8..str.9)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %111 = load i32, ptr @n, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next50, %112
  br i1 %113, label %.lr.ph43, label %._crit_edge44, !llvm.loop !16
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress norecurse 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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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