; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100506B)

; 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"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@id = external dso_local global [10010 x i32], align 16
@u = external dso_local global [10010 x i32], align 16
@e = external dso_local global [10010 x [15 x i32]], align 16
@que = external dso_local global [10010 x i32], align 16
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@dis = external dso_local global [10010 x i32], align 16
@res = external dso_local global [10010 x i32], align 16
@ans = external dso_local global i32, align 4
@pos = external dso_local global i32, align 4
@vis = external dso_local global [10010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 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 i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %17

17:                                               ; preds = %297, %0
  %18 = load i32, ptr @t, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @t, align 4, !tbaa !5
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %301

21:                                               ; preds = %17
  call void @llvm.memset.p0.i64(ptr align 16 @id, i8 0, i64 40040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @e, i8 0, i64 600600, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @res, i8 0, i64 40040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 10010, i1 false)
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %62, %21
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %65

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr @u, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %31)
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [10010 x i32], ptr @u, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %38
  store i32 %33, ptr %39, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %58, %28
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %43
  %45 = getelementptr inbounds [15 x i32], ptr %44, i64 0, i64 0
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = icmp sle i32 %41, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %40
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %61

49:                                               ; preds = %40
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %51
  %53 = getelementptr inbounds [15 x i32], ptr %52, i64 0, i64 0
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %56)
  br label %58

58:                                               ; preds = %49
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %4, align 4, !tbaa !5
  br label %40, !llvm.loop !9

61:                                               ; preds = %48
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !11

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

66:                                               ; preds = %102, %65
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %105

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %98, %71
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %75
  %77 = getelementptr inbounds [15 x i32], ptr %76, i64 0, i64 0
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp sle i32 %73, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %72
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %101

81:                                               ; preds = %72
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %83
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [15 x i32], ptr %84, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %93
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [15 x i32], ptr %94, i64 0, i64 %96
  store i32 %91, ptr %97, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %81
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %6, align 4, !tbaa !5
  br label %72, !llvm.loop !12

101:                                              ; preds = %80
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %5, align 4, !tbaa !5
  br label %66, !llvm.loop !13

105:                                              ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %130, %105
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = load i32, ptr @m, align 4, !tbaa !5
  %109 = icmp sle i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %133

111:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %112 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %126, %111
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = icmp sle i32 %114, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %113
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %129

118:                                              ; preds = %113
  %119 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8)
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %124
  store i8 1, ptr %125, align 1, !tbaa !14
  br label %126

126:                                              ; preds = %118
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %10, align 4, !tbaa !5
  br label %113, !llvm.loop !16

129:                                              ; preds = %117
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %7, align 4, !tbaa !5
  br label %106, !llvm.loop !17

133:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %246, %133
  %135 = load i32, ptr %11, align 4, !tbaa !5
  %136 = load i32, ptr @n, align 4, !tbaa !5
  %137 = icmp sle i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %249

139:                                              ; preds = %134
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !14, !range !18, !noundef !19
  %144 = trunc i8 %143 to i1
  br i1 %144, label %146, label %145

145:                                              ; preds = %139
  br label %246

146:                                              ; preds = %139
  store i32 0, ptr @r, align 4, !tbaa !5
  store i32 0, ptr @l, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @dis, i8 0, i64 40040, i1 false)
  %147 = load i32, ptr %11, align 4, !tbaa !5
  %148 = load i32, ptr @r, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr @r, align 4, !tbaa !5
  %150 = sext i32 %148 to i64
  %151 = getelementptr inbounds [10010 x i32], ptr @que, i64 0, i64 %150
  store i32 %147, ptr %151, align 4, !tbaa !5
  %152 = load i32, ptr %11, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %153
  store i32 1, ptr %154, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %216, %146
  %156 = load i32, ptr @l, align 4, !tbaa !5
  %157 = load i32, ptr @r, align 4, !tbaa !5
  %158 = icmp slt i32 %156, %157
  br i1 %158, label %159, label %217

159:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %160 = load i32, ptr @l, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr @l, align 4, !tbaa !5
  %162 = sext i32 %160 to i64
  %163 = getelementptr inbounds [10010 x i32], ptr @que, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  store i32 %164, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %165

165:                                              ; preds = %213, %159
  %166 = load i32, ptr %13, align 4, !tbaa !5
  %167 = load i32, ptr %12, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %168
  %170 = getelementptr inbounds [15 x i32], ptr %169, i64 0, i64 0
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = icmp sle i32 %166, %171
  br i1 %172, label %174, label %173

173:                                              ; preds = %165
  store i32 27, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %216

174:                                              ; preds = %165
  %175 = load i32, ptr %12, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %176
  %178 = load i32, ptr %13, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [15 x i32], ptr %177, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = icmp ne i32 %184, 0
  br i1 %185, label %212, label %186

186:                                              ; preds = %174
  %187 = load i32, ptr %12, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %188
  %190 = load i32, ptr %13, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [15 x i32], ptr %189, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = load i32, ptr @r, align 4, !tbaa !5
  %195 = add nsw i32 %194, 1
  store i32 %195, ptr @r, align 4, !tbaa !5
  %196 = sext i32 %194 to i64
  %197 = getelementptr inbounds [10010 x i32], ptr @que, i64 0, i64 %196
  store i32 %193, ptr %197, align 4, !tbaa !5
  %198 = load i32, ptr %12, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  %203 = load i32, ptr %12, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %204
  %206 = load i32, ptr %13, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [15 x i32], ptr %205, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %210
  store i32 %202, ptr %211, align 4, !tbaa !5
  br label %212

212:                                              ; preds = %186, %174
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %13, align 4, !tbaa !5
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %13, align 4, !tbaa !5
  br label %165, !llvm.loop !20

216:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %155, !llvm.loop !21

217:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %218

218:                                              ; preds = %242, %217
  %219 = load i32, ptr %14, align 4, !tbaa !5
  %220 = load i32, ptr @n, align 4, !tbaa !5
  %221 = icmp sle i32 %219, %220
  br i1 %221, label %223, label %222

222:                                              ; preds = %218
  store i32 30, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %245

223:                                              ; preds = %218
  %224 = load i32, ptr %14, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  %228 = load i32, ptr %14, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %229
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = icmp slt i32 %227, %231
  br i1 %232, label %233, label %241

233:                                              ; preds = %223
  %234 = load i32, ptr %14, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !5
  %238 = load i32, ptr %14, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %239
  store i32 %237, ptr %240, align 4, !tbaa !5
  br label %241

241:                                              ; preds = %233, %223
  br label %242

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

245:                                              ; preds = %222
  br label %246

246:                                              ; preds = %245, %145
  %247 = load i32, ptr %11, align 4, !tbaa !5
  %248 = add nsw i32 %247, 1
  store i32 %248, ptr %11, align 4, !tbaa !5
  br label %134, !llvm.loop !23

249:                                              ; preds = %138
  %250 = load i32, ptr getelementptr inbounds ([10010 x i32], ptr @res, i64 0, i64 1), align 4, !tbaa !5
  store i32 %250, ptr @ans, align 4, !tbaa !5
  %251 = load i32, ptr getelementptr inbounds ([10010 x i32], ptr @u, i64 0, i64 1), align 4, !tbaa !5
  store i32 %251, ptr @pos, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 2, ptr %15, align 4, !tbaa !5
  br label %252

252:                                              ; preds = %294, %249
  %253 = load i32, ptr %15, align 4, !tbaa !5
  %254 = load i32, ptr @n, align 4, !tbaa !5
  %255 = icmp sle i32 %253, %254
  br i1 %255, label %257, label %256

256:                                              ; preds = %252
  store i32 33, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %297

257:                                              ; preds = %252
  %258 = load i32, ptr @ans, align 4, !tbaa !5
  %259 = load i32, ptr %15, align 4, !tbaa !5
  %260 = sext i32 %259 to i64
  %261 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %260
  %262 = load i32, ptr %261, align 4, !tbaa !5
  %263 = icmp sgt i32 %258, %262
  br i1 %263, label %264, label %273

264:                                              ; preds = %257
  %265 = load i32, ptr %15, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !5
  store i32 %268, ptr @ans, align 4, !tbaa !5
  %269 = load i32, ptr %15, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [10010 x i32], ptr @u, i64 0, i64 %270
  %272 = load i32, ptr %271, align 4, !tbaa !5
  store i32 %272, ptr @pos, align 4, !tbaa !5
  br label %293

273:                                              ; preds = %257
  %274 = load i32, ptr @ans, align 4, !tbaa !5
  %275 = load i32, ptr %15, align 4, !tbaa !5
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %276
  %278 = load i32, ptr %277, align 4, !tbaa !5
  %279 = icmp eq i32 %274, %278
  br i1 %279, label %280, label %292

280:                                              ; preds = %273
  %281 = load i32, ptr @pos, align 4, !tbaa !5
  %282 = load i32, ptr %15, align 4, !tbaa !5
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [10010 x i32], ptr @u, i64 0, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !5
  %286 = icmp sgt i32 %281, %285
  br i1 %286, label %287, label %292

287:                                              ; preds = %280
  %288 = load i32, ptr %15, align 4, !tbaa !5
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds [10010 x i32], ptr @u, i64 0, i64 %289
  %291 = load i32, ptr %290, align 4, !tbaa !5
  store i32 %291, ptr @pos, align 4, !tbaa !5
  br label %292

292:                                              ; preds = %287, %280, %273
  br label %293

293:                                              ; preds = %292, %264
  br label %294

294:                                              ; preds = %293
  %295 = load i32, ptr %15, align 4, !tbaa !5
  %296 = add nsw i32 %295, 1
  store i32 %296, ptr %15, align 4, !tbaa !5
  br label %252, !llvm.loop !24

297:                                              ; preds = %256
  %298 = load i32, ptr @ans, align 4, !tbaa !5
  %299 = load i32, ptr @pos, align 4, !tbaa !5
  %300 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %298, i32 noundef %299)
  br label %17, !llvm.loop !25

301:                                              ; preds = %17
  ret i32 0
}

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

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

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

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

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

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 = { "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 nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !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"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@id = external dso_local local_unnamed_addr global [10010 x i32], align 16
@u = external dso_local global [10010 x i32], align 16
@e = external dso_local global [10010 x [15 x i32]], align 16
@que = external dso_local local_unnamed_addr global [10010 x i32], align 16
@l = external dso_local local_unnamed_addr global i32, align 4
@r = external dso_local local_unnamed_addr global i32, align 4
@dis = external dso_local local_unnamed_addr global [10010 x i32], align 16
@res = external dso_local local_unnamed_addr global [10010 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@pos = external dso_local local_unnamed_addr global i32, align 4
@vis = external dso_local local_unnamed_addr global [10010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not130 = icmp eq i32 %4, 0
  br i1 %.not130, label %._crit_edge133, label %.lr.ph132

.lr.ph132:                                        ; preds = %0, %._crit_edge129
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40040) @id, i8 0, i64 40040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(600600) @e, i8 0, i64 600600, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40040) @res, i8 0, i64 40040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10010) @vis, i8 0, i64 10010, i1 false)
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %.not6685 = icmp slt i32 %7, 1
  br i1 %.not6685, label %.preheader80, label %.lr.ph88

.preheader81:                                     ; preds = %._crit_edge
  %.not6793 = icmp slt i32 %17, 1
  br i1 %.not6793, label %.preheader80, label %.preheader78.preheader

.preheader78.preheader:                           ; preds = %.preheader81
  %8 = add nuw i32 %17, 1
  %wide.trip.count = zext i32 %8 to i64
  br label %.preheader78

.lr.ph88:                                         ; preds = %.lr.ph132, %._crit_edge
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %._crit_edge ], [ 1, %.lr.ph132 ]
  %9 = getelementptr inbounds i32, ptr @u, i64 %indvars.iv137
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9)
  %11 = load i32, ptr %9, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %12
  %14 = trunc nuw nsw i64 %indvars.iv137 to i32
  store i32 %14, ptr %13, align 4, !tbaa !5
  %15 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv137
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %.not7683 = icmp slt i32 %16, 0
  br i1 %.not7683, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph88
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %.not66.not = icmp slt i64 %indvars.iv137, %18
  br i1 %.not66.not, label %.lr.ph88, label %.preheader81, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph88, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph88 ]
  %19 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %19)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr %15, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %.not76.not = icmp slt i64 %indvars.iv, %22
  br i1 %.not76.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader80:                                     ; preds = %._crit_edge92, %.lr.ph132, %.preheader81
  %.lcssa171 = phi i32 [ %17, %.preheader81 ], [ %7, %.lr.ph132 ], [ %17, %._crit_edge92 ]
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %.not68100 = icmp slt i32 %23, 1
  br i1 %.not68100, label %.preheader79, label %.lr.ph102

.preheader78:                                     ; preds = %.preheader78.preheader, %._crit_edge92
  %indvars.iv143 = phi i64 [ 1, %.preheader78.preheader ], [ %indvars.iv.next144, %._crit_edge92 ]
  %24 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv143
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not7589 = icmp slt i32 %25, 1
  br i1 %.not7589, label %._crit_edge92, label %.lr.ph91.preheader

.lr.ph91.preheader:                               ; preds = %.preheader78
  %26 = zext nneg i32 %25 to i64
  %xtraiter = and i64 %26, 3
  %27 = icmp ult i32 %25, 4
  br i1 %27, label %._crit_edge92.loopexit.unr-lcssa, label %.lr.ph91.preheader.new

.lr.ph91.preheader.new:                           ; preds = %.lr.ph91.preheader
  %unroll_iter = and i64 %26, 2147483644
  br label %.lr.ph91

._crit_edge92.loopexit.unr-lcssa:                 ; preds = %.lr.ph91, %.lr.ph91.preheader
  %indvars.iv140.unr = phi i64 [ 1, %.lr.ph91.preheader ], [ %indvars.iv.next141.3, %.lr.ph91 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge92, label %.lr.ph91.epil

.lr.ph91.epil:                                    ; preds = %._crit_edge92.loopexit.unr-lcssa, %.lr.ph91.epil
  %indvars.iv140.epil = phi i64 [ %indvars.iv.next141.epil, %.lr.ph91.epil ], [ %indvars.iv140.unr, %._crit_edge92.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph91.epil ], [ 0, %._crit_edge92.loopexit.unr-lcssa ]
  %28 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv143, i64 %indvars.iv140.epil
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %32, ptr %28, align 4, !tbaa !5
  %indvars.iv.next141.epil = add nuw nsw i64 %indvars.iv140.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_edge92, label %.lr.ph91.epil, !llvm.loop !12

._crit_edge92:                                    ; preds = %._crit_edge92.loopexit.unr-lcssa, %.lr.ph91.epil, %.preheader78
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count
  br i1 %exitcond.not, label %.preheader80, label %.preheader78, !llvm.loop !14

.lr.ph91:                                         ; preds = %.lr.ph91, %.lr.ph91.preheader.new
  %indvars.iv140 = phi i64 [ 1, %.lr.ph91.preheader.new ], [ %indvars.iv.next141.3, %.lr.ph91 ]
  %niter = phi i64 [ 0, %.lr.ph91.preheader.new ], [ %niter.next.3, %.lr.ph91 ]
  %33 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv143, i64 %indvars.iv140
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  store i32 %37, ptr %33, align 4, !tbaa !5
  %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
  %38 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv143, i64 %indvars.iv.next141
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr %38, align 4, !tbaa !5
  %indvars.iv.next141.1 = add nuw nsw i64 %indvars.iv140, 2
  %43 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv143, i64 %indvars.iv.next141.1
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  store i32 %47, ptr %43, align 4, !tbaa !5
  %indvars.iv.next141.2 = add nuw nsw i64 %indvars.iv140, 3
  %48 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %indvars.iv143, i64 %indvars.iv.next141.2
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr %48, align 4, !tbaa !5
  %indvars.iv.next141.3 = add nuw nsw i64 %indvars.iv140, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3.not = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3.not, label %._crit_edge92.loopexit.unr-lcssa, label %.lr.ph91, !llvm.loop !15

.preheader79.loopexit:                            ; preds = %._crit_edge99
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader79

.preheader79:                                     ; preds = %.preheader79.loopexit, %.preheader80
  %53 = phi i32 [ %.pre, %.preheader79.loopexit ], [ %.lcssa171, %.preheader80 ]
  %.not69120 = icmp slt i32 %53, 1
  br i1 %.not69120, label %._crit_edge123.thread, label %.lr.ph122.preheader

._crit_edge123.thread:                            ; preds = %.preheader79
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @res, i64 4), align 4, !tbaa !5
  store i32 %54, ptr @ans, align 4, !tbaa !5
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @u, i64 4), align 4, !tbaa !5
  store i32 %55, ptr @pos, align 4, !tbaa !5
  br label %._crit_edge129

.lr.ph122.preheader:                              ; preds = %.preheader79
  %56 = add nuw i32 %53, 1
  %wide.trip.count162 = zext i32 %56 to i64
  %57 = zext nneg i32 %53 to i64
  %min.iters.check = icmp ult i32 %53, 8
  %n.vec = and i64 %57, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %57
  br label %.lr.ph122

.lr.ph102:                                        ; preds = %.preheader80, %._crit_edge99
  %.057101 = phi i32 [ %60, %._crit_edge99 ], [ 1, %.preheader80 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %.not7495 = icmp slt i32 %59, 1
  br i1 %.not7495, label %._crit_edge99, label %.lr.ph98

._crit_edge99:                                    ; preds = %.lr.ph98, %.lr.ph102
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %60 = add nuw nsw i32 %.057101, 1
  %61 = load i32, ptr @m, align 4, !tbaa !5
  %.not68.not = icmp slt i32 %.057101, %61
  br i1 %.not68.not, label %.lr.ph102, label %.preheader79.loopexit, !llvm.loop !16

.lr.ph98:                                         ; preds = %.lr.ph102, %.lr.ph98
  %.05696 = phi i32 [ %69, %.lr.ph98 ], [ 1, %.lr.ph102 ]
  %62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [10010 x i32], ptr @id, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %67
  store i8 1, ptr %68, align 1, !tbaa !17
  %69 = add nuw nsw i32 %.05696, 1
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %.not74.not = icmp slt i32 %.05696, %70
  br i1 %.not74.not, label %.lr.ph98, label %._crit_edge99, !llvm.loop !19

._crit_edge123:                                   ; preds = %.loopexit77
  %71 = load i32, ptr getelementptr inbounds (i8, ptr @res, i64 4), align 4, !tbaa !5
  store i32 %71, ptr @ans, align 4, !tbaa !5
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @u, i64 4), align 4, !tbaa !5
  store i32 %72, ptr @pos, align 4, !tbaa !5
  %.not70125 = icmp eq i32 %53, 1
  br i1 %.not70125, label %._crit_edge129, label %.lr.ph128.preheader

.lr.ph128.preheader:                              ; preds = %._crit_edge123
  %73 = add nuw i32 %53, 1
  %wide.trip.count167 = zext i32 %73 to i64
  br label %.lr.ph128

.lr.ph122:                                        ; preds = %.lr.ph122.preheader, %.loopexit77
  %indvars.iv159 = phi i64 [ 1, %.lr.ph122.preheader ], [ %indvars.iv.next160, %.loopexit77 ]
  %74 = getelementptr inbounds [10010 x i8], ptr @vis, i64 0, i64 %indvars.iv159
  %75 = load i8, ptr %74, align 1, !tbaa !17, !range !20, !noundef !21
  %76 = trunc nuw i8 %75 to i1
  br i1 %76, label %.lr.ph114, label %.loopexit77

.lr.ph114:                                        ; preds = %.lr.ph122
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40040) @dis, i8 0, i64 40040, i1 false)
  store i32 1, ptr @r, align 4, !tbaa !5
  %77 = trunc nuw nsw i64 %indvars.iv159 to i32
  store i32 %77, ptr @que, align 16, !tbaa !5
  %78 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %indvars.iv159
  store i32 1, ptr %78, align 4, !tbaa !5
  br label %120

.loopexit:                                        ; preds = %141, %120
  %r.promoted110 = phi i32 [ %r.promoted111112, %120 ], [ %r.promoted108, %141 ]
  %79 = sext i32 %r.promoted110 to i64
  %80 = icmp slt i64 %indvars.iv.next152, %79
  br i1 %80, label %120, label %..preheader_crit_edge, !llvm.loop !22

..preheader_crit_edge:                            ; preds = %.loopexit
  %81 = trunc nuw nsw i64 %indvars.iv.next152 to i32
  store i32 %81, ptr @l, align 4, !tbaa !5
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %..preheader_crit_edge
  %indvars.iv154.ph = phi i64 [ 1, %..preheader_crit_edge ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %..preheader_crit_edge, %pred.store.continue194
  %index = phi i64 [ %index.next, %pred.store.continue194 ], [ 0, %..preheader_crit_edge ]
  %offset.idx = or disjoint i64 %index, 1
  %82 = or disjoint i64 %index, 5
  %83 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %offset.idx
  %84 = getelementptr inbounds i8, ptr %83, i64 16
  %wide.load = load <4 x i32>, ptr %83, align 4, !tbaa !5
  %wide.load178 = load <4 x i32>, ptr %84, align 4, !tbaa !5
  %85 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %offset.idx
  %86 = getelementptr inbounds i8, ptr %85, i64 16
  %wide.load179 = load <4 x i32>, ptr %85, align 4, !tbaa !5
  %wide.load180 = load <4 x i32>, ptr %86, align 4, !tbaa !5
  %87 = icmp slt <4 x i32> %wide.load, %wide.load179
  %88 = icmp slt <4 x i32> %wide.load178, %wide.load180
  %89 = extractelement <4 x i1> %87, i64 0
  br i1 %89, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body
  %90 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %offset.idx
  %91 = extractelement <4 x i32> %wide.load179, i64 0
  store i32 %91, ptr %90, align 4, !tbaa !5
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body
  %92 = extractelement <4 x i1> %87, i64 1
  br i1 %92, label %pred.store.if181, label %pred.store.continue182

pred.store.if181:                                 ; preds = %pred.store.continue
  %93 = or disjoint i64 %index, 2
  %94 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %93
  %95 = extractelement <4 x i32> %wide.load179, i64 1
  store i32 %95, ptr %94, align 8, !tbaa !5
  br label %pred.store.continue182

pred.store.continue182:                           ; preds = %pred.store.if181, %pred.store.continue
  %96 = extractelement <4 x i1> %87, i64 2
  br i1 %96, label %pred.store.if183, label %pred.store.continue184

pred.store.if183:                                 ; preds = %pred.store.continue182
  %97 = or disjoint i64 %index, 3
  %98 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %97
  %99 = extractelement <4 x i32> %wide.load179, i64 2
  store i32 %99, ptr %98, align 4, !tbaa !5
  br label %pred.store.continue184

pred.store.continue184:                           ; preds = %pred.store.if183, %pred.store.continue182
  %100 = extractelement <4 x i1> %87, i64 3
  br i1 %100, label %pred.store.if185, label %pred.store.continue186

pred.store.if185:                                 ; preds = %pred.store.continue184
  %101 = or disjoint i64 %index, 4
  %102 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %101
  %103 = extractelement <4 x i32> %wide.load179, i64 3
  store i32 %103, ptr %102, align 16, !tbaa !5
  br label %pred.store.continue186

pred.store.continue186:                           ; preds = %pred.store.if185, %pred.store.continue184
  %104 = extractelement <4 x i1> %88, i64 0
  br i1 %104, label %pred.store.if187, label %pred.store.continue188

pred.store.if187:                                 ; preds = %pred.store.continue186
  %105 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %82
  %106 = extractelement <4 x i32> %wide.load180, i64 0
  store i32 %106, ptr %105, align 4, !tbaa !5
  br label %pred.store.continue188

pred.store.continue188:                           ; preds = %pred.store.if187, %pred.store.continue186
  %107 = extractelement <4 x i1> %88, i64 1
  br i1 %107, label %pred.store.if189, label %pred.store.continue190

pred.store.if189:                                 ; preds = %pred.store.continue188
  %108 = or disjoint i64 %index, 6
  %109 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %108
  %110 = extractelement <4 x i32> %wide.load180, i64 1
  store i32 %110, ptr %109, align 8, !tbaa !5
  br label %pred.store.continue190

pred.store.continue190:                           ; preds = %pred.store.if189, %pred.store.continue188
  %111 = extractelement <4 x i1> %88, i64 2
  br i1 %111, label %pred.store.if191, label %pred.store.continue192

pred.store.if191:                                 ; preds = %pred.store.continue190
  %112 = or disjoint i64 %index, 7
  %113 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %112
  %114 = extractelement <4 x i32> %wide.load180, i64 2
  store i32 %114, ptr %113, align 4, !tbaa !5
  br label %pred.store.continue192

pred.store.continue192:                           ; preds = %pred.store.if191, %pred.store.continue190
  %115 = extractelement <4 x i1> %88, i64 3
  br i1 %115, label %pred.store.if193, label %pred.store.continue194

pred.store.if193:                                 ; preds = %pred.store.continue192
  %116 = add i64 %index, 8
  %117 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %116
  %118 = extractelement <4 x i32> %wide.load180, i64 3
  store i32 %118, ptr %117, align 16, !tbaa !5
  br label %pred.store.continue194

pred.store.continue194:                           ; preds = %pred.store.if193, %pred.store.continue192
  %index.next = add nuw i64 %index, 8
  %119 = icmp eq i64 %index.next, %n.vec
  br i1 %119, label %middle.block, label %vector.body, !llvm.loop !23

middle.block:                                     ; preds = %pred.store.continue194
  br i1 %cmp.n, label %.loopexit77, label %scalar.ph.preheader

120:                                              ; preds = %.lr.ph114, %.loopexit
  %indvars.iv151 = phi i64 [ 0, %.lr.ph114 ], [ %indvars.iv.next152, %.loopexit ]
  %r.promoted111112 = phi i32 [ 1, %.lr.ph114 ], [ %r.promoted110, %.loopexit ]
  %indvars.iv.next152 = add nuw nsw i64 %indvars.iv151, 1
  %121 = getelementptr inbounds [10010 x i32], ptr @que, i64 0, i64 %indvars.iv151
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %.not72103 = icmp slt i32 %125, 1
  br i1 %.not72103, label %.loopexit, label %.lr.ph106

.lr.ph106:                                        ; preds = %120
  %126 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %123
  %127 = add nuw i32 %125, 1
  %wide.trip.count149 = zext i32 %127 to i64
  br label %128

128:                                              ; preds = %.lr.ph106, %141
  %indvars.iv146 = phi i64 [ 1, %.lr.ph106 ], [ %indvars.iv.next147, %141 ]
  %r.promoted109 = phi i32 [ %r.promoted111112, %.lr.ph106 ], [ %r.promoted108, %141 ]
  %129 = phi i32 [ %r.promoted111112, %.lr.ph106 ], [ %142, %141 ]
  %130 = getelementptr inbounds [10010 x [15 x i32]], ptr @e, i64 0, i64 %123, i64 %indvars.iv146
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %.not73 = icmp eq i32 %134, 0
  br i1 %.not73, label %135, label %141

135:                                              ; preds = %128
  %136 = add nsw i32 %129, 1
  store i32 %136, ptr @r, align 4, !tbaa !5
  %137 = sext i32 %129 to i64
  %138 = getelementptr inbounds [10010 x i32], ptr @que, i64 0, i64 %137
  store i32 %131, ptr %138, align 4, !tbaa !5
  %139 = load i32, ptr %126, align 4, !tbaa !5
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %133, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %128, %135
  %r.promoted108 = phi i32 [ %r.promoted109, %128 ], [ %136, %135 ]
  %142 = phi i32 [ %129, %128 ], [ %136, %135 ]
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %exitcond150.not = icmp eq i64 %indvars.iv.next147, %wide.trip.count149
  br i1 %exitcond150.not, label %.loopexit, label %128, !llvm.loop !26

scalar.ph:                                        ; preds = %scalar.ph.preheader, %149
  %indvars.iv154 = phi i64 [ %indvars.iv.next155, %149 ], [ %indvars.iv154.ph, %scalar.ph.preheader ]
  %143 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %indvars.iv154
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = getelementptr inbounds [10010 x i32], ptr @dis, i64 0, i64 %indvars.iv154
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = icmp slt i32 %144, %146
  br i1 %147, label %148, label %149

148:                                              ; preds = %scalar.ph
  store i32 %146, ptr %143, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %scalar.ph, %148
  %indvars.iv.next155 = add nuw nsw i64 %indvars.iv154, 1
  %exitcond158.not = icmp eq i64 %indvars.iv.next155, %wide.trip.count162
  br i1 %exitcond158.not, label %.loopexit77, label %scalar.ph, !llvm.loop !27

.loopexit77:                                      ; preds = %149, %middle.block, %.lr.ph122
  %indvars.iv.next160 = add nuw nsw i64 %indvars.iv159, 1
  %exitcond163.not = icmp eq i64 %indvars.iv.next160, %wide.trip.count162
  br i1 %exitcond163.not, label %._crit_edge123, label %.lr.ph122, !llvm.loop !28

._crit_edge129:                                   ; preds = %169, %._crit_edge123.thread, %._crit_edge123
  %150 = phi i32 [ %72, %._crit_edge123 ], [ %55, %._crit_edge123.thread ], [ %170, %169 ]
  %151 = phi i32 [ %71, %._crit_edge123 ], [ %54, %._crit_edge123.thread ], [ %171, %169 ]
  %152 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %151, i32 noundef %150)
  %153 = load i32, ptr @t, align 4, !tbaa !5
  %154 = add nsw i32 %153, -1
  store i32 %154, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %153, 0
  br i1 %.not, label %._crit_edge133, label %.lr.ph132, !llvm.loop !29

.lr.ph128:                                        ; preds = %.lr.ph128.preheader, %169
  %indvars.iv164 = phi i64 [ 2, %.lr.ph128.preheader ], [ %indvars.iv.next165, %169 ]
  %155 = phi i32 [ %71, %.lr.ph128.preheader ], [ %171, %169 ]
  %156 = phi i32 [ %72, %.lr.ph128.preheader ], [ %170, %169 ]
  %157 = getelementptr inbounds [10010 x i32], ptr @res, i64 0, i64 %indvars.iv164
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = icmp sgt i32 %155, %158
  br i1 %159, label %160, label %163

160:                                              ; preds = %.lr.ph128
  store i32 %158, ptr @ans, align 4, !tbaa !5
  %161 = getelementptr inbounds [10010 x i32], ptr @u, i64 0, i64 %indvars.iv164
  %162 = load i32, ptr %161, align 4, !tbaa !5
  br label %.sink.split

163:                                              ; preds = %.lr.ph128
  %164 = icmp eq i32 %155, %158
  br i1 %164, label %165, label %169

165:                                              ; preds = %163
  %166 = getelementptr inbounds [10010 x i32], ptr @u, i64 0, i64 %indvars.iv164
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = icmp sgt i32 %156, %167
  br i1 %168, label %.sink.split, label %169

.sink.split:                                      ; preds = %165, %160
  %.sink = phi i32 [ %162, %160 ], [ %167, %165 ]
  %.ph175 = phi i32 [ %158, %160 ], [ %155, %165 ]
  store i32 %.sink, ptr @pos, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %.sink.split, %165, %163
  %170 = phi i32 [ %156, %165 ], [ %156, %163 ], [ %.sink, %.sink.split ]
  %171 = phi i32 [ %155, %165 ], [ %155, %163 ], [ %.ph175, %.sink.split ]
  %indvars.iv.next165 = add nuw nsw i64 %indvars.iv164, 1
  %exitcond168.not = icmp eq i64 %indvars.iv.next165, %wide.trip.count167
  br i1 %exitcond168.not, label %._crit_edge129, label %.lr.ph128, !llvm.loop !30

._crit_edge133:                                   ; preds = %._crit_edge129, %0
  ret i32 0
}

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

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

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

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

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

attributes #0 = { mustprogress nofree norecurse nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !24, !25}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10, !25, !24}
!28 = distinct !{!28, !10}
!29 = distinct !{!29, !10}
!30 = distinct !{!30, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass