; LLVM IR from tangjz/acm-icpc :: lydsy (2231)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@len = external dso_local global i32, align 4
@num = external dso_local global [110 x i32], align 16
@cnt = external dso_local global [2 x [96100 x i32]], align 16
@nxt = external dso_local global [2 x [96100 x i32]], align 16
@perm = external dso_local global [96100 x i32], align 16
@pos = external dso_local global [96100 x i32], align 16
@ans = external dso_local global [96100 x i32], align 16
@tran = external dso_local global [310 x [311 x i8]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9divAndModi(i32 noundef) #0

; 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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9transformiPi(i32 noundef, ptr noundef) #2

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %15

15:                                               ; preds = %293, %0
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @tran)
  %17 = icmp eq i32 %16, 3
  br i1 %17, label %18, label %294

18:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #9
  %19 = call i64 @strlen(ptr noundef @tran) #10
  %20 = trunc i64 %19 to i32
  store i32 %20, ptr %2, align 4, !tbaa !5
  store i32 0, ptr @len, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  %21 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %21, ptr %3, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %47, %18
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #9
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 9
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  br label %34

31:                                               ; preds = %26
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sub nsw i32 %32, 9
  br label %34

34:                                               ; preds = %31, %30
  %35 = phi i32 [ 0, %30 ], [ %33, %31 ]
  store i32 %35, ptr %4, align 4, !tbaa !5
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [311 x i8], ptr @tran, i64 0, i64 %37
  store i8 0, ptr %38, align 1, !tbaa !9
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i8, ptr @tran, i64 %40
  %42 = load i32, ptr @len, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr @len, align 4, !tbaa !5
  %44 = sext i32 %42 to i64
  %45 = getelementptr inbounds i32, ptr @num, i64 %44
  %46 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %41, ptr noundef @.str.1, ptr noundef %45) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #9
  br label %47

47:                                               ; preds = %34
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sub nsw i32 %48, 9
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %22, !llvm.loop !10

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

51:                                               ; preds = %63, %50
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  %55 = icmp slt i32 %52, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  br label %66

57:                                               ; preds = %51
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [310 x [311 x i8]], ptr @tran, i64 0, i64 %59
  %61 = getelementptr inbounds [311 x i8], ptr %60, i64 0, i64 0
  %62 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %61)
  br label %63

63:                                               ; preds = %57
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %5, align 4, !tbaa !5
  br label %51, !llvm.loop !12

66:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = sub nsw i32 %69, 1
  %71 = mul nsw i32 %68, %70
  %72 = call noundef i32 @_Z9divAndModi(i32 noundef %71)
  store i32 %72, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %85, %66
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = load i32, ptr @m, align 4, !tbaa !5
  %77 = mul nsw i32 %75, %76
  %78 = icmp slt i32 %74, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  br label %88

80:                                               ; preds = %73
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %83
  store i32 %81, ptr %84, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %80
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %7, align 4, !tbaa !5
  br label %73, !llvm.loop !13

88:                                               ; preds = %79
  call void @llvm.memset.p0.i64(ptr align 16 @ans, i8 0, i64 384400, i1 false)
  %89 = load i32, ptr @len, align 4, !tbaa !5
  %90 = icmp sgt i32 %89, 1
  br i1 %90, label %94, label %91

91:                                               ; preds = %88
  %92 = load i32, ptr @num, align 16, !tbaa !5
  %93 = icmp sgt i32 %92, 0
  br i1 %93, label %94, label %275

94:                                               ; preds = %91, %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 1, ptr %9, align 4, !tbaa !5
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %96
  %98 = getelementptr inbounds [96100 x i32], ptr %97, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %98, i8 0, i64 384400, i1 false)
  %99 = load i32, ptr @n, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = load i32, ptr @m, align 4, !tbaa !5
  %102 = sub nsw i32 %101, 1
  %103 = mul nsw i32 %100, %102
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %105
  %107 = getelementptr inbounds [96100 x i32], ptr %106, i64 0, i64 0
  call void @_Z9transformiPi(i32 noundef %103, ptr noundef %107)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %130, %94
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = load i32, ptr @m, align 4, !tbaa !5
  %112 = mul nsw i32 %110, %111
  %113 = icmp slt i32 %109, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  br label %133

115:                                              ; preds = %108
  %116 = load i32, ptr %10, align 4, !tbaa !5
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %118
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [96100 x i32], ptr %119, i64 0, i64 %124
  store i32 %116, ptr %125, align 4, !tbaa !5
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %128
  store i32 %126, ptr %129, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %115
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %10, align 4, !tbaa !5
  br label %108, !llvm.loop !14

133:                                              ; preds = %114
  br label %134

134:                                              ; preds = %253, %133
  %135 = load i32, ptr @len, align 4, !tbaa !5
  %136 = icmp sgt i32 %135, 1
  br i1 %136, label %140, label %137

137:                                              ; preds = %134
  %138 = load i32, ptr @num, align 16, !tbaa !5
  %139 = icmp sgt i32 %138, 0
  br label %140

140:                                              ; preds = %137, %134
  %141 = phi i1 [ true, %134 ], [ %139, %137 ]
  br i1 %141, label %142, label %255

142:                                              ; preds = %140
  %143 = load i32, ptr @num, align 16, !tbaa !5
  %144 = and i32 %143, 1
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %185

146:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %147

147:                                              ; preds = %181, %146
  %148 = load i32, ptr %11, align 4, !tbaa !5
  %149 = load i32, ptr @n, align 4, !tbaa !5
  %150 = load i32, ptr @m, align 4, !tbaa !5
  %151 = mul nsw i32 %149, %150
  %152 = icmp slt i32 %148, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %147
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  br label %184

154:                                              ; preds = %147
  %155 = load i32, ptr %11, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [96100 x i32], ptr @ans, i64 0, i64 %156
  %158 = load i32, ptr %8, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %159
  %161 = load i32, ptr %11, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [96100 x i32], ptr %160, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %157, i32 noundef %167)
  %168 = load i32, ptr %8, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %169
  %171 = load i32, ptr %11, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [96100 x i32], ptr %170, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = load i32, ptr %11, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %179
  store i32 %177, ptr %180, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %154
  %182 = load i32, ptr %11, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %11, align 4, !tbaa !5
  br label %147, !llvm.loop !15

184:                                              ; preds = %153
  br label %185

185:                                              ; preds = %184, %142
  %186 = load i32, ptr %8, align 4, !tbaa !5
  %187 = xor i32 %186, 1
  store i32 %187, ptr %8, align 4, !tbaa !5
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = xor i32 %188, 1
  store i32 %189, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %249, %185
  %191 = load i32, ptr %12, align 4, !tbaa !5
  %192 = load i32, ptr @n, align 4, !tbaa !5
  %193 = load i32, ptr @m, align 4, !tbaa !5
  %194 = mul nsw i32 %192, %193
  %195 = icmp slt i32 %191, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %252

197:                                              ; preds = %190
  %198 = load i32, ptr %9, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %199
  %201 = load i32, ptr %12, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [96100 x i32], ptr %200, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = load i32, ptr %8, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %206
  %208 = load i32, ptr %12, align 4, !tbaa !5
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [96100 x i32], ptr %207, i64 0, i64 %209
  store i32 %204, ptr %210, align 4, !tbaa !5
  %211 = load i32, ptr %8, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %212
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [96100 x i32], ptr %213, i64 0, i64 %215
  %217 = load i32, ptr %9, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %218
  %220 = load i32, ptr %9, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %221
  %223 = load i32, ptr %12, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [96100 x i32], ptr %222, i64 0, i64 %224
  %226 = load i32, ptr %225, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [96100 x i32], ptr %219, i64 0, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %216, i32 noundef %229)
  %230 = load i32, ptr %9, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %231
  %233 = load i32, ptr %9, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %234
  %236 = load i32, ptr %12, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [96100 x i32], ptr %235, i64 0, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [96100 x i32], ptr %232, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !5
  %243 = load i32, ptr %8, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %244
  %246 = load i32, ptr %12, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [96100 x i32], ptr %245, i64 0, i64 %247
  store i32 %242, ptr %248, align 4, !tbaa !5
  br label %249

249:                                              ; preds = %197
  %250 = load i32, ptr %12, align 4, !tbaa !5
  %251 = add nsw i32 %250, 1
  store i32 %251, ptr %12, align 4, !tbaa !5
  br label %190, !llvm.loop !16

252:                                              ; preds = %196
  br label %253

253:                                              ; preds = %252
  %254 = call noundef i32 @_Z9divAndModi(i32 noundef 2)
  br label %134, !llvm.loop !17

255:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %256

256:                                              ; preds = %271, %255
  %257 = load i32, ptr %13, align 4, !tbaa !5
  %258 = load i32, ptr @n, align 4, !tbaa !5
  %259 = load i32, ptr @m, align 4, !tbaa !5
  %260 = mul nsw i32 %258, %259
  %261 = icmp slt i32 %257, %260
  br i1 %261, label %263, label %262

262:                                              ; preds = %256
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %274

263:                                              ; preds = %256
  %264 = load i32, ptr %13, align 4, !tbaa !5
  %265 = load i32, ptr %13, align 4, !tbaa !5
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !5
  %269 = sext i32 %268 to i64
  %270 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %269
  store i32 %264, ptr %270, align 4, !tbaa !5
  br label %271

271:                                              ; preds = %263
  %272 = load i32, ptr %13, align 4, !tbaa !5
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %13, align 4, !tbaa !5
  br label %256, !llvm.loop !18

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

275:                                              ; preds = %274, %91
  %276 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z9transformiPi(i32 noundef %276, ptr noundef @ans)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %277

277:                                              ; preds = %290, %275
  %278 = load i32, ptr %14, align 4, !tbaa !5
  %279 = load i32, ptr @n, align 4, !tbaa !5
  %280 = load i32, ptr @m, align 4, !tbaa !5
  %281 = mul nsw i32 %279, %280
  %282 = icmp slt i32 %278, %281
  br i1 %282, label %284, label %283

283:                                              ; preds = %277
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %293

284:                                              ; preds = %277
  %285 = load i32, ptr %14, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [96100 x i32], ptr @ans, i64 0, i64 %286
  %288 = load i32, ptr %287, align 4, !tbaa !5
  %289 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %288)
  br label %290

290:                                              ; preds = %284
  %291 = load i32, ptr %14, align 4, !tbaa !5
  %292 = add nsw i32 %291, 1
  store i32 %292, ptr %14, align 4, !tbaa !5
  br label %277, !llvm.loop !19

293:                                              ; preds = %283
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %15, !llvm.loop !20

294:                                              ; preds = %15
  ret i32 0
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

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

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

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

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

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@len = external dso_local local_unnamed_addr global i32, align 4
@num = external dso_local global [110 x i32], align 16
@cnt = external dso_local global [2 x [96100 x i32]], align 16
@nxt = external dso_local local_unnamed_addr global [2 x [96100 x i32]], align 16
@perm = external dso_local local_unnamed_addr global [96100 x i32], align 16
@pos = external dso_local local_unnamed_addr global [96100 x i32], align 16
@ans = external dso_local global [96100 x i32], align 16
@tran = external dso_local global [310 x [311 x i8]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9transformiPi(i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @tran)
  %2 = icmp eq i32 %1, 3
  br i1 %2, label %.lr.ph103, label %._crit_edge104

.loopexit68:                                      ; preds = %.lr.ph101, %.loopexit70
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @tran)
  %4 = icmp eq i32 %3, 3
  br i1 %4, label %.lr.ph103, label %._crit_edge104, !llvm.loop !5

.lr.ph103:                                        ; preds = %0, %.loopexit68
  %5 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @tran) #8
  %6 = trunc i64 %5 to i32
  store i32 0, ptr @len, align 4, !tbaa !7
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph.preheader, label %.preheader72

.lr.ph.preheader:                                 ; preds = %.lr.ph103
  %8 = and i64 %5, 2147483647
  br label %.lr.ph

.preheader72:                                     ; preds = %.lr.ph, %.lr.ph103
  %9 = load i32, ptr @n, align 4, !tbaa !7
  %10 = add nsw i32 %9, -1
  %11 = icmp sgt i32 %9, 1
  br i1 %11, label %.lr.ph77, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %8, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -9
  %12 = trunc nsw i64 %indvars.iv.next to i32
  %13 = tail call i32 @llvm.smax.i32(i32 %12, i32 0)
  %14 = getelementptr inbounds [311 x i8], ptr @tran, i64 0, i64 %indvars.iv
  store i8 0, ptr %14, align 1, !tbaa !11
  %15 = zext nneg i32 %13 to i64
  %16 = getelementptr inbounds i8, ptr @tran, i64 %15
  %17 = load i32, ptr @len, align 4, !tbaa !7
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr @len, align 4, !tbaa !7
  %19 = sext i32 %17 to i64
  %20 = getelementptr inbounds i32, ptr @num, i64 %19
  %21 = tail call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %16, ptr noundef nonnull @.str.1, ptr noundef nonnull %20) #9
  %22 = icmp ugt i64 %indvars.iv, 9
  br i1 %22, label %.lr.ph, label %.preheader72, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph77, %.preheader72
  %.lcssa = phi i32 [ %10, %.preheader72 ], [ %37, %.lr.ph77 ]
  %23 = load i32, ptr @m, align 4, !tbaa !7
  %24 = add nsw i32 %23, -1
  %25 = mul nsw i32 %24, %.lcssa
  %26 = tail call noundef i32 @_Z9divAndModi(i32 noundef %25)
  %27 = load i32, ptr @n, align 4, !tbaa !7
  %28 = load i32, ptr @m, align 4, !tbaa !7
  %29 = mul nsw i32 %28, %27
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph80.preheader, label %._crit_edge81

.lr.ph80.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %29 to i64
  %min.iters.check = icmp ult i32 %29, 8
  br i1 %min.iters.check, label %.lr.ph80.preheader144, label %vector.ph

.lr.ph80.preheader144:                            ; preds = %middle.block, %.lr.ph80.preheader
  %indvars.iv110.ph = phi i64 [ 0, %.lr.ph80.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph80

vector.ph:                                        ; preds = %.lr.ph80.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %31 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %index
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  store <4 x i32> %vec.ind, ptr %31, align 16, !tbaa !7
  store <4 x i32> %step.add, ptr %32, align 16, !tbaa !7
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %33 = icmp eq i64 %index.next, %n.vec
  br i1 %33, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge81, label %.lr.ph80.preheader144

.lr.ph77:                                         ; preds = %.preheader72, %.lr.ph77
  %indvars.iv107 = phi i64 [ %indvars.iv.next108, %.lr.ph77 ], [ 0, %.preheader72 ]
  %34 = getelementptr inbounds [310 x [311 x i8]], ptr @tran, i64 0, i64 %indvars.iv107
  %35 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %34)
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %36 = load i32, ptr @n, align 4, !tbaa !7
  %37 = add nsw i32 %36, -1
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next108, %38
  br i1 %39, label %.lr.ph77, label %._crit_edge, !llvm.loop !16

._crit_edge81:                                    ; preds = %.lr.ph80, %middle.block, %._crit_edge
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(384400) @ans, i8 0, i64 384400, i1 false)
  %40 = load i32, ptr @len, align 4, !tbaa !7
  %41 = icmp sgt i32 %40, 1
  %42 = load i32, ptr @num, align 16
  %43 = icmp sgt i32 %42, 0
  %or.cond = select i1 %41, i1 true, i1 %43
  br i1 %or.cond, label %46, label %.loopexit70

.lr.ph80:                                         ; preds = %.lr.ph80.preheader144, %.lr.ph80
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %.lr.ph80 ], [ %indvars.iv110.ph, %.lr.ph80.preheader144 ]
  %44 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv110
  %45 = trunc nuw nsw i64 %indvars.iv110 to i32
  store i32 %45, ptr %44, align 4, !tbaa !7
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next111, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge81, label %.lr.ph80, !llvm.loop !17

46:                                               ; preds = %._crit_edge81
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(384400) @cnt, i8 0, i64 384400, i1 false)
  %47 = add nsw i32 %27, -1
  %48 = add nsw i32 %28, -1
  %49 = mul nsw i32 %48, %47
  tail call void @_Z9transformiPi(i32 noundef %49, ptr noundef nonnull @cnt)
  %50 = load i32, ptr @n, align 4, !tbaa !7
  %51 = load i32, ptr @m, align 4, !tbaa !7
  %52 = mul nsw i32 %51, %50
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph86.preheader, label %.preheader71

.lr.ph86.preheader:                               ; preds = %46
  %wide.trip.count116 = zext nneg i32 %52 to i64
  %xtraiter = and i64 %wide.trip.count116, 3
  %54 = icmp ult i32 %52, 4
  br i1 %54, label %.preheader71.loopexit.unr-lcssa, label %.lr.ph86.preheader.new

.lr.ph86.preheader.new:                           ; preds = %.lr.ph86.preheader
  %unroll_iter = and i64 %wide.trip.count116, 2147483644
  br label %.lr.ph86

.preheader71.loopexit.unr-lcssa:                  ; preds = %.lr.ph86, %.lr.ph86.preheader
  %indvars.iv113.unr = phi i64 [ 0, %.lr.ph86.preheader ], [ %indvars.iv.next114.3, %.lr.ph86 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader71, label %.lr.ph86.epil

.lr.ph86.epil:                                    ; preds = %.preheader71.loopexit.unr-lcssa, %.lr.ph86.epil
  %indvars.iv113.epil = phi i64 [ %indvars.iv.next114.epil, %.lr.ph86.epil ], [ %indvars.iv113.unr, %.preheader71.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph86.epil ], [ 0, %.preheader71.loopexit.unr-lcssa ]
  %55 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv113.epil
  %56 = load i32, ptr %55, align 4, !tbaa !7
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %57
  %59 = trunc nuw nsw i64 %indvars.iv113.epil to i32
  store i32 %59, ptr %58, align 4, !tbaa !7
  %60 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv113.epil
  store i32 %59, ptr %60, align 4, !tbaa !7
  %indvars.iv.next114.epil = add nuw nsw i64 %indvars.iv113.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 %.preheader71, label %.lr.ph86.epil, !llvm.loop !18

.preheader71:                                     ; preds = %.preheader71.loopexit.unr-lcssa, %.lr.ph86.epil, %46
  %61 = load i32, ptr @len, align 4, !tbaa !7
  %62 = icmp sgt i32 %61, 1
  %63 = load i32, ptr @num, align 16
  %64 = icmp sgt i32 %63, 0
  %65 = select i1 %62, i1 true, i1 %64
  br i1 %65, label %.lr.ph96, label %.preheader69

.lr.ph86:                                         ; preds = %.lr.ph86, %.lr.ph86.preheader.new
  %indvars.iv113 = phi i64 [ 0, %.lr.ph86.preheader.new ], [ %indvars.iv.next114.3, %.lr.ph86 ]
  %niter = phi i64 [ 0, %.lr.ph86.preheader.new ], [ %niter.next.3, %.lr.ph86 ]
  %66 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv113
  %67 = load i32, ptr %66, align 16, !tbaa !7
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %68
  %70 = trunc nuw nsw i64 %indvars.iv113 to i32
  store i32 %70, ptr %69, align 4, !tbaa !7
  %71 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv113
  store i32 %70, ptr %71, align 16, !tbaa !7
  %indvars.iv.next114 = or disjoint i64 %indvars.iv113, 1
  %72 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv.next114
  %73 = load i32, ptr %72, align 4, !tbaa !7
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %74
  %76 = trunc nuw nsw i64 %indvars.iv.next114 to i32
  store i32 %76, ptr %75, align 4, !tbaa !7
  %77 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next114
  store i32 %76, ptr %77, align 4, !tbaa !7
  %indvars.iv.next114.1 = or disjoint i64 %indvars.iv113, 2
  %78 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv.next114.1
  %79 = load i32, ptr %78, align 8, !tbaa !7
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %80
  %82 = trunc nuw nsw i64 %indvars.iv.next114.1 to i32
  store i32 %82, ptr %81, align 4, !tbaa !7
  %83 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next114.1
  store i32 %82, ptr %83, align 8, !tbaa !7
  %indvars.iv.next114.2 = or disjoint i64 %indvars.iv113, 3
  %84 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv.next114.2
  %85 = load i32, ptr %84, align 4, !tbaa !7
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %86
  %88 = trunc nuw nsw i64 %indvars.iv.next114.2 to i32
  store i32 %88, ptr %87, align 4, !tbaa !7
  %89 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next114.2
  store i32 %88, ptr %89, align 4, !tbaa !7
  %indvars.iv.next114.3 = add nuw nsw i64 %indvars.iv113, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader71.loopexit.unr-lcssa, label %.lr.ph86, !llvm.loop !20

.preheader69.loopexit:                            ; preds = %._crit_edge92
  %.pre133 = load i32, ptr @n, align 4, !tbaa !7
  %.pre134 = load i32, ptr @m, align 4, !tbaa !7
  %.pre135 = mul nsw i32 %.pre134, %.pre133
  br label %.preheader69

.preheader69:                                     ; preds = %.preheader69.loopexit, %.preheader71
  %.pre-phi = phi i32 [ %.pre135, %.preheader69.loopexit ], [ %52, %.preheader71 ]
  %90 = icmp sgt i32 %.pre-phi, 0
  br i1 %90, label %.lr.ph98.preheader, label %.loopexit70

.lr.ph98.preheader:                               ; preds = %.preheader69
  %wide.trip.count127 = zext nneg i32 %.pre-phi to i64
  %xtraiter147 = and i64 %wide.trip.count127, 3
  %91 = icmp ult i32 %.pre-phi, 4
  br i1 %91, label %.loopexit70.loopexit.unr-lcssa, label %.lr.ph98.preheader.new

.lr.ph98.preheader.new:                           ; preds = %.lr.ph98.preheader
  %unroll_iter150 = and i64 %wide.trip.count127, 2147483644
  br label %.lr.ph98

.lr.ph96:                                         ; preds = %.preheader71, %._crit_edge92
  %92 = phi i32 [ %124, %._crit_edge92 ], [ %63, %.preheader71 ]
  %.06295 = phi i32 [ %119, %._crit_edge92 ], [ 1, %.preheader71 ]
  %.06393 = phi i32 [ %120, %._crit_edge92 ], [ 0, %.preheader71 ]
  %93 = and i32 %92, 1
  %.not = icmp eq i32 %93, 0
  %.pre = load i32, ptr @n, align 4, !tbaa !7
  %.pre132 = load i32, ptr @m, align 4, !tbaa !7
  %.pre136 = mul nsw i32 %.pre132, %.pre
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.lr.ph96
  %94 = icmp sgt i32 %.pre136, 0
  br i1 %94, label %.lr.ph88, label %.loopexit.thread

.loopexit.thread:                                 ; preds = %.preheader
  %95 = xor i32 %.06393, 1
  %96 = xor i32 %.06295, 1
  br label %._crit_edge92

.lr.ph88:                                         ; preds = %.preheader
  %97 = zext nneg i32 %.06393 to i64
  br label %98

98:                                               ; preds = %.lr.ph88, %98
  %indvars.iv118 = phi i64 [ 0, %.lr.ph88 ], [ %indvars.iv.next119, %98 ]
  %99 = getelementptr inbounds [96100 x i32], ptr @ans, i64 0, i64 %indvars.iv118
  %100 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv118
  %101 = load i32, ptr %100, align 4, !tbaa !7
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %97, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !7
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %99, i32 noundef %104)
  %105 = load i32, ptr %100, align 4, !tbaa !7
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %97, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !7
  store i32 %108, ptr %100, align 4, !tbaa !7
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %109 = load i32, ptr @n, align 4, !tbaa !7
  %110 = load i32, ptr @m, align 4, !tbaa !7
  %111 = mul nsw i32 %110, %109
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next119, %112
  br i1 %113, label %98, label %.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %98, %.lr.ph96
  %.pre-phi137 = phi i32 [ %.pre136, %.lr.ph96 ], [ %111, %98 ]
  %114 = xor i32 %.06393, 1
  %115 = xor i32 %.06295, 1
  %116 = icmp sgt i32 %.pre-phi137, 0
  br i1 %116, label %.lr.ph91, label %._crit_edge92

.lr.ph91:                                         ; preds = %.loopexit
  %117 = zext nneg i32 %115 to i64
  %118 = zext nneg i32 %114 to i64
  br label %127

._crit_edge92:                                    ; preds = %127, %.loopexit.thread, %.loopexit
  %119 = phi i32 [ %96, %.loopexit.thread ], [ %115, %.loopexit ], [ %115, %127 ]
  %120 = phi i32 [ %95, %.loopexit.thread ], [ %114, %.loopexit ], [ %114, %127 ]
  %121 = tail call noundef i32 @_Z9divAndModi(i32 noundef 2)
  %122 = load i32, ptr @len, align 4, !tbaa !7
  %123 = icmp sgt i32 %122, 1
  %124 = load i32, ptr @num, align 16
  %125 = icmp sgt i32 %124, 0
  %126 = select i1 %123, i1 true, i1 %125
  br i1 %126, label %.lr.ph96, label %.preheader69.loopexit, !llvm.loop !22

127:                                              ; preds = %.lr.ph91, %127
  %indvars.iv121 = phi i64 [ 0, %.lr.ph91 ], [ %indvars.iv.next122, %127 ]
  %128 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %117, i64 %indvars.iv121
  %129 = load i32, ptr %128, align 4, !tbaa !7
  %130 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %118, i64 %indvars.iv121
  store i32 %129, ptr %130, align 4, !tbaa !7
  %131 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %117, i64 %indvars.iv121
  %132 = load i32, ptr %131, align 4, !tbaa !7
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %117, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !7
  tail call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %130, i32 noundef %135)
  %136 = load i32, ptr %131, align 4, !tbaa !7
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %117, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !7
  %140 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %118, i64 %indvars.iv121
  store i32 %139, ptr %140, align 4, !tbaa !7
  %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
  %141 = load i32, ptr @n, align 4, !tbaa !7
  %142 = load i32, ptr @m, align 4, !tbaa !7
  %143 = mul nsw i32 %142, %141
  %144 = sext i32 %143 to i64
  %145 = icmp slt i64 %indvars.iv.next122, %144
  br i1 %145, label %127, label %._crit_edge92, !llvm.loop !23

.lr.ph98:                                         ; preds = %.lr.ph98, %.lr.ph98.preheader.new
  %indvars.iv124 = phi i64 [ 0, %.lr.ph98.preheader.new ], [ %indvars.iv.next125.3, %.lr.ph98 ]
  %niter151 = phi i64 [ 0, %.lr.ph98.preheader.new ], [ %niter151.next.3, %.lr.ph98 ]
  %146 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv124
  %147 = load i32, ptr %146, align 16, !tbaa !7
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %148
  %150 = trunc nuw nsw i64 %indvars.iv124 to i32
  store i32 %150, ptr %149, align 4, !tbaa !7
  %indvars.iv.next125 = or disjoint i64 %indvars.iv124, 1
  %151 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next125
  %152 = load i32, ptr %151, align 4, !tbaa !7
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %153
  %155 = trunc nuw nsw i64 %indvars.iv.next125 to i32
  store i32 %155, ptr %154, align 4, !tbaa !7
  %indvars.iv.next125.1 = or disjoint i64 %indvars.iv124, 2
  %156 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next125.1
  %157 = load i32, ptr %156, align 8, !tbaa !7
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %158
  %160 = trunc nuw nsw i64 %indvars.iv.next125.1 to i32
  store i32 %160, ptr %159, align 4, !tbaa !7
  %indvars.iv.next125.2 = or disjoint i64 %indvars.iv124, 3
  %161 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next125.2
  %162 = load i32, ptr %161, align 4, !tbaa !7
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %163
  %165 = trunc nuw nsw i64 %indvars.iv.next125.2 to i32
  store i32 %165, ptr %164, align 4, !tbaa !7
  %indvars.iv.next125.3 = add nuw nsw i64 %indvars.iv124, 4
  %niter151.next.3 = add i64 %niter151, 4
  %niter151.ncmp.3 = icmp eq i64 %niter151.next.3, %unroll_iter150
  br i1 %niter151.ncmp.3, label %.loopexit70.loopexit.unr-lcssa, label %.lr.ph98, !llvm.loop !24

.loopexit70.loopexit.unr-lcssa:                   ; preds = %.lr.ph98, %.lr.ph98.preheader
  %indvars.iv124.unr = phi i64 [ 0, %.lr.ph98.preheader ], [ %indvars.iv.next125.3, %.lr.ph98 ]
  %lcmp.mod149.not = icmp eq i64 %xtraiter147, 0
  br i1 %lcmp.mod149.not, label %.loopexit70, label %.lr.ph98.epil

.lr.ph98.epil:                                    ; preds = %.loopexit70.loopexit.unr-lcssa, %.lr.ph98.epil
  %indvars.iv124.epil = phi i64 [ %indvars.iv.next125.epil, %.lr.ph98.epil ], [ %indvars.iv124.unr, %.loopexit70.loopexit.unr-lcssa ]
  %epil.iter148 = phi i64 [ %epil.iter148.next, %.lr.ph98.epil ], [ 0, %.loopexit70.loopexit.unr-lcssa ]
  %166 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv124.epil
  %167 = load i32, ptr %166, align 4, !tbaa !7
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %168
  %170 = trunc nuw nsw i64 %indvars.iv124.epil to i32
  store i32 %170, ptr %169, align 4, !tbaa !7
  %indvars.iv.next125.epil = add nuw nsw i64 %indvars.iv124.epil, 1
  %epil.iter148.next = add i64 %epil.iter148, 1
  %epil.iter148.cmp.not = icmp eq i64 %epil.iter148.next, %xtraiter147
  br i1 %epil.iter148.cmp.not, label %.loopexit70, label %.lr.ph98.epil, !llvm.loop !25

.loopexit70:                                      ; preds = %.loopexit70.loopexit.unr-lcssa, %.lr.ph98.epil, %.preheader69, %._crit_edge81
  tail call void @_Z9transformiPi(i32 noundef %26, ptr noundef nonnull @ans)
  %171 = load i32, ptr @n, align 4, !tbaa !7
  %172 = load i32, ptr @m, align 4, !tbaa !7
  %173 = mul nsw i32 %172, %171
  %174 = icmp sgt i32 %173, 0
  br i1 %174, label %.lr.ph101, label %.loopexit68

.lr.ph101:                                        ; preds = %.loopexit70, %.lr.ph101
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %.lr.ph101 ], [ 0, %.loopexit70 ]
  %175 = getelementptr inbounds [96100 x i32], ptr @ans, i64 0, i64 %indvars.iv129
  %176 = load i32, ptr %175, align 4, !tbaa !7
  %177 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %176)
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %178 = load i32, ptr @n, align 4, !tbaa !7
  %179 = load i32, ptr @m, align 4, !tbaa !7
  %180 = mul nsw i32 %179, %178
  %181 = sext i32 %180 to i64
  %182 = icmp slt i64 %indvars.iv.next130, %181
  br i1 %182, label %.lr.ph101, label %.loopexit68, !llvm.loop !26

._crit_edge104:                                   ; preds = %.loopexit68, %0
  ret i32 0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 nounwind willreturn memory(argmem: write) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!9, !9, i64 0}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !6}
!17 = distinct !{!17, !6, !15, !14}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !6}
!21 = distinct !{!21, !6}
!22 = distinct !{!22, !6}
!23 = distinct !{!23, !6}
!24 = distinct !{!24, !6}
!25 = distinct !{!25, !19}
!26 = distinct !{!26, !6}


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