; LLVM IR from eyangch/competitive-programming :: Codeforces/1731/d.ll (Z5worksx)

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

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global [10000 x %"class.std::vector"], align 16
@B = external dso_local global [10000 x %"class.std::vector"], align 16
@S = external dso_local global [10000 x i64], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5worksx(i64 noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %41, %1
  %22 = load i64, ptr %4, align 8, !tbaa !5
  %23 = load i64, ptr @N, align 8, !tbaa !5
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %44

26:                                               ; preds = %21
  %27 = load i64, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @B, i64 0, i64 %27
  %29 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #4
  %30 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  store ptr %29, ptr %30, align 8
  %31 = load i64, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @B, i64 0, i64 %31
  %33 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #4
  %34 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  store ptr %33, ptr %34, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  %35 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %5, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8
  %37 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %6, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8
  call void @_ZSt4fillIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEiEvT_S7_RKT0_(ptr %36, ptr %38, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %39 = load i64, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %39
  store i64 0, ptr %40, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %26
  %42 = load i64, ptr %4, align 8, !tbaa !5
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr %4, align 8, !tbaa !5
  br label %21, !llvm.loop !11

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

45:                                               ; preds = %205, %44
  %46 = load i64, ptr %8, align 8, !tbaa !5
  %47 = load i64, ptr %3, align 8, !tbaa !5
  %48 = add nsw i64 %46, %47
  %49 = sub nsw i64 %48, 1
  %50 = load i64, ptr @M, align 8, !tbaa !5
  %51 = icmp slt i64 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %45
  store i32 5, ptr %9, align 4
  br label %208

53:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %54 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %54, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %55 = load i64, ptr %8, align 8, !tbaa !5
  %56 = load i64, ptr %3, align 8, !tbaa !5
  %57 = add nsw i64 %55, %56
  %58 = sub nsw i64 %57, 1
  store i64 %58, ptr %11, align 8, !tbaa !5
  %59 = load i64, ptr %8, align 8, !tbaa !5
  %60 = icmp eq i64 %59, 0
  br i1 %60, label %61, label %96

61:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %62 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %62, ptr %12, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %92, %61
  %64 = load i64, ptr %12, align 8, !tbaa !5
  %65 = load i64, ptr %11, align 8, !tbaa !5
  %66 = icmp sle i64 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %95

68:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %88, %68
  %70 = load i64, ptr %13, align 8, !tbaa !5
  %71 = load i64, ptr @N, align 8, !tbaa !5
  %72 = icmp slt i64 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %91

74:                                               ; preds = %69
  %75 = load i64, ptr %13, align 8, !tbaa !5
  %76 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @A, i64 0, i64 %75
  %77 = load i64, ptr %12, align 8, !tbaa !5
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %77) #4
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = load i64, ptr %3, align 8, !tbaa !5
  %81 = icmp slt i64 %79, %80
  br i1 %81, label %82, label %87

82:                                               ; preds = %74
  %83 = load i64, ptr %13, align 8, !tbaa !5
  %84 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr %84, align 8, !tbaa !5
  br label %87

87:                                               ; preds = %82, %74
  br label %88

88:                                               ; preds = %87
  %89 = load i64, ptr %13, align 8, !tbaa !5
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %13, align 8, !tbaa !5
  br label %69, !llvm.loop !13

91:                                               ; preds = %73
  br label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %12, align 8, !tbaa !5
  %94 = add nsw i64 %93, 1
  store i64 %94, ptr %12, align 8, !tbaa !5
  br label %63, !llvm.loop !14

95:                                               ; preds = %67
  br label %120

96:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store i64 0, ptr %14, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %116, %96
  %98 = load i64, ptr %14, align 8, !tbaa !5
  %99 = load i64, ptr @N, align 8, !tbaa !5
  %100 = icmp slt i64 %98, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %119

102:                                              ; preds = %97
  %103 = load i64, ptr %14, align 8, !tbaa !5
  %104 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @A, i64 0, i64 %103
  %105 = load i64, ptr %11, align 8, !tbaa !5
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %104, i64 noundef %105) #4
  %107 = load i64, ptr %106, align 8, !tbaa !5
  %108 = load i64, ptr %3, align 8, !tbaa !5
  %109 = icmp slt i64 %107, %108
  br i1 %109, label %110, label %115

110:                                              ; preds = %102
  %111 = load i64, ptr %14, align 8, !tbaa !5
  %112 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = add nsw i64 %113, 1
  store i64 %114, ptr %112, align 8, !tbaa !5
  br label %115

115:                                              ; preds = %110, %102
  br label %116

116:                                              ; preds = %115
  %117 = load i64, ptr %14, align 8, !tbaa !5
  %118 = add nsw i64 %117, 1
  store i64 %118, ptr %14, align 8, !tbaa !5
  br label %97, !llvm.loop !15

119:                                              ; preds = %101
  br label %120

120:                                              ; preds = %119, %95
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i64 0, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store i64 0, ptr %16, align 8, !tbaa !5
  br label %121

121:                                              ; preds = %173, %120
  %122 = load i64, ptr %16, align 8, !tbaa !5
  %123 = load i64, ptr %3, align 8, !tbaa !5
  %124 = add nsw i64 %122, %123
  %125 = sub nsw i64 %124, 1
  %126 = load i64, ptr @N, align 8, !tbaa !5
  %127 = icmp slt i64 %125, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %121
  store i32 17, ptr %9, align 4
  br label %176

129:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %130 = load i64, ptr %16, align 8, !tbaa !5
  store i64 %130, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %131 = load i64, ptr %16, align 8, !tbaa !5
  %132 = load i64, ptr %3, align 8, !tbaa !5
  %133 = add nsw i64 %131, %132
  %134 = sub nsw i64 %133, 1
  store i64 %134, ptr %18, align 8, !tbaa !5
  %135 = load i64, ptr %16, align 8, !tbaa !5
  %136 = icmp eq i64 %135, 0
  br i1 %136, label %137, label %154

137:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %138 = load i64, ptr %17, align 8, !tbaa !5
  store i64 %138, ptr %19, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %150, %137
  %140 = load i64, ptr %19, align 8, !tbaa !5
  %141 = load i64, ptr %18, align 8, !tbaa !5
  %142 = icmp sle i64 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  store i32 20, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %153

144:                                              ; preds = %139
  %145 = load i64, ptr %19, align 8, !tbaa !5
  %146 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !5
  %148 = load i64, ptr %15, align 8, !tbaa !5
  %149 = add nsw i64 %148, %147
  store i64 %149, ptr %15, align 8, !tbaa !5
  br label %150

150:                                              ; preds = %144
  %151 = load i64, ptr %19, align 8, !tbaa !5
  %152 = add nsw i64 %151, 1
  store i64 %152, ptr %19, align 8, !tbaa !5
  br label %139, !llvm.loop !16

153:                                              ; preds = %143
  br label %160

154:                                              ; preds = %129
  %155 = load i64, ptr %18, align 8, !tbaa !5
  %156 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %155
  %157 = load i64, ptr %156, align 8, !tbaa !5
  %158 = load i64, ptr %15, align 8, !tbaa !5
  %159 = add nsw i64 %158, %157
  store i64 %159, ptr %15, align 8, !tbaa !5
  br label %160

160:                                              ; preds = %154, %153
  %161 = load i64, ptr %15, align 8, !tbaa !5
  %162 = icmp eq i64 %161, 0
  br i1 %162, label %163, label %164

163:                                              ; preds = %160
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %170

164:                                              ; preds = %160
  %165 = load i64, ptr %17, align 8, !tbaa !5
  %166 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %165
  %167 = load i64, ptr %166, align 8, !tbaa !5
  %168 = load i64, ptr %15, align 8, !tbaa !5
  %169 = sub nsw i64 %168, %167
  store i64 %169, ptr %15, align 8, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %170

170:                                              ; preds = %164, %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  %171 = load i32, ptr %9, align 4
  switch i32 %171, label %176 [
    i32 0, label %172
  ]

172:                                              ; preds = %170
  br label %173

173:                                              ; preds = %172
  %174 = load i64, ptr %16, align 8, !tbaa !5
  %175 = add nsw i64 %174, 1
  store i64 %175, ptr %16, align 8, !tbaa !5
  br label %121, !llvm.loop !17

176:                                              ; preds = %170, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %177 = load i32, ptr %9, align 4
  switch i32 %177, label %202 [
    i32 17, label %178
  ]

178:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  store i64 0, ptr %20, align 8, !tbaa !5
  br label %179

179:                                              ; preds = %198, %178
  %180 = load i64, ptr %20, align 8, !tbaa !5
  %181 = load i64, ptr @N, align 8, !tbaa !5
  %182 = icmp slt i64 %180, %181
  br i1 %182, label %184, label %183

183:                                              ; preds = %179
  store i32 23, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  br label %201

184:                                              ; preds = %179
  %185 = load i64, ptr %20, align 8, !tbaa !5
  %186 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @A, i64 0, i64 %185
  %187 = load i64, ptr %10, align 8, !tbaa !5
  %188 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %186, i64 noundef %187) #4
  %189 = load i64, ptr %188, align 8, !tbaa !5
  %190 = load i64, ptr %3, align 8, !tbaa !5
  %191 = icmp slt i64 %189, %190
  br i1 %191, label %192, label %197

192:                                              ; preds = %184
  %193 = load i64, ptr %20, align 8, !tbaa !5
  %194 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %193
  %195 = load i64, ptr %194, align 8, !tbaa !5
  %196 = add nsw i64 %195, -1
  store i64 %196, ptr %194, align 8, !tbaa !5
  br label %197

197:                                              ; preds = %192, %184
  br label %198

198:                                              ; preds = %197
  %199 = load i64, ptr %20, align 8, !tbaa !5
  %200 = add nsw i64 %199, 1
  store i64 %200, ptr %20, align 8, !tbaa !5
  br label %179, !llvm.loop !18

201:                                              ; preds = %183
  store i32 0, ptr %9, align 4
  br label %202

202:                                              ; preds = %201, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %203 = load i32, ptr %9, align 4
  switch i32 %203, label %208 [
    i32 0, label %204
  ]

204:                                              ; preds = %202
  br label %205

205:                                              ; preds = %204
  %206 = load i64, ptr %8, align 8, !tbaa !5
  %207 = add nsw i64 %206, 1
  store i64 %207, ptr %8, align 8, !tbaa !5
  br label %45, !llvm.loop !19

208:                                              ; preds = %202, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %209 = load i32, ptr %9, align 4
  switch i32 %209, label %213 [
    i32 5, label %210
    i32 1, label %211
  ]

210:                                              ; preds = %208
  store i1 false, ptr %2, align 1
  br label %211

211:                                              ; preds = %210, %208
  %212 = load i1, ptr %2, align 1
  ret i1 %212

213:                                              ; preds = %208
  unreachable
}

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

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

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

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

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@N = external dso_local local_unnamed_addr global i64, align 8
@M = external dso_local local_unnamed_addr global i64, align 8
@A = external dso_local global [10000 x %"class.std::vector"], align 16
@B = external dso_local global [10000 x %"class.std::vector"], align 16
@S = external dso_local local_unnamed_addr global [10000 x i64], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5worksx(i64 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = load i64, ptr @N, align 8, !tbaa !5
  %4 = icmp sgt i64 %3, 0
  br i1 %4, label %.lr.ph, label %.preheader90

.preheader90:                                     ; preds = %.lr.ph, %1
  %5 = phi i64 [ %3, %1 ], [ %12, %.lr.ph ]
  %6 = load i64, ptr @M, align 8, !tbaa !5
  %.not109.not = icmp slt i64 %6, %0
  br i1 %.not109.not, label %.thread._crit_edge, label %.lr.ph112

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.06191 = phi i64 [ %11, %.lr.ph ], [ 0, %1 ]
  %7 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @B, i64 0, i64 %.06191
  %8 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  %9 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !9
  call void @_ZSt4fillIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEiEvT_S7_RKT0_(ptr %8, ptr %9, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %10 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %.06191
  store i64 0, ptr %10, align 8, !tbaa !5
  %11 = add nuw nsw i64 %.06191, 1
  %12 = load i64, ptr @N, align 8, !tbaa !5
  %13 = icmp slt i64 %11, %12
  br i1 %13, label %.lr.ph, label %.preheader90, !llvm.loop !11

.lr.ph112:                                        ; preds = %.preheader90, %.critedge._crit_edge
  %14 = phi i64 [ %88, %.critedge._crit_edge ], [ %5, %.preheader90 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.critedge._crit_edge ], [ %0, %.preheader90 ]
  %.070110 = phi i64 [ %89, %.critedge._crit_edge ], [ 0, %.preheader90 ]
  %15 = add nsw i64 %.070110, %0
  %16 = add nsw i64 %15, -1
  %17 = icmp eq i64 %.070110, 0
  br i1 %17, label %.preheader86, label %.preheader88

.preheader88:                                     ; preds = %.lr.ph112
  %18 = icmp sgt i64 %14, 0
  br i1 %18, label %.lr.ph93, label %.loopexit87

.preheader86:                                     ; preds = %.lr.ph112
  %.not77.not96 = icmp sgt i64 %15, 0
  %19 = icmp sgt i64 %14, 0
  %or.cond = select i1 %.not77.not96, i1 %19, i1 false
  br i1 %or.cond, label %.preheader85, label %.loopexit87

.preheader85:                                     ; preds = %.preheader86, %._crit_edge
  %20 = phi i64 [ %23, %._crit_edge ], [ %14, %.preheader86 ]
  %21 = phi i64 [ %24, %._crit_edge ], [ %14, %.preheader86 ]
  %.06997 = phi i64 [ %25, %._crit_edge ], [ 0, %.preheader86 ]
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %.lr.ph95, label %._crit_edge

._crit_edge:                                      ; preds = %34, %.preheader85
  %23 = phi i64 [ %20, %.preheader85 ], [ %36, %34 ]
  %24 = phi i64 [ %21, %.preheader85 ], [ %36, %34 ]
  %25 = add nuw nsw i64 %.06997, 1
  %exitcond.not = icmp eq i64 %25, %indvars.iv
  br i1 %exitcond.not, label %.loopexit87, label %.preheader85, !llvm.loop !13

.lr.ph95:                                         ; preds = %.preheader85, %34
  %.06894 = phi i64 [ %35, %34 ], [ 0, %.preheader85 ]
  %26 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @A, i64 0, i64 %.06894
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %.06997) #5
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = icmp slt i64 %28, %0
  br i1 %29, label %30, label %34

30:                                               ; preds = %.lr.ph95
  %31 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %.06894
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr %31, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %.lr.ph95, %30
  %35 = add nuw nsw i64 %.06894, 1
  %36 = load i64, ptr @N, align 8, !tbaa !5
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph95, label %._crit_edge, !llvm.loop !15

.lr.ph93:                                         ; preds = %.preheader88, %46
  %.06792 = phi i64 [ %47, %46 ], [ 0, %.preheader88 ]
  %38 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @A, i64 0, i64 %.06792
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %16) #5
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = icmp slt i64 %40, %0
  br i1 %41, label %42, label %46

42:                                               ; preds = %.lr.ph93
  %43 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %.06792
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = add nsw i64 %44, 1
  store i64 %45, ptr %43, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %.lr.ph93, %42
  %47 = add nuw nsw i64 %.06792, 1
  %48 = load i64, ptr @N, align 8, !tbaa !5
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %.lr.ph93, label %.loopexit87, !llvm.loop !16

.loopexit87:                                      ; preds = %46, %._crit_edge, %.preheader88, %.preheader86
  %50 = phi i64 [ %14, %.preheader88 ], [ %14, %.preheader86 ], [ %23, %._crit_edge ], [ %48, %46 ]
  %51 = phi i64 [ %14, %.preheader88 ], [ %14, %.preheader86 ], [ %24, %._crit_edge ], [ %48, %46 ]
  %.not78102 = icmp slt i64 %51, %0
  br i1 %.not78102, label %.critedge.preheader, label %.lr.ph106

.lr.ph106:                                        ; preds = %.loopexit87, %70
  %indvars.iv121 = phi i64 [ %indvars.iv.next122, %70 ], [ %0, %.loopexit87 ]
  %.062104 = phi i64 [ %74, %70 ], [ 0, %.loopexit87 ]
  %.063103 = phi i64 [ %73, %70 ], [ 0, %.loopexit87 ]
  %52 = add nsw i64 %.062104, %0
  %53 = icmp eq i64 %.062104, 0
  br i1 %53, label %.preheader, label %65

.preheader:                                       ; preds = %.lr.ph106
  %.not79.not98 = icmp sgt i64 %52, 0
  br i1 %.not79.not98, label %.lr.ph101.preheader, label %.loopexit

.lr.ph101.preheader:                              ; preds = %.preheader
  %min.iters.check = icmp ult i64 %indvars.iv121, 4
  br i1 %min.iters.check, label %.lr.ph101.preheader142, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph101.preheader
  %n.vec = and i64 %indvars.iv121, -4
  %54 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.063103, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %54, %vector.ph ], [ %57, %vector.body ]
  %vec.phi140 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %58, %vector.body ]
  %55 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %index
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  %wide.load = load <2 x i64>, ptr %55, align 16, !tbaa !5
  %wide.load141 = load <2 x i64>, ptr %56, align 16, !tbaa !5
  %57 = add <2 x i64> %wide.load, %vec.phi
  %58 = add <2 x i64> %wide.load141, %vec.phi140
  %index.next = add nuw i64 %index, 4
  %59 = icmp eq i64 %index.next, %n.vec
  br i1 %59, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %58, %57
  %60 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %indvars.iv121, %n.vec
  br i1 %cmp.n, label %.loopexit, label %.lr.ph101.preheader142

.lr.ph101.preheader142:                           ; preds = %middle.block, %.lr.ph101.preheader
  %.059100.ph = phi i64 [ 0, %.lr.ph101.preheader ], [ %n.vec, %middle.block ]
  %.16499.ph = phi i64 [ %.063103, %.lr.ph101.preheader ], [ %60, %middle.block ]
  br label %.lr.ph101

.lr.ph101:                                        ; preds = %.lr.ph101.preheader142, %.lr.ph101
  %.059100 = phi i64 [ %64, %.lr.ph101 ], [ %.059100.ph, %.lr.ph101.preheader142 ]
  %.16499 = phi i64 [ %63, %.lr.ph101 ], [ %.16499.ph, %.lr.ph101.preheader142 ]
  %61 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %.059100
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = add nsw i64 %62, %.16499
  %64 = add nuw nsw i64 %.059100, 1
  %exitcond123.not = icmp eq i64 %64, %indvars.iv121
  br i1 %exitcond123.not, label %.loopexit, label %.lr.ph101, !llvm.loop !20

65:                                               ; preds = %.lr.ph106
  %66 = add nsw i64 %52, -1
  %67 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %69 = add nsw i64 %68, %.063103
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph101, %middle.block, %.preheader, %65
  %.265 = phi i64 [ %69, %65 ], [ %.063103, %.preheader ], [ %60, %middle.block ], [ %63, %.lr.ph101 ]
  %.not80 = icmp eq i64 %.265, 0
  br i1 %.not80, label %.thread._crit_edge, label %70

70:                                               ; preds = %.loopexit
  %71 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %.062104
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %73 = sub nsw i64 %.265, %72
  %74 = add nuw nsw i64 %.062104, 1
  %75 = add nsw i64 %74, %0
  %.not78 = icmp sgt i64 %75, %51
  %indvars.iv.next122 = add i64 %indvars.iv121, 1
  br i1 %.not78, label %.critedge.preheader, label %.lr.ph106, !llvm.loop !21

.critedge.preheader:                              ; preds = %70, %.loopexit87
  %76 = icmp sgt i64 %50, 0
  br i1 %76, label %.lr.ph108, label %.critedge._crit_edge

.lr.ph108:                                        ; preds = %.critedge.preheader, %.critedge
  %.0107 = phi i64 [ %85, %.critedge ], [ 0, %.critedge.preheader ]
  %77 = getelementptr inbounds [10000 x %"class.std::vector"], ptr @A, i64 0, i64 %.0107
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %77, i64 noundef %.070110) #5
  %79 = load i64, ptr %78, align 8, !tbaa !5
  %80 = icmp slt i64 %79, %0
  br i1 %80, label %81, label %.critedge

81:                                               ; preds = %.lr.ph108
  %82 = getelementptr inbounds [10000 x i64], ptr @S, i64 0, i64 %.0107
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = add nsw i64 %83, -1
  store i64 %84, ptr %82, align 8, !tbaa !5
  br label %.critedge

.critedge:                                        ; preds = %.lr.ph108, %81
  %85 = add nuw nsw i64 %.0107, 1
  %86 = load i64, ptr @N, align 8, !tbaa !5
  %87 = icmp slt i64 %85, %86
  br i1 %87, label %.lr.ph108, label %.critedge._crit_edge, !llvm.loop !22

.critedge._crit_edge:                             ; preds = %.critedge, %.critedge.preheader
  %88 = phi i64 [ %50, %.critedge.preheader ], [ %86, %.critedge ]
  %89 = add nuw nsw i64 %.070110, 1
  %90 = add nsw i64 %89, %0
  %91 = load i64, ptr @M, align 8, !tbaa !5
  %.not.not = icmp sgt i64 %90, %91
  %indvars.iv.next = add i64 %indvars.iv, 1
  br i1 %.not.not, label %.thread._crit_edge, label %.lr.ph112, !llvm.loop !23

.thread._crit_edge:                               ; preds = %.critedge._crit_edge, %.loopexit, %.preheader90
  %.not.lcssa = phi i1 [ false, %.preheader90 ], [ true, %.loopexit ], [ false, %.critedge._crit_edge ]
  ret i1 %.not.lcssa
}

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

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

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

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

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !18, !19}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = distinct !{!20, !12, !19, !18}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass