; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-11-22/upsolved (G - Garbling Game - tjz)

; 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 i8, align 1
  %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
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #10
  store i8 0, ptr %2, align 1, !tbaa !5
  br label %16

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

19:                                               ; preds = %16
  %20 = load i8, ptr %2, align 1, !tbaa !5, !range !9, !noundef !10
  %21 = trunc i8 %20 to i1
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = call i32 @putchar(i32 noundef 10)
  br label %25

24:                                               ; preds = %19
  store i8 1, ptr %2, align 1, !tbaa !5
  br label %25

25:                                               ; preds = %24, %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #10
  %26 = call i64 @strlen(ptr noundef @tran) #11
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr %3, align 4, !tbaa !11
  store i32 0, ptr @len, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #10
  %28 = load i32, ptr %3, align 4, !tbaa !11
  store i32 %28, ptr %4, align 4, !tbaa !11
  br label %29

29:                                               ; preds = %54, %25
  %30 = load i32, ptr %4, align 4, !tbaa !11
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #10
  br label %57

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #10
  %34 = load i32, ptr %4, align 4, !tbaa !11
  %35 = sub nsw i32 %34, 9
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  br label %41

38:                                               ; preds = %33
  %39 = load i32, ptr %4, align 4, !tbaa !11
  %40 = sub nsw i32 %39, 9
  br label %41

41:                                               ; preds = %38, %37
  %42 = phi i32 [ 0, %37 ], [ %40, %38 ]
  store i32 %42, ptr %5, align 4, !tbaa !11
  %43 = load i32, ptr %4, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [311 x i8], ptr @tran, i64 0, i64 %44
  store i8 0, ptr %45, align 1, !tbaa !13
  %46 = load i32, ptr %5, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr @tran, i64 %47
  %49 = load i32, ptr @len, align 4, !tbaa !11
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr @len, align 4, !tbaa !11
  %51 = sext i32 %49 to i64
  %52 = getelementptr inbounds i32, ptr @num, i64 %51
  %53 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %48, ptr noundef @.str.1, ptr noundef %52) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #10
  br label %54

54:                                               ; preds = %41
  %55 = load i32, ptr %4, align 4, !tbaa !11
  %56 = sub nsw i32 %55, 9
  store i32 %56, ptr %4, align 4, !tbaa !11
  br label %29, !llvm.loop !14

57:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #10
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %58

58:                                               ; preds = %70, %57
  %59 = load i32, ptr %6, align 4, !tbaa !11
  %60 = load i32, ptr @n, align 4, !tbaa !11
  %61 = sub nsw i32 %60, 1
  %62 = icmp slt i32 %59, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #10
  br label %73

64:                                               ; preds = %58
  %65 = load i32, ptr %6, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [310 x [311 x i8]], ptr @tran, i64 0, i64 %66
  %68 = getelementptr inbounds [311 x i8], ptr %67, i64 0, i64 0
  %69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %68)
  br label %70

70:                                               ; preds = %64
  %71 = load i32, ptr %6, align 4, !tbaa !11
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %6, align 4, !tbaa !11
  br label %58, !llvm.loop !16

73:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #10
  %74 = load i32, ptr @n, align 4, !tbaa !11
  %75 = sub nsw i32 %74, 1
  %76 = load i32, ptr @m, align 4, !tbaa !11
  %77 = sub nsw i32 %76, 1
  %78 = mul nsw i32 %75, %77
  %79 = call noundef i32 @_Z9divAndModi(i32 noundef %78)
  store i32 %79, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %80

80:                                               ; preds = %92, %73
  %81 = load i32, ptr %8, align 4, !tbaa !11
  %82 = load i32, ptr @n, align 4, !tbaa !11
  %83 = load i32, ptr @m, align 4, !tbaa !11
  %84 = mul nsw i32 %82, %83
  %85 = icmp slt i32 %81, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %95

87:                                               ; preds = %80
  %88 = load i32, ptr %8, align 4, !tbaa !11
  %89 = load i32, ptr %8, align 4, !tbaa !11
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %90
  store i32 %88, ptr %91, align 4, !tbaa !11
  br label %92

92:                                               ; preds = %87
  %93 = load i32, ptr %8, align 4, !tbaa !11
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !11
  br label %80, !llvm.loop !17

95:                                               ; preds = %86
  call void @llvm.memset.p0.i64(ptr align 16 @ans, i8 0, i64 384400, i1 false)
  %96 = load i32, ptr @len, align 4, !tbaa !11
  %97 = icmp sgt i32 %96, 1
  br i1 %97, label %101, label %98

98:                                               ; preds = %95
  %99 = load i32, ptr @num, align 16, !tbaa !11
  %100 = icmp sgt i32 %99, 0
  br i1 %100, label %101, label %282

101:                                              ; preds = %98, %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  store i32 0, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  store i32 1, ptr %10, align 4, !tbaa !11
  %102 = load i32, ptr %9, align 4, !tbaa !11
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %103
  %105 = getelementptr inbounds [96100 x i32], ptr %104, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %105, i8 0, i64 384400, i1 false)
  %106 = load i32, ptr @n, align 4, !tbaa !11
  %107 = sub nsw i32 %106, 1
  %108 = load i32, ptr @m, align 4, !tbaa !11
  %109 = sub nsw i32 %108, 1
  %110 = mul nsw i32 %107, %109
  %111 = load i32, ptr %9, align 4, !tbaa !11
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %112
  %114 = getelementptr inbounds [96100 x i32], ptr %113, i64 0, i64 0
  call void @_Z9transformiPi(i32 noundef %110, ptr noundef %114)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #10
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %115

115:                                              ; preds = %137, %101
  %116 = load i32, ptr %11, align 4, !tbaa !11
  %117 = load i32, ptr @n, align 4, !tbaa !11
  %118 = load i32, ptr @m, align 4, !tbaa !11
  %119 = mul nsw i32 %117, %118
  %120 = icmp slt i32 %116, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  br label %140

122:                                              ; preds = %115
  %123 = load i32, ptr %11, align 4, !tbaa !11
  %124 = load i32, ptr %9, align 4, !tbaa !11
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %125
  %127 = load i32, ptr %11, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !11
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [96100 x i32], ptr %126, i64 0, i64 %131
  store i32 %123, ptr %132, align 4, !tbaa !11
  %133 = load i32, ptr %11, align 4, !tbaa !11
  %134 = load i32, ptr %11, align 4, !tbaa !11
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %135
  store i32 %133, ptr %136, align 4, !tbaa !11
  br label %137

137:                                              ; preds = %122
  %138 = load i32, ptr %11, align 4, !tbaa !11
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %11, align 4, !tbaa !11
  br label %115, !llvm.loop !18

140:                                              ; preds = %121
  br label %141

141:                                              ; preds = %260, %140
  %142 = load i32, ptr @len, align 4, !tbaa !11
  %143 = icmp sgt i32 %142, 1
  br i1 %143, label %147, label %144

144:                                              ; preds = %141
  %145 = load i32, ptr @num, align 16, !tbaa !11
  %146 = icmp sgt i32 %145, 0
  br label %147

147:                                              ; preds = %144, %141
  %148 = phi i1 [ true, %141 ], [ %146, %144 ]
  br i1 %148, label %149, label %262

149:                                              ; preds = %147
  %150 = load i32, ptr @num, align 16, !tbaa !11
  %151 = and i32 %150, 1
  %152 = icmp ne i32 %151, 0
  br i1 %152, label %153, label %192

153:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #10
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %154

154:                                              ; preds = %188, %153
  %155 = load i32, ptr %12, align 4, !tbaa !11
  %156 = load i32, ptr @n, align 4, !tbaa !11
  %157 = load i32, ptr @m, align 4, !tbaa !11
  %158 = mul nsw i32 %156, %157
  %159 = icmp slt i32 %155, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  br label %191

161:                                              ; preds = %154
  %162 = load i32, ptr %12, align 4, !tbaa !11
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [96100 x i32], ptr @ans, i64 0, i64 %163
  %165 = load i32, ptr %9, align 4, !tbaa !11
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [2 x [96100 x i32]], ptr @cnt, i64 0, i64 %166
  %168 = load i32, ptr %12, align 4, !tbaa !11
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !11
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [96100 x i32], ptr %167, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !11
  call void @_Z7mod_incRii(ptr noundef nonnull align 4 dereferenceable(4) %164, i32 noundef %174)
  %175 = load i32, ptr %9, align 4, !tbaa !11
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [2 x [96100 x i32]], ptr @nxt, i64 0, i64 %176
  %178 = load i32, ptr %12, align 4, !tbaa !11
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !11
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [96100 x i32], ptr %177, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !11
  %185 = load i32, ptr %12, align 4, !tbaa !11
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %186
  store i32 %184, ptr %187, align 4, !tbaa !11
  br label %188

188:                                              ; preds = %161
  %189 = load i32, ptr %12, align 4, !tbaa !11
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %12, align 4, !tbaa !11
  br label %154, !llvm.loop !19

191:                                              ; preds = %160
  br label %192

192:                                              ; preds = %191, %149
  %193 = load i32, ptr %9, align 4, !tbaa !11
  %194 = xor i32 %193, 1
  store i32 %194, ptr %9, align 4, !tbaa !11
  %195 = load i32, ptr %10, align 4, !tbaa !11
  %196 = xor i32 %195, 1
  store i32 %196, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #10
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %197

197:                                              ; preds = %256, %192
  %198 = load i32, ptr %13, align 4, !tbaa !11
  %199 = load i32, ptr @n, align 4, !tbaa !11
  %200 = load i32, ptr @m, align 4, !tbaa !11
  %201 = mul nsw i32 %199, %200
  %202 = icmp slt i32 %198, %201
  br i1 %202, label %204, label %203

203:                                              ; preds = %197
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #10
  br label %259

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

256:                                              ; preds = %204
  %257 = load i32, ptr %13, align 4, !tbaa !11
  %258 = add nsw i32 %257, 1
  store i32 %258, ptr %13, align 4, !tbaa !11
  br label %197, !llvm.loop !20

259:                                              ; preds = %203
  br label %260

260:                                              ; preds = %259
  %261 = call noundef i32 @_Z9divAndModi(i32 noundef 2)
  br label %141, !llvm.loop !21

262:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #10
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %263

263:                                              ; preds = %278, %262
  %264 = load i32, ptr %14, align 4, !tbaa !11
  %265 = load i32, ptr @n, align 4, !tbaa !11
  %266 = load i32, ptr @m, align 4, !tbaa !11
  %267 = mul nsw i32 %265, %266
  %268 = icmp slt i32 %264, %267
  br i1 %268, label %270, label %269

269:                                              ; preds = %263
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #10
  br label %281

270:                                              ; preds = %263
  %271 = load i32, ptr %14, align 4, !tbaa !11
  %272 = load i32, ptr %14, align 4, !tbaa !11
  %273 = sext i32 %272 to i64
  %274 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %273
  %275 = load i32, ptr %274, align 4, !tbaa !11
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %276
  store i32 %271, ptr %277, align 4, !tbaa !11
  br label %278

278:                                              ; preds = %270
  %279 = load i32, ptr %14, align 4, !tbaa !11
  %280 = add nsw i32 %279, 1
  store i32 %280, ptr %14, align 4, !tbaa !11
  br label %263, !llvm.loop !22

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

282:                                              ; preds = %281, %98
  %283 = load i32, ptr %7, align 4, !tbaa !11
  call void @_Z9transformiPi(i32 noundef %283, ptr noundef @ans)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #10
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %284

284:                                              ; preds = %297, %282
  %285 = load i32, ptr %15, align 4, !tbaa !11
  %286 = load i32, ptr @n, align 4, !tbaa !11
  %287 = load i32, ptr @m, align 4, !tbaa !11
  %288 = mul nsw i32 %286, %287
  %289 = icmp slt i32 %285, %288
  br i1 %289, label %291, label %290

290:                                              ; preds = %284
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #10
  br label %300

291:                                              ; preds = %284
  %292 = load i32, ptr %15, align 4, !tbaa !11
  %293 = sext i32 %292 to i64
  %294 = getelementptr inbounds [96100 x i32], ptr @ans, i64 0, i64 %293
  %295 = load i32, ptr %294, align 4, !tbaa !11
  %296 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %295)
  br label %297

297:                                              ; preds = %291
  %298 = load i32, ptr %15, align 4, !tbaa !11
  %299 = add nsw i32 %298, 1
  store i32 %299, ptr %15, align 4, !tbaa !11
  br label %284, !llvm.loop !23

300:                                              ; preds = %290
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #10
  br label %16, !llvm.loop !24

301:                                              ; preds = %16
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #10
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #6

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

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

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

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


; 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.ph106, label %._crit_edge107

.loopexit70:                                      ; preds = %.lr.ph103, %.loopexit72
  %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 %.critedge, label %._crit_edge107, !llvm.loop !5

.critedge:                                        ; preds = %.loopexit70
  %5 = tail call i32 @putchar(i32 noundef 10)
  br label %.lr.ph106

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

.lr.ph.preheader:                                 ; preds = %.lr.ph106
  %9 = and i64 %6, 2147483647
  br label %.lr.ph

.preheader74:                                     ; preds = %.lr.ph, %.lr.ph106
  %10 = load i32, ptr @n, align 4, !tbaa !7
  %11 = add nsw i32 %10, -1
  %12 = icmp sgt i32 %10, 1
  br i1 %12, label %.lr.ph79, label %._crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph79, %.preheader74
  %.lcssa = phi i32 [ %11, %.preheader74 ], [ %38, %.lr.ph79 ]
  %24 = load i32, ptr @m, align 4, !tbaa !7
  %25 = add nsw i32 %24, -1
  %26 = mul nsw i32 %25, %.lcssa
  %27 = tail call noundef i32 @_Z9divAndModi(i32 noundef %26)
  %28 = load i32, ptr @n, align 4, !tbaa !7
  %29 = load i32, ptr @m, align 4, !tbaa !7
  %30 = mul nsw i32 %29, %28
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph82.preheader, label %._crit_edge83

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

.lr.ph82.preheader147:                            ; preds = %middle.block, %.lr.ph82.preheader
  %indvars.iv113.ph = phi i64 [ 0, %.lr.ph82.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph82

vector.ph:                                        ; preds = %.lr.ph82.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>
  %32 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %index
  %33 = getelementptr inbounds i8, ptr %32, i64 16
  store <4 x i32> %vec.ind, ptr %32, align 16, !tbaa !7
  store <4 x i32> %step.add, ptr %33, 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>
  %34 = icmp eq i64 %index.next, %n.vec
  br i1 %34, 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_edge83, label %.lr.ph82.preheader147

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

._crit_edge83:                                    ; preds = %.lr.ph82, %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)
  %41 = load i32, ptr @len, align 4, !tbaa !7
  %42 = icmp sgt i32 %41, 1
  %43 = load i32, ptr @num, align 16
  %44 = icmp sgt i32 %43, 0
  %or.cond = select i1 %42, i1 true, i1 %44
  br i1 %or.cond, label %47, label %.loopexit72

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

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

.lr.ph88.preheader:                               ; preds = %47
  %wide.trip.count119 = zext nneg i32 %53 to i64
  %xtraiter = and i64 %wide.trip.count119, 3
  %55 = icmp ult i32 %53, 4
  br i1 %55, label %.preheader73.loopexit.unr-lcssa, label %.lr.ph88.preheader.new

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

.preheader73.loopexit.unr-lcssa:                  ; preds = %.lr.ph88, %.lr.ph88.preheader
  %indvars.iv116.unr = phi i64 [ 0, %.lr.ph88.preheader ], [ %indvars.iv.next117.3, %.lr.ph88 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader73, label %.lr.ph88.epil

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

.preheader73:                                     ; preds = %.preheader73.loopexit.unr-lcssa, %.lr.ph88.epil, %47
  %62 = load i32, ptr @len, align 4, !tbaa !7
  %63 = icmp sgt i32 %62, 1
  %64 = load i32, ptr @num, align 16
  %65 = icmp sgt i32 %64, 0
  %66 = select i1 %63, i1 true, i1 %65
  br i1 %66, label %.lr.ph98, label %.preheader71

.lr.ph88:                                         ; preds = %.lr.ph88, %.lr.ph88.preheader.new
  %indvars.iv116 = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %indvars.iv.next117.3, %.lr.ph88 ]
  %niter = phi i64 [ 0, %.lr.ph88.preheader.new ], [ %niter.next.3, %.lr.ph88 ]
  %67 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv116
  %68 = load i32, ptr %67, align 16, !tbaa !7
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %69
  %71 = trunc nuw nsw i64 %indvars.iv116 to i32
  store i32 %71, ptr %70, align 4, !tbaa !7
  %72 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv116
  store i32 %71, ptr %72, align 16, !tbaa !7
  %indvars.iv.next117 = or disjoint i64 %indvars.iv116, 1
  %73 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv.next117
  %74 = load i32, ptr %73, align 4, !tbaa !7
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %75
  %77 = trunc nuw nsw i64 %indvars.iv.next117 to i32
  store i32 %77, ptr %76, align 4, !tbaa !7
  %78 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next117
  store i32 %77, ptr %78, align 4, !tbaa !7
  %indvars.iv.next117.1 = or disjoint i64 %indvars.iv116, 2
  %79 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv.next117.1
  %80 = load i32, ptr %79, align 8, !tbaa !7
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %81
  %83 = trunc nuw nsw i64 %indvars.iv.next117.1 to i32
  store i32 %83, ptr %82, align 4, !tbaa !7
  %84 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next117.1
  store i32 %83, ptr %84, align 8, !tbaa !7
  %indvars.iv.next117.2 = or disjoint i64 %indvars.iv116, 3
  %85 = getelementptr inbounds [96100 x i32], ptr @perm, i64 0, i64 %indvars.iv.next117.2
  %86 = load i32, ptr %85, align 4, !tbaa !7
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [96100 x i32], ptr @nxt, i64 0, i64 %87
  %89 = trunc nuw nsw i64 %indvars.iv.next117.2 to i32
  store i32 %89, ptr %88, align 4, !tbaa !7
  %90 = getelementptr inbounds [96100 x i32], ptr @pos, i64 0, i64 %indvars.iv.next117.2
  store i32 %89, ptr %90, align 4, !tbaa !7
  %indvars.iv.next117.3 = add nuw nsw i64 %indvars.iv116, 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 %.preheader73.loopexit.unr-lcssa, label %.lr.ph88, !llvm.loop !20

.preheader71.loopexit:                            ; preds = %._crit_edge94
  %.pre136 = load i32, ptr @n, align 4, !tbaa !7
  %.pre137 = load i32, ptr @m, align 4, !tbaa !7
  %.pre138 = mul nsw i32 %.pre137, %.pre136
  br label %.preheader71

.preheader71:                                     ; preds = %.preheader71.loopexit, %.preheader73
  %.pre-phi = phi i32 [ %.pre138, %.preheader71.loopexit ], [ %53, %.preheader73 ]
  %91 = icmp sgt i32 %.pre-phi, 0
  br i1 %91, label %.lr.ph100.preheader, label %.loopexit72

.lr.ph100.preheader:                              ; preds = %.preheader71
  %wide.trip.count130 = zext nneg i32 %.pre-phi to i64
  %xtraiter150 = and i64 %wide.trip.count130, 3
  %92 = icmp ult i32 %.pre-phi, 4
  br i1 %92, label %.loopexit72.loopexit.unr-lcssa, label %.lr.ph100.preheader.new

.lr.ph100.preheader.new:                          ; preds = %.lr.ph100.preheader
  %unroll_iter153 = and i64 %wide.trip.count130, 2147483644
  br label %.lr.ph100

.lr.ph98:                                         ; preds = %.preheader73, %._crit_edge94
  %93 = phi i32 [ %125, %._crit_edge94 ], [ %64, %.preheader73 ]
  %.06397 = phi i32 [ %120, %._crit_edge94 ], [ 1, %.preheader73 ]
  %.06495 = phi i32 [ %121, %._crit_edge94 ], [ 0, %.preheader73 ]
  %94 = and i32 %93, 1
  %.not = icmp eq i32 %94, 0
  %.pre = load i32, ptr @n, align 4, !tbaa !7
  %.pre135 = load i32, ptr @m, align 4, !tbaa !7
  %.pre139 = mul nsw i32 %.pre135, %.pre
  br i1 %.not, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.lr.ph98
  %95 = icmp sgt i32 %.pre139, 0
  br i1 %95, label %.lr.ph90, label %.loopexit.thread

.loopexit.thread:                                 ; preds = %.preheader
  %96 = xor i32 %.06495, 1
  %97 = xor i32 %.06397, 1
  br label %._crit_edge94

.lr.ph90:                                         ; preds = %.preheader
  %98 = zext nneg i32 %.06495 to i64
  br label %99

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

.loopexit:                                        ; preds = %99, %.lr.ph98
  %.pre-phi140 = phi i32 [ %.pre139, %.lr.ph98 ], [ %112, %99 ]
  %115 = xor i32 %.06495, 1
  %116 = xor i32 %.06397, 1
  %117 = icmp sgt i32 %.pre-phi140, 0
  br i1 %117, label %.lr.ph93, label %._crit_edge94

.lr.ph93:                                         ; preds = %.loopexit
  %118 = zext nneg i32 %116 to i64
  %119 = zext nneg i32 %115 to i64
  br label %128

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

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

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

.loopexit72.loopexit.unr-lcssa:                   ; preds = %.lr.ph100, %.lr.ph100.preheader
  %indvars.iv127.unr = phi i64 [ 0, %.lr.ph100.preheader ], [ %indvars.iv.next128.3, %.lr.ph100 ]
  %lcmp.mod152.not = icmp eq i64 %xtraiter150, 0
  br i1 %lcmp.mod152.not, label %.loopexit72, label %.lr.ph100.epil

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

.loopexit72:                                      ; preds = %.loopexit72.loopexit.unr-lcssa, %.lr.ph100.epil, %.preheader71, %._crit_edge83
  tail call void @_Z9transformiPi(i32 noundef %27, ptr noundef nonnull @ans)
  %172 = load i32, ptr @n, align 4, !tbaa !7
  %173 = load i32, ptr @m, align 4, !tbaa !7
  %174 = mul nsw i32 %173, %172
  %175 = icmp sgt i32 %174, 0
  br i1 %175, label %.lr.ph103, label %.loopexit70

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

._crit_edge107:                                   ; preds = %.loopexit70, %0
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #5

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

; 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) #7

; 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) #8

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 = { inlinehint mustprogress nofree 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 #6 = { 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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: AggressiveInstCombinePass,BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass