; LLVM IR from tangjz/acm-icpc :: codeforces/gym (103957L)

; 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
@tot = external dso_local global i32, align 4
@a = external dso_local global [1000001 x i32], align 16
@x = external dso_local global [1000001 x i32], align 16
@y = external dso_local global [1000001 x i32], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 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 [11 x i8], align 1
  %7 = alloca i8, align 1
  %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 i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %260, %0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr @t, align 4, !tbaa !5
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %263

25:                                               ; preds = %20
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %68, %25
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

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

33:                                               ; preds = %64, %32
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %67

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 11, ptr %6) #5
  %39 = getelementptr inbounds [11 x i8], ptr %6, i64 0, i64 0
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %39)
  %41 = getelementptr inbounds [11 x i8], ptr %6, i64 0, i64 0
  %42 = load i8, ptr %41, align 1, !tbaa !9
  %43 = sext i8 %42 to i32
  %44 = icmp eq i32 %43, 63
  br i1 %44, label %45, label %46

45:                                               ; preds = %38
  store i32 10, ptr %3, align 4
  br label %61

46:                                               ; preds = %38
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr @tot, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1000001 x i32], ptr @x, i64 0, i64 %49
  store i32 %47, ptr %50, align 4, !tbaa !5
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = load i32, ptr @tot, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1000001 x i32], ptr @y, i64 0, i64 %53
  store i32 %51, ptr %54, align 4, !tbaa !5
  %55 = getelementptr inbounds [11 x i8], ptr %6, i64 0, i64 0
  %56 = load i32, ptr @tot, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr @tot, align 4, !tbaa !5
  %58 = sext i32 %56 to i64
  %59 = getelementptr inbounds i32, ptr @a, i64 %58
  %60 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %55, ptr noundef @.str, ptr noundef %59) #5
  store i32 0, ptr %3, align 4
  br label %61

61:                                               ; preds = %46, %45
  call void @llvm.lifetime.end.p0(i64 11, ptr %6) #5
  %62 = load i32, ptr %3, align 4
  switch i32 %62, label %264 [
    i32 0, label %63
    i32 10, label %64
  ]

63:                                               ; preds = %61
  br label %64

64:                                               ; preds = %63, %61
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %5, align 4, !tbaa !5
  br label %33, !llvm.loop !10

67:                                               ; preds = %37
  br label %68

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

71:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  %72 = load i32, ptr @tot, align 4, !tbaa !5
  %73 = icmp ne i32 %72, 0
  %74 = xor i1 %73, true
  %75 = zext i1 %74 to i8
  store i8 %75, ptr %7, align 1, !tbaa !13
  %76 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %77 = trunc i8 %76 to i1
  br i1 %77, label %253, label %78

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

79:                                               ; preds = %248, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = mul nsw i32 %80, %81
  %83 = load i32, ptr @a, align 16, !tbaa !5
  %84 = icmp sle i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %79
  store i32 11, ptr %3, align 4
  br label %251

86:                                               ; preds = %79
  %87 = load i32, ptr @a, align 16, !tbaa !5
  %88 = load i32, ptr %8, align 4, !tbaa !5
  %89 = srem i32 %87, %88
  %90 = icmp sgt i32 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %86
  br label %248

92:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %93 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %93, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %94 = load i32, ptr @a, align 16, !tbaa !5
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sdiv i32 %94, %95
  store i32 %96, ptr %10, align 4, !tbaa !5
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = load i32, ptr @x, align 16, !tbaa !5
  %99 = sub nsw i32 %97, %98
  %100 = icmp sgt i32 %99, 0
  br i1 %100, label %101, label %170

101:                                              ; preds = %92
  %102 = load i32, ptr %10, align 4, !tbaa !5
  %103 = load i32, ptr @y, align 16, !tbaa !5
  %104 = sub nsw i32 %102, %103
  %105 = icmp sgt i32 %104, 0
  br i1 %105, label %106, label %170

106:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = load i32, ptr @x, align 16, !tbaa !5
  %109 = sub nsw i32 %107, %108
  store i32 %109, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = load i32, ptr @y, align 16, !tbaa !5
  %112 = sub nsw i32 %110, %111
  store i32 %112, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #5
  store i8 1, ptr %13, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %152, %106
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = load i32, ptr @tot, align 4, !tbaa !5
  %116 = icmp slt i32 %114, %115
  br i1 %116, label %117, label %120

117:                                              ; preds = %113
  %118 = load i8, ptr %13, align 1, !tbaa !13, !range !15, !noundef !16
  %119 = trunc i8 %118 to i1
  br label %120

120:                                              ; preds = %117, %113
  %121 = phi i1 [ false, %113 ], [ %119, %117 ]
  br i1 %121, label %123, label %122

122:                                              ; preds = %120
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %155

123:                                              ; preds = %120
  %124 = load i32, ptr %11, align 4, !tbaa !5
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000001 x i32], ptr @x, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = add nsw i32 %124, %128
  %130 = sext i32 %129 to i64
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = load i32, ptr %14, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [1000001 x i32], ptr @y, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = add nsw i32 %131, %135
  %137 = sext i32 %136 to i64
  %138 = mul nsw i64 %130, %137
  %139 = load i32, ptr %14, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = icmp eq i64 %138, %143
  %145 = zext i1 %144 to i32
  %146 = load i8, ptr %13, align 1, !tbaa !13, !range !15, !noundef !16
  %147 = trunc i8 %146 to i1
  %148 = zext i1 %147 to i32
  %149 = and i32 %148, %145
  %150 = icmp ne i32 %149, 0
  %151 = zext i1 %150 to i8
  store i8 %151, ptr %13, align 1, !tbaa !13
  br label %152

152:                                              ; preds = %123
  %153 = load i32, ptr %14, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %14, align 4, !tbaa !5
  br label %113, !llvm.loop !17

155:                                              ; preds = %122
  %156 = load i8, ptr %13, align 1, !tbaa !13, !range !15, !noundef !16
  %157 = trunc i8 %156 to i1
  %158 = zext i1 %157 to i32
  %159 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %160 = trunc i8 %159 to i1
  %161 = zext i1 %160 to i32
  %162 = or i32 %161, %158
  %163 = icmp ne i32 %162, 0
  %164 = zext i1 %163 to i8
  store i8 %164, ptr %7, align 1, !tbaa !13
  br i1 %163, label %165, label %166

165:                                              ; preds = %155
  store i32 11, ptr %3, align 4
  br label %167

166:                                              ; preds = %155
  store i32 0, ptr %3, align 4
  br label %167

167:                                              ; preds = %166, %165
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %168 = load i32, ptr %3, align 4
  switch i32 %168, label %245 [
    i32 0, label %169
  ]

169:                                              ; preds = %167
  br label %170

170:                                              ; preds = %169, %101, %92
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10) #5
  %171 = load i32, ptr %9, align 4, !tbaa !5
  %172 = load i32, ptr @x, align 16, !tbaa !5
  %173 = sub nsw i32 %171, %172
  %174 = icmp sgt i32 %173, 0
  br i1 %174, label %175, label %244

175:                                              ; preds = %170
  %176 = load i32, ptr %10, align 4, !tbaa !5
  %177 = load i32, ptr @y, align 16, !tbaa !5
  %178 = sub nsw i32 %176, %177
  %179 = icmp sgt i32 %178, 0
  br i1 %179, label %180, label %244

180:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %181 = load i32, ptr %9, align 4, !tbaa !5
  %182 = load i32, ptr @x, align 16, !tbaa !5
  %183 = sub nsw i32 %181, %182
  store i32 %183, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %184 = load i32, ptr %10, align 4, !tbaa !5
  %185 = load i32, ptr @y, align 16, !tbaa !5
  %186 = sub nsw i32 %184, %185
  store i32 %186, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #5
  store i8 1, ptr %17, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %187

187:                                              ; preds = %226, %180
  %188 = load i32, ptr %18, align 4, !tbaa !5
  %189 = load i32, ptr @tot, align 4, !tbaa !5
  %190 = icmp slt i32 %188, %189
  br i1 %190, label %191, label %194

191:                                              ; preds = %187
  %192 = load i8, ptr %17, align 1, !tbaa !13, !range !15, !noundef !16
  %193 = trunc i8 %192 to i1
  br label %194

194:                                              ; preds = %191, %187
  %195 = phi i1 [ false, %187 ], [ %193, %191 ]
  br i1 %195, label %197, label %196

196:                                              ; preds = %194
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %229

197:                                              ; preds = %194
  %198 = load i32, ptr %15, align 4, !tbaa !5
  %199 = load i32, ptr %18, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [1000001 x i32], ptr @x, i64 0, i64 %200
  %202 = load i32, ptr %201, align 4, !tbaa !5
  %203 = add nsw i32 %198, %202
  %204 = sext i32 %203 to i64
  %205 = load i32, ptr %16, align 4, !tbaa !5
  %206 = load i32, ptr %18, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [1000001 x i32], ptr @y, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = add nsw i32 %205, %209
  %211 = sext i32 %210 to i64
  %212 = mul nsw i64 %204, %211
  %213 = load i32, ptr %18, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = icmp eq i64 %212, %217
  %219 = zext i1 %218 to i32
  %220 = load i8, ptr %17, align 1, !tbaa !13, !range !15, !noundef !16
  %221 = trunc i8 %220 to i1
  %222 = zext i1 %221 to i32
  %223 = and i32 %222, %219
  %224 = icmp ne i32 %223, 0
  %225 = zext i1 %224 to i8
  store i8 %225, ptr %17, align 1, !tbaa !13
  br label %226

226:                                              ; preds = %197
  %227 = load i32, ptr %18, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr %18, align 4, !tbaa !5
  br label %187, !llvm.loop !18

229:                                              ; preds = %196
  %230 = load i8, ptr %17, align 1, !tbaa !13, !range !15, !noundef !16
  %231 = trunc i8 %230 to i1
  %232 = zext i1 %231 to i32
  %233 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %234 = trunc i8 %233 to i1
  %235 = zext i1 %234 to i32
  %236 = or i32 %235, %232
  %237 = icmp ne i32 %236, 0
  %238 = zext i1 %237 to i8
  store i8 %238, ptr %7, align 1, !tbaa !13
  br i1 %237, label %239, label %240

239:                                              ; preds = %229
  store i32 11, ptr %3, align 4
  br label %241

240:                                              ; preds = %229
  store i32 0, ptr %3, align 4
  br label %241

241:                                              ; preds = %240, %239
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %242 = load i32, ptr %3, align 4
  switch i32 %242, label %245 [
    i32 0, label %243
  ]

243:                                              ; preds = %241
  br label %244

244:                                              ; preds = %243, %175, %170
  store i32 0, ptr %3, align 4
  br label %245

245:                                              ; preds = %244, %241, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %246 = load i32, ptr %3, align 4
  switch i32 %246, label %251 [
    i32 0, label %247
  ]

247:                                              ; preds = %245
  br label %248

248:                                              ; preds = %247, %91
  %249 = load i32, ptr %8, align 4, !tbaa !5
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %8, align 4, !tbaa !5
  br label %79, !llvm.loop !19

251:                                              ; preds = %245, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252, %71
  %254 = load i32, ptr %2, align 4, !tbaa !5
  %255 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %256 = trunc i8 %255 to i1
  %257 = zext i1 %256 to i64
  %258 = select i1 %256, ptr @.str.4, ptr @.str.5
  %259 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %254, ptr noundef %258)
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %260

260:                                              ; preds = %253
  %261 = load i32, ptr %2, align 4, !tbaa !5
  %262 = add nsw i32 %261, 1
  store i32 %262, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !20

263:                                              ; preds = %24
  ret i32 0

264:                                              ; preds = %61
  unreachable
}

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

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

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #3

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

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

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}


; 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
@tot = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [1000001 x i32], align 16
@x = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@y = external dso_local local_unnamed_addr global [1000001 x i32], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [11 x i8], align 1
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %.not88 = icmp slt i32 %5, 1
  br i1 %.not88, label %._crit_edge92, label %.lr.ph91

._crit_edge92:                                    ; preds = %.loopexit, %0
  ret i32 0

.lr.ph91:                                         ; preds = %0, %.loopexit
  %.04589 = phi i32 [ %97, %.loopexit ], [ 1, %0 ]
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  store i32 0, ptr @tot, align 4, !tbaa !5
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  %9 = load i32, ptr @m, align 4
  %10 = icmp sgt i32 %9, 0
  %or.cond = select i1 %8, i1 %10, i1 false
  br i1 %or.cond, label %.preheader73, label %.loopexit

.preheader73:                                     ; preds = %.lr.ph91, %._crit_edge
  %11 = phi i32 [ %15, %._crit_edge ], [ %7, %.lr.ph91 ]
  %12 = phi i32 [ %16, %._crit_edge ], [ %9, %.lr.ph91 ]
  %.04976 = phi i32 [ %17, %._crit_edge ], [ 0, %.lr.ph91 ]
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge77:                                    ; preds = %._crit_edge
  %.pre99 = load i32, ptr @tot, align 4, !tbaa !5
  %.not60 = icmp eq i32 %.pre99, 0
  br i1 %.not60, label %.loopexit, label %.preheader74

.preheader74:                                     ; preds = %._crit_edge77
  %14 = load i32, ptr @a, align 16, !tbaa !5
  %.not6185 = icmp slt i32 %14, 1
  br i1 %.not6185, label %.loopexit, label %.lr.ph87

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader73
  %15 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %11, %.preheader73 ]
  %16 = phi i32 [ %32, %._crit_edge.loopexit ], [ %12, %.preheader73 ]
  %17 = add nuw nsw i32 %.04976, 1
  %18 = icmp slt i32 %17, %15
  br i1 %18, label %.preheader73, label %._crit_edge77, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader73, %30
  %.05075 = phi i32 [ %31, %30 ], [ 0, %.preheader73 ]
  call void @llvm.lifetime.start.p0(i64 11, ptr nonnull %1) #4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  %20 = load i8, ptr %1, align 1, !tbaa !12
  %21 = icmp eq i8 %20, 63
  br i1 %21, label %30, label %22

22:                                               ; preds = %.lr.ph
  %23 = load i32, ptr @tot, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000001 x i32], ptr @x, i64 0, i64 %24
  store i32 %.04976, ptr %25, align 4, !tbaa !5
  %26 = getelementptr inbounds [1000001 x i32], ptr @y, i64 0, i64 %24
  store i32 %.05075, ptr %26, align 4, !tbaa !5
  %27 = add nsw i32 %23, 1
  store i32 %27, ptr @tot, align 4, !tbaa !5
  %28 = getelementptr inbounds i32, ptr @a, i64 %24
  %29 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %1, ptr noundef nonnull @.str, ptr noundef nonnull %28) #4
  br label %30

30:                                               ; preds = %.lr.ph, %22
  call void @llvm.lifetime.end.p0(i64 11, ptr nonnull %1) #4
  %31 = add nuw nsw i32 %.05075, 1
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !13

.lr.ph87:                                         ; preds = %.preheader74, %92
  %34 = phi i32 [ %93, %92 ], [ %14, %.preheader74 ]
  %.05186 = phi i32 [ %94, %92 ], [ 1, %.preheader74 ]
  %35 = srem i32 %34, %.05186
  %36 = sdiv i32 %34, %.05186
  %37 = icmp sgt i32 %35, 0
  br i1 %37, label %92, label %38

38:                                               ; preds = %.lr.ph87
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  store i32 %.05186, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store i32 %36, ptr %3, align 4, !tbaa !5
  %39 = load i32, ptr @x, align 16, !tbaa !5
  %40 = sub nsw i32 %.05186, %39
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %42, label %64

42:                                               ; preds = %38
  %43 = load i32, ptr @y, align 16, !tbaa !5
  %44 = sub nsw i32 %36, %43
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.preheader72, label %64

.preheader72:                                     ; preds = %42
  %46 = load i32, ptr @tot, align 4, !tbaa !5
  %47 = icmp sgt i32 %46, 1
  br i1 %47, label %.lr.ph79.preheader, label %.critedge

.lr.ph79.preheader:                               ; preds = %.preheader72
  %48 = zext nneg i32 %46 to i64
  br label %.lr.ph79

._crit_edge80:                                    ; preds = %.lr.ph79
  br i1 %61, label %.critedge, label %64

.lr.ph79:                                         ; preds = %.lr.ph79.preheader, %.lr.ph79
  %indvars.iv = phi i64 [ 1, %.lr.ph79.preheader ], [ %indvars.iv.next, %.lr.ph79 ]
  %49 = getelementptr inbounds [1000001 x i32], ptr @x, i64 0, i64 %indvars.iv
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, %40
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000001 x i32], ptr @y, i64 0, i64 %indvars.iv
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, %44
  %56 = sext i32 %55 to i64
  %57 = mul nsw i64 %56, %52
  %58 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %indvars.iv
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp eq i64 %57, %60
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %62 = icmp ult i64 %indvars.iv.next, %48
  %63 = select i1 %62, i1 %61, i1 false
  br i1 %63, label %.lr.ph79, label %._crit_edge80, !llvm.loop !14

64:                                               ; preds = %._crit_edge80, %42, %38
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #4
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = load i32, ptr @x, align 16, !tbaa !5
  %67 = sub nsw i32 %65, %66
  %68 = icmp sgt i32 %67, 0
  br i1 %68, label %69, label %.thread

69:                                               ; preds = %64
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = load i32, ptr @y, align 16, !tbaa !5
  %72 = sub nsw i32 %70, %71
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.preheader, label %.thread

.preheader:                                       ; preds = %69
  %74 = load i32, ptr @tot, align 4, !tbaa !5
  %75 = icmp sgt i32 %74, 1
  br i1 %75, label %.lr.ph82.preheader, label %.thread68

.lr.ph82.preheader:                               ; preds = %.preheader
  %76 = zext nneg i32 %74 to i64
  br label %.lr.ph82

._crit_edge83:                                    ; preds = %.lr.ph82
  br i1 %89, label %.thread68, label %.thread

.thread68:                                        ; preds = %.preheader, %._crit_edge83
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  br label %.loopexit

.lr.ph82:                                         ; preds = %.lr.ph82.preheader, %.lr.ph82
  %indvars.iv96 = phi i64 [ 1, %.lr.ph82.preheader ], [ %indvars.iv.next97, %.lr.ph82 ]
  %77 = getelementptr inbounds [1000001 x i32], ptr @x, i64 0, i64 %indvars.iv96
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %78, %67
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1000001 x i32], ptr @y, i64 0, i64 %indvars.iv96
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = add nsw i32 %82, %72
  %84 = sext i32 %83 to i64
  %85 = mul nsw i64 %84, %80
  %86 = getelementptr inbounds [1000001 x i32], ptr @a, i64 0, i64 %indvars.iv96
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = icmp eq i64 %85, %88
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %90 = icmp ult i64 %indvars.iv.next97, %76
  %91 = select i1 %90, i1 %89, i1 false
  br i1 %91, label %.lr.ph82, label %._crit_edge83, !llvm.loop !15

.thread:                                          ; preds = %69, %64, %._crit_edge83
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %.pre100 = load i32, ptr @a, align 16, !tbaa !5
  br label %92

.critedge:                                        ; preds = %.preheader72, %._crit_edge80
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  br label %.loopexit

92:                                               ; preds = %.thread, %.lr.ph87
  %93 = phi i32 [ %.pre100, %.thread ], [ %34, %.lr.ph87 ]
  %94 = add nuw nsw i32 %.05186, 1
  %95 = mul nuw nsw i32 %94, %94
  %.not61 = icmp sgt i32 %95, %93
  br i1 %.not61, label %.loopexit, label %.lr.ph87, !llvm.loop !16

.loopexit:                                        ; preds = %92, %.lr.ph91, %.preheader74, %.critedge, %.thread68, %._crit_edge77
  %.6 = phi ptr [ @.str.4, %._crit_edge77 ], [ @.str.4, %.critedge ], [ @.str.4, %.thread68 ], [ @.str.5, %.preheader74 ], [ @.str.4, %.lr.ph91 ], [ @.str.5, %92 ]
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.04589, ptr noundef nonnull %.6)
  %97 = add nuw nsw i32 %.04589, 1
  %98 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04589, %98
  br i1 %.not.not, label %.lr.ph91, label %._crit_edge92, !llvm.loop !17
}

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

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

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

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

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

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

attributes #0 = { mustprogress 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass