; LLVM IR from tangjz/acm-icpc :: hdu (6746)

; 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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@dis = external dso_local global [509 x [509 x i32]], align 16
@que = external dso_local global %"class.std::queue", align 8
@_ZZ4mainE3low = external hidden global [9 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE1a = external hidden global [509 x [509 x i32]], align 16
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 %"struct.std::pair", align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca [5 x i32], align 16
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %35, %0
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp slt i32 %24, 9
  br i1 %25, label %27, label %26

26:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %38

27:                                               ; preds = %23
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = mul nsw i32 %28, %29
  %31 = shl i32 %30, 3
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [9 x i32], ptr @_ZZ4mainE3low, i64 0, i64 %33
  store i32 %31, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %27
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !9

38:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  br label %40

40:                                               ; preds = %252, %38
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %3, align 4, !tbaa !5
  %43 = icmp ne i32 %41, 0
  br i1 %43, label %44, label %255

44:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %70, %44
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %66, %51
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %52
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59
  %61 = getelementptr inbounds [509 x i32], ptr %60, i64 0, i64 0
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i32, ptr %61, i64 %63
  %65 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %64)
  br label %66

66:                                               ; preds = %57
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %8, align 4, !tbaa !5
  br label %52, !llvm.loop !11

69:                                               ; preds = %56
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %6, align 4, !tbaa !5
  br label %46, !llvm.loop !12

73:                                               ; preds = %50
  br label %74

74:                                               ; preds = %77, %73
  %75 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  %76 = xor i1 %75, true
  br i1 %76, label %77, label %78

77:                                               ; preds = %74
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  br label %74, !llvm.loop !13

78:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %93, %78
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = icmp sle i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 15, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %96

84:                                               ; preds = %79
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %86
  %88 = getelementptr inbounds [509 x i32], ptr %87, i64 0, i64 0
  %89 = getelementptr inbounds i32, ptr %88, i64 1
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = mul i64 %91, 4
  call void @llvm.memset.p0.i64(ptr align 4 %89, i8 -1, i64 %92, i1 false)
  br label %93

93:                                               ; preds = %84
  %94 = load i32, ptr %9, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !5
  br label %79, !llvm.loop !14

96:                                               ; preds = %83
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z6appendiii(i32 noundef %97, i32 noundef %98, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 2147483647, ptr %10, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %249, %96
  %100 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  %101 = xor i1 %100, true
  br i1 %101, label %102, label %252

102:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %103 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %103, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %104 = getelementptr inbounds %"struct.std::pair", ptr %11, i32 0, i32 0
  %105 = load i32, ptr %104, align 4, !tbaa !15
  store i32 %105, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  %106 = getelementptr inbounds %"struct.std::pair", ptr %11, i32 0, i32 1
  %107 = load i32, ptr %106, align 4, !tbaa !17
  store i32 %107, ptr %13, align 4, !tbaa !5
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %108 = load i32, ptr %12, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %109
  %111 = load i32, ptr %13, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [509 x i32], ptr %110, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  store i32 %114, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr %15) #9
  call void @llvm.memset.p0.i64(ptr align 16 %15, i8 0, i64 20, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 -3, ptr %16, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %176, %102
  %116 = load i32, ptr %16, align 4, !tbaa !5
  %117 = icmp sle i32 %116, 3
  br i1 %117, label %119, label %118

118:                                              ; preds = %115
  store i32 20, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %179

119:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 -3, ptr %17, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %172, %119
  %121 = load i32, ptr %17, align 4, !tbaa !5
  %122 = icmp sle i32 %121, 3
  br i1 %122, label %124, label %123

123:                                              ; preds = %120
  store i32 23, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %175

124:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #9
  %125 = load i32, ptr %16, align 4, !tbaa !5
  %126 = call i32 @llvm.abs.i32(i32 %125, i1 true)
  %127 = load i32, ptr %17, align 4, !tbaa !5
  %128 = call i32 @llvm.abs.i32(i32 %127, i1 true)
  %129 = add nsw i32 %126, %128
  store i32 %129, ptr %18, align 4, !tbaa !5
  %130 = load i32, ptr %18, align 4, !tbaa !5
  %131 = icmp sgt i32 %130, 3
  br i1 %131, label %140, label %132

132:                                              ; preds = %124
  %133 = load i32, ptr %12, align 4, !tbaa !5
  %134 = load i32, ptr %16, align 4, !tbaa !5
  %135 = add nsw i32 %133, %134
  %136 = load i32, ptr %13, align 4, !tbaa !5
  %137 = load i32, ptr %17, align 4, !tbaa !5
  %138 = add nsw i32 %136, %137
  %139 = call noundef zeroext i1 @_Z5checkii(i32 noundef %135, i32 noundef %138)
  br i1 %139, label %141, label %140

140:                                              ; preds = %132, %124
  store i32 25, ptr %7, align 4
  br label %169

141:                                              ; preds = %132
  %142 = load i32, ptr %12, align 4, !tbaa !5
  %143 = load i32, ptr %16, align 4, !tbaa !5
  %144 = add nsw i32 %142, %143
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %145
  %147 = load i32, ptr %13, align 4, !tbaa !5
  %148 = load i32, ptr %17, align 4, !tbaa !5
  %149 = add nsw i32 %147, %148
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [509 x i32], ptr %146, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [5 x i32], ptr %15, i64 0, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %154, align 4, !tbaa !5
  %157 = load i32, ptr %18, align 4, !tbaa !5
  %158 = icmp sle i32 %157, 2
  br i1 %158, label %159, label %168

159:                                              ; preds = %141
  %160 = load i32, ptr %12, align 4, !tbaa !5
  %161 = load i32, ptr %16, align 4, !tbaa !5
  %162 = add nsw i32 %160, %161
  %163 = load i32, ptr %13, align 4, !tbaa !5
  %164 = load i32, ptr %17, align 4, !tbaa !5
  %165 = add nsw i32 %163, %164
  %166 = load i32, ptr %14, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  call void @_Z6appendiii(i32 noundef %162, i32 noundef %165, i32 noundef %167)
  br label %168

168:                                              ; preds = %159, %141
  store i32 0, ptr %7, align 4
  br label %169

169:                                              ; preds = %168, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #9
  %170 = load i32, ptr %7, align 4
  switch i32 %170, label %257 [
    i32 0, label %171
    i32 25, label %172
  ]

171:                                              ; preds = %169
  br label %172

172:                                              ; preds = %171, %169
  %173 = load i32, ptr %17, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %17, align 4, !tbaa !5
  br label %120, !llvm.loop !18

175:                                              ; preds = %123
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr %16, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %16, align 4, !tbaa !5
  br label %115, !llvm.loop !19

179:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #9
  %180 = load i32, ptr %12, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %181
  %183 = load i32, ptr %13, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [509 x i32], ptr %182, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !5
  store i32 %186, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 0, ptr %20, align 4, !tbaa !5
  %187 = load i32, ptr %19, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [5 x i32], ptr %15, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = add nsw i32 %190, -1
  store i32 %191, ptr %189, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 1, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 3, ptr %22, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %246, %179
  %193 = load i32, ptr %21, align 4, !tbaa !5
  %194 = icmp slt i32 %193, 9
  br i1 %194, label %196, label %195

195:                                              ; preds = %192
  store i32 26, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %249

196:                                              ; preds = %192
  %197 = load i32, ptr %19, align 4, !tbaa !5
  %198 = load i32, ptr %20, align 4, !tbaa !5
  %199 = add nsw i32 %198, %197
  store i32 %199, ptr %20, align 4, !tbaa !5
  br label %200

200:                                              ; preds = %242, %196
  %201 = load i32, ptr %21, align 4, !tbaa !5
  %202 = icmp slt i32 %201, 9
  br i1 %202, label %203, label %210

203:                                              ; preds = %200
  %204 = load i32, ptr %20, align 4, !tbaa !5
  %205 = load i32, ptr %21, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [9 x i32], ptr @_ZZ4mainE3low, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !5
  %209 = icmp sge i32 %204, %208
  br label %210

210:                                              ; preds = %203, %200
  %211 = phi i1 [ false, %200 ], [ %209, %203 ]
  br i1 %211, label %212, label %245

212:                                              ; preds = %210
  br label %213

213:                                              ; preds = %226, %212
  %214 = load i32, ptr %22, align 4, !tbaa !5
  %215 = icmp sgt i32 %214, 0
  br i1 %215, label %216, label %223

216:                                              ; preds = %213
  %217 = load i32, ptr %22, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [5 x i32], ptr %15, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = icmp ne i32 %220, 0
  %222 = xor i1 %221, true
  br label %223

223:                                              ; preds = %216, %213
  %224 = phi i1 [ false, %213 ], [ %222, %216 ]
  br i1 %224, label %225, label %229

225:                                              ; preds = %223
  br label %226

226:                                              ; preds = %225
  %227 = load i32, ptr %22, align 4, !tbaa !5
  %228 = add nsw i32 %227, -1
  store i32 %228, ptr %22, align 4, !tbaa !5
  br label %213, !llvm.loop !20

229:                                              ; preds = %223
  %230 = load i32, ptr %22, align 4, !tbaa !5
  %231 = icmp sgt i32 %230, 0
  br i1 %231, label %232, label %241

232:                                              ; preds = %229
  %233 = load i32, ptr %22, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [5 x i32], ptr %15, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = add nsw i32 %236, -1
  store i32 %237, ptr %235, align 4, !tbaa !5
  %238 = load i32, ptr %22, align 4, !tbaa !5
  %239 = load i32, ptr %19, align 4, !tbaa !5
  %240 = add nsw i32 %239, %238
  store i32 %240, ptr %19, align 4, !tbaa !5
  br label %241

241:                                              ; preds = %232, %229
  br label %242

242:                                              ; preds = %241
  %243 = load i32, ptr %21, align 4, !tbaa !5
  %244 = add nsw i32 %243, 1
  store i32 %244, ptr %21, align 4, !tbaa !5
  br label %200, !llvm.loop !21

245:                                              ; preds = %210
  br label %246

246:                                              ; preds = %245
  %247 = load i32, ptr %14, align 4, !tbaa !5
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %14, align 4, !tbaa !5
  br label %192, !llvm.loop !22

249:                                              ; preds = %195
  %250 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %251 = load i32, ptr %250, align 4, !tbaa !5
  store i32 %251, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr %15) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %99, !llvm.loop !23

252:                                              ; preds = %99
  %253 = load i32, ptr %10, align 4, !tbaa !5
  %254 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %253)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  br label %40, !llvm.loop !24

255:                                              ; preds = %40
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  %256 = load i32, ptr %1, align 4
  ret i32 %256

257:                                              ; preds = %169
  unreachable
}

; 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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6appendiii(i32 noundef, i32 noundef, i32 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #3 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkii(i32 noundef, i32 noundef) #8

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 #9 = { 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 = !{!16, !6, i64 0}
!16 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!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::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@dis = external dso_local local_unnamed_addr global [509 x [509 x i32]], align 16
@que = external dso_local global %"class.std::queue", align 8
@_ZZ4mainE3low = external hidden local_unnamed_addr global [9 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE1a = external hidden global [509 x [509 x i32]], align 16
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %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 [5 x i32], align 16
  store <4 x i32> <i32 8, i32 32, i32 72, i32 128>, ptr getelementptr inbounds (i8, ptr @_ZZ4mainE3low, i64 4), align 4, !tbaa !5
  store <4 x i32> <i32 200, i32 288, i32 392, i32 512>, ptr getelementptr inbounds (i8, ptr @_ZZ4mainE3low, i64 20), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr %1, align 4, !tbaa !5
  %.not110 = icmp eq i32 %8, 0
  br i1 %.not110, label %._crit_edge113, label %.lr.ph112

.lr.ph112:                                        ; preds = %0, %._crit_edge109
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %.not7087 = icmp slt i32 %11, 1
  br i1 %.not7087, label %.preheader80, label %.preheader78

.preheader80:                                     ; preds = %._crit_edge, %.lr.ph112
  %12 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  br i1 %12, label %.preheader79, label %.lr.ph89

.preheader78:                                     ; preds = %.lr.ph112, %._crit_edge
  %13 = phi i32 [ %15, %._crit_edge ], [ %11, %.lr.ph112 ]
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %._crit_edge ], [ 1, %.lr.ph112 ]
  %.not7585 = icmp slt i32 %13, 1
  br i1 %.not7585, label %.preheader78.._crit_edge_crit_edge, label %.lr.ph

.preheader78.._crit_edge_crit_edge:               ; preds = %.preheader78
  %.pre = sext i32 %13 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.preheader78
  %14 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %indvars.iv123
  br label %16

._crit_edge:                                      ; preds = %16, %.preheader78.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader78.._crit_edge_crit_edge ], [ %20, %16 ]
  %15 = phi i32 [ %13, %.preheader78.._crit_edge_crit_edge ], [ %19, %16 ]
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %.not70.not = icmp slt i64 %indvars.iv123, %.pre-phi
  br i1 %.not70.not, label %.preheader78, label %.preheader80, !llvm.loop !9

16:                                               ; preds = %.lr.ph, %16
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %16 ]
  %17 = getelementptr inbounds i32, ptr %14, i64 %indvars.iv
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %.not75.not = icmp slt i64 %indvars.iv, %20
  br i1 %.not75.not, label %16, label %._crit_edge, !llvm.loop !12

.preheader79:                                     ; preds = %.lr.ph89, %.preheader80
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %.not7190 = icmp slt i32 %21, 1
  br i1 %.not7190, label %._crit_edge93, label %.lr.ph92

.lr.ph92:                                         ; preds = %.preheader79
  %22 = zext nneg i32 %21 to i64
  %23 = shl nuw nsw i64 %22, 2
  %24 = zext nneg i32 %21 to i64
  %xtraiter = and i64 %24, 7
  %25 = icmp ult i32 %21, 8
  br i1 %25, label %._crit_edge93.loopexit.unr-lcssa, label %.lr.ph92.new

.lr.ph92.new:                                     ; preds = %.lr.ph92
  %unroll_iter = and i64 %24, 2147483640
  br label %31

.lr.ph89:                                         ; preds = %.preheader80, %.lr.ph89
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  %26 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  br i1 %26, label %.preheader79, label %.lr.ph89, !llvm.loop !13

._crit_edge93.loopexit.unr-lcssa:                 ; preds = %31, %.lr.ph92
  %indvars.iv126.unr = phi i64 [ 1, %.lr.ph92 ], [ %indvars.iv.next127.7, %31 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge93, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge93.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv126.epil = phi i64 [ %indvars.iv.next127.epil, %.epil.preheader ], [ %indvars.iv126.unr, %._crit_edge93.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge93.loopexit.unr-lcssa ]
  %27 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv126.epil, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %27, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.epil = add nuw nsw i64 %indvars.iv126.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge93, label %.epil.preheader, !llvm.loop !14

._crit_edge93:                                    ; preds = %._crit_edge93.loopexit.unr-lcssa, %.epil.preheader, %.preheader79
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z6appendiii(i32 noundef %28, i32 noundef %29, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 2147483647, ptr %4, align 4, !tbaa !5
  %30 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  br i1 %30, label %._crit_edge109, label %.lr.ph108

31:                                               ; preds = %31, %.lr.ph92.new
  %indvars.iv126 = phi i64 [ 1, %.lr.ph92.new ], [ %indvars.iv.next127.7, %31 ]
  %niter = phi i64 [ 0, %.lr.ph92.new ], [ %niter.next.7, %31 ]
  %32 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv126, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %32, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %33 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %33, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.1 = add nuw nsw i64 %indvars.iv126, 2
  %34 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127.1, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %34, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.2 = add nuw nsw i64 %indvars.iv126, 3
  %35 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127.2, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %35, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.3 = add nuw nsw i64 %indvars.iv126, 4
  %36 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127.3, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %36, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.4 = add nuw nsw i64 %indvars.iv126, 5
  %37 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127.4, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %37, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.5 = add nuw nsw i64 %indvars.iv126, 6
  %38 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127.5, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %38, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.6 = add nuw nsw i64 %indvars.iv126, 7
  %39 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %indvars.iv.next127.6, i64 1
  call void @llvm.memset.p0.i64(ptr nonnull align 4 %39, i8 -1, i64 %23, i1 false)
  %indvars.iv.next127.7 = add nuw nsw i64 %indvars.iv126, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge93.loopexit.unr-lcssa, label %31, !llvm.loop !16

.lr.ph108:                                        ; preds = %._crit_edge93, %162
  %40 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  %.sroa.0.0.copyload = load i32, ptr %40, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %40, i64 4
  %.sroa.4.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 4
  call void @_ZNSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %41 = sext i32 %.sroa.0.0.copyload to i64
  %42 = sext i32 %.sroa.4.0.copyload to i64
  %43 = getelementptr inbounds [509 x [509 x i32]], ptr @dis, i64 0, i64 %41, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  store i32 %44, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %6) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %6, i8 0, i64 20, i1 false)
  %45 = add nsw i64 %42, -3
  %46 = trunc nsw i64 %45 to i32
  %47 = add nsw i64 %42, -2
  %48 = trunc nsw i64 %47 to i32
  %49 = add nsw i64 %42, -1
  %50 = trunc nsw i64 %49 to i32
  %51 = add nsw i64 %42, 1
  %52 = trunc nsw i64 %51 to i32
  %53 = add nsw i64 %42, 2
  %54 = trunc nsw i64 %53 to i32
  %55 = add nsw i64 %42, 3
  %56 = trunc nsw i64 %55 to i32
  br label %.preheader77

.preheader77:                                     ; preds = %.lr.ph108, %161
  %indvars.iv133 = phi i64 [ -3, %.lr.ph108 ], [ %indvars.iv.next134, %161 ]
  %57 = trunc nsw i64 %indvars.iv133 to i32
  %58 = call i32 @llvm.abs.i32(i32 %57, i1 true)
  %59 = add nsw i64 %indvars.iv133, %41
  %.not140 = icmp eq i64 %indvars.iv133, 0
  br i1 %.not140, label %67, label %76

60:                                               ; preds = %161
  %61 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %41, i64 %42
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %64, align 4, !tbaa !5
  %.promoted = load i32, ptr %5, align 4, !tbaa !5
  br label %166

67:                                               ; preds = %.preheader77
  %68 = call noundef zeroext i1 @_Z5checkii(i32 noundef %.sroa.0.0.copyload, i32 noundef %46)
  br i1 %68, label %69, label %76

69:                                               ; preds = %67
  %70 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %45
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %73, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %69, %.preheader77, %67
  %77 = add nuw nsw i32 %58, 2
  %78 = icmp ugt i32 %58, 1
  br i1 %78, label %93, label %79

79:                                               ; preds = %76
  %80 = trunc nsw i64 %59 to i32
  %81 = call noundef zeroext i1 @_Z5checkii(i32 noundef %80, i32 noundef %48)
  br i1 %81, label %82, label %.thread

82:                                               ; preds = %79
  %83 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %47
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %86, align 4, !tbaa !5
  %.not74.1 = icmp eq i32 %77, 3
  br i1 %.not74.1, label %.thread, label %89

89:                                               ; preds = %82
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  call void @_Z6appendiii(i32 noundef %80, i32 noundef %48, i32 noundef %91)
  br label %.thread

.thread:                                          ; preds = %89, %82, %79
  %92 = add nuw nsw i32 %58, 1
  br label %94

93:                                               ; preds = %76
  %.not157 = icmp eq i32 %58, 2
  br i1 %.not157, label %94, label %108

94:                                               ; preds = %.thread, %93
  %95 = phi i32 [ %92, %.thread ], [ 3, %93 ]
  %96 = trunc nsw i64 %59 to i32
  %97 = call noundef zeroext i1 @_Z5checkii(i32 noundef %96, i32 noundef %50)
  br i1 %97, label %98, label %.thread142

98:                                               ; preds = %94
  %99 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %49
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %102, align 4, !tbaa !5
  %.not74.2 = icmp eq i32 %95, 3
  br i1 %.not74.2, label %.thread142, label %105

105:                                              ; preds = %98
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  call void @_Z6appendiii(i32 noundef %96, i32 noundef %50, i32 noundef %107)
  br label %.thread142

108:                                              ; preds = %93
  %109 = icmp ugt i32 %58, 3
  br i1 %109, label %.thread144, label %.thread142

.thread142:                                       ; preds = %94, %98, %105, %108
  %110 = phi i32 [ 4, %108 ], [ %95, %105 ], [ 3, %98 ], [ %95, %94 ]
  %111 = phi i1 [ true, %108 ], [ false, %105 ], [ false, %98 ], [ false, %94 ]
  %112 = trunc nsw i64 %59 to i32
  %113 = call noundef zeroext i1 @_Z5checkii(i32 noundef %112, i32 noundef %.sroa.4.0.copyload)
  br i1 %113, label %114, label %124

114:                                              ; preds = %.thread142
  %115 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %42
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %118, align 4, !tbaa !5
  %.not74.3 = icmp eq i32 %58, 3
  br i1 %.not74.3, label %124, label %121

121:                                              ; preds = %114
  %122 = load i32, ptr %5, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  call void @_Z6appendiii(i32 noundef %112, i32 noundef %.sroa.4.0.copyload, i32 noundef %123)
  br i1 %111, label %138, label %125

124:                                              ; preds = %114, %.thread142
  br i1 %111, label %138, label %125

125:                                              ; preds = %121, %124
  %126 = trunc nsw i64 %59 to i32
  %127 = call noundef zeroext i1 @_Z5checkii(i32 noundef %126, i32 noundef %52)
  br i1 %127, label %128, label %138

128:                                              ; preds = %125
  %129 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %51
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %132, align 4, !tbaa !5
  %.not74.4 = icmp eq i32 %110, 3
  br i1 %.not74.4, label %138, label %135

135:                                              ; preds = %128
  %136 = load i32, ptr %5, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  call void @_Z6appendiii(i32 noundef %126, i32 noundef %52, i32 noundef %137)
  br label %138

138:                                              ; preds = %121, %135, %128, %125, %124
  br i1 %78, label %.thread144, label %139

139:                                              ; preds = %138
  %140 = trunc nsw i64 %59 to i32
  %141 = call noundef zeroext i1 @_Z5checkii(i32 noundef %140, i32 noundef %54)
  br i1 %141, label %142, label %.thread144

142:                                              ; preds = %139
  %143 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %53
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %146, align 4, !tbaa !5
  %.not74.5 = icmp eq i32 %77, 3
  br i1 %.not74.5, label %.thread144, label %149

149:                                              ; preds = %142
  %150 = load i32, ptr %5, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  call void @_Z6appendiii(i32 noundef %140, i32 noundef %54, i32 noundef %151)
  br label %.thread144

.thread144:                                       ; preds = %108, %149, %142, %139, %138
  br i1 %.not140, label %152, label %161

152:                                              ; preds = %.thread144
  %153 = call noundef zeroext i1 @_Z5checkii(i32 noundef %.sroa.0.0.copyload, i32 noundef %56)
  br i1 %153, label %154, label %161

154:                                              ; preds = %152
  %155 = getelementptr inbounds [509 x [509 x i32]], ptr @_ZZ4mainE1a, i64 0, i64 %59, i64 %55
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %158, align 4, !tbaa !5
  br label %161

161:                                              ; preds = %154, %152, %.thread144
  %indvars.iv.next134 = add nsw i64 %indvars.iv133, 1
  %exitcond136.not = icmp eq i64 %indvars.iv.next134, 4
  br i1 %exitcond136.not, label %60, label %.preheader77, !llvm.loop !17

162:                                              ; preds = %.critedge
  store i32 %185, ptr %5, align 4, !tbaa !5
  %163 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %164 = load i32, ptr %163, align 4, !tbaa !5
  store i32 %164, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %165 = call noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @que)
  br i1 %165, label %._crit_edge109, label %.lr.ph108, !llvm.loop !18

166:                                              ; preds = %60, %.critedge
  %.0106 = phi i32 [ 3, %60 ], [ %.1.lcssa, %.critedge ]
  %.056105 = phi i32 [ 1, %60 ], [ %.157.lcssa, %.critedge ]
  %.058104 = phi i32 [ 0, %60 ], [ %168, %.critedge ]
  %.059103 = phi i32 [ %62, %60 ], [ %.160.lcssa, %.critedge ]
  %167 = phi i32 [ %.promoted, %60 ], [ %185, %.critedge ]
  %168 = add nsw i32 %.058104, %.059103
  %169 = sext i32 %.056105 to i64
  br label %170

170:                                              ; preds = %166, %.critedge76
  %indvars.iv137 = phi i64 [ %169, %166 ], [ %indvars.iv.next138, %.critedge76 ]
  %.1101 = phi i32 [ %.0106, %166 ], [ %.282, %.critedge76 ]
  %.16099 = phi i32 [ %.059103, %166 ], [ %.261, %.critedge76 ]
  %171 = getelementptr inbounds [9 x i32], ptr @_ZZ4mainE3low, i64 0, i64 %indvars.iv137
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %.not72 = icmp slt i32 %168, %172
  br i1 %.not72, label %.critedge.split.loop.exit, label %.preheader

.preheader:                                       ; preds = %170
  %173 = icmp sgt i32 %.1101, 0
  br i1 %173, label %.lr.ph98, label %.critedge76

.lr.ph98:                                         ; preds = %.preheader, %177
  %.297 = phi i32 [ %178, %177 ], [ %.1101, %.preheader ]
  %174 = zext nneg i32 %.297 to i64
  %175 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %.not73 = icmp eq i32 %176, 0
  br i1 %.not73, label %177, label %.critedge2

177:                                              ; preds = %.lr.ph98
  %178 = add nsw i32 %.297, -1
  %179 = icmp sgt i32 %.297, 1
  br i1 %179, label %.lr.ph98, label %.critedge76, !llvm.loop !19

.critedge2:                                       ; preds = %.lr.ph98
  %180 = getelementptr inbounds [5 x i32], ptr %6, i64 0, i64 %174
  %181 = add nsw i32 %176, -1
  store i32 %181, ptr %180, align 4, !tbaa !5
  %182 = add nsw i32 %.297, %.16099
  br label %.critedge76

.critedge76:                                      ; preds = %177, %.preheader, %.critedge2
  %.282 = phi i32 [ %.297, %.critedge2 ], [ %.1101, %.preheader ], [ 0, %177 ]
  %.261 = phi i32 [ %182, %.critedge2 ], [ %.16099, %.preheader ], [ %.16099, %177 ]
  %indvars.iv.next138 = add nsw i64 %indvars.iv137, 1
  %183 = icmp slt i64 %indvars.iv137, 8
  br i1 %183, label %170, label %.critedge, !llvm.loop !20

.critedge.split.loop.exit:                        ; preds = %170
  %184 = trunc nsw i64 %indvars.iv137 to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge76, %.critedge.split.loop.exit
  %.160.lcssa = phi i32 [ %.16099, %.critedge.split.loop.exit ], [ %.261, %.critedge76 ]
  %.157.lcssa = phi i32 [ %184, %.critedge.split.loop.exit ], [ 9, %.critedge76 ]
  %.1.lcssa = phi i32 [ %.1101, %.critedge.split.loop.exit ], [ %.282, %.critedge76 ]
  %185 = add nsw i32 %167, 1
  %186 = icmp slt i32 %.157.lcssa, 9
  br i1 %186, label %166, label %162, !llvm.loop !21

._crit_edge109:                                   ; preds = %162, %._crit_edge93
  %187 = load i32, ptr %4, align 4, !tbaa !5
  %188 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %187)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %189 = load i32, ptr %1, align 4, !tbaa !5
  %190 = add nsw i32 %189, -1
  store i32 %190, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %189, 0
  br i1 %.not, label %._crit_edge113, label %.lr.ph112, !llvm.loop !22

._crit_edge113:                                   ; preds = %._crit_edge109, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6appendiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5checkii(i32 noundef, i32 noundef) local_unnamed_addr #7

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #8 = { 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


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