; LLVM IR from tangjz/acm-icpc :: uoj (6)

; 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
@all = external dso_local global i32, align 4
@perm = external dso_local global [25000000 x i32], align 16
@ord = external dso_local global [25000000 x i32], align 16
@L = external dso_local global [5000 x i32], align 16
@R = external dso_local global [5000 x i32], align 16
@sz = external dso_local global i32, align 4
@out = external dso_local global [10000 x i32], align 16
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca 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
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef @n, ptr noundef @m, ptr noundef %7)
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = load i32, ptr @m, align 4, !tbaa !5
  %23 = mul nsw i32 %21, %22
  store i32 %23, ptr @all, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %34, %0
  %25 = load i32, ptr %8, align 4, !tbaa !5
  %26 = load i32, ptr @all, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %37

29:                                               ; preds = %24
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = load i32, ptr %8, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %32
  store i32 %30, ptr %33, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %8, align 4, !tbaa !5
  br label %24, !llvm.loop !9

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

38:                                               ; preds = %74, %37
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = load i32, ptr @all, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = mul nsw i64 %45, %47
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = add nsw i64 %48, %50
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = srem i64 %51, %53
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = mul nsw i64 %54, %56
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = add nsw i64 %57, %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = srem i64 %60, %62
  %64 = trunc i64 %63 to i32
  store i32 %64, ptr %2, align 4, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %66
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  %71 = srem i32 %68, %70
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %72
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %67, ptr noundef nonnull align 4 dereferenceable(4) %73) #4
  br label %74

74:                                               ; preds = %43
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %9, align 4, !tbaa !5
  br label %38, !llvm.loop !11

77:                                               ; preds = %42
  br label %78

78:                                               ; preds = %82, %77
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = add nsw i32 %79, -1
  store i32 %80, ptr %7, align 4, !tbaa !5
  %81 = icmp ne i32 %79, 0
  br i1 %81, label %82, label %92

82:                                               ; preds = %78
  %83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4)
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = add nsw i32 %84, -1
  store i32 %85, ptr %3, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %86
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %4, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %90
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %87, ptr noundef nonnull align 4 dereferenceable(4) %91) #4
  br label %78, !llvm.loop !12

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

93:                                               ; preds = %106, %92
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = load i32, ptr @all, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %109

98:                                               ; preds = %93
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %104
  store i32 %99, ptr %105, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %98
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %10, align 4, !tbaa !5
  br label %93, !llvm.loop !13

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

110:                                              ; preds = %124, %109
  %111 = load i32, ptr %11, align 4, !tbaa !5
  %112 = load i32, ptr @n, align 4, !tbaa !5
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %127

115:                                              ; preds = %110
  %116 = load i32, ptr %11, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %117
  store i32 0, ptr %118, align 4, !tbaa !5
  %119 = load i32, ptr @m, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = load i32, ptr %11, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %122
  store i32 %120, ptr %123, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %115
  %125 = load i32, ptr %11, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %11, align 4, !tbaa !5
  br label %110, !llvm.loop !14

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

128:                                              ; preds = %209, %127
  %129 = load i32, ptr %12, align 4, !tbaa !5
  %130 = load i32, ptr @all, align 4, !tbaa !5
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 16, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %212

133:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  store i32 %137, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %138 = load i32, ptr %14, align 4, !tbaa !5
  call void @_Z3rdxiRiS_(i32 noundef %138, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %139 = load i32, ptr %16, align 4, !tbaa !5
  %140 = load i32, ptr %15, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = icmp slt i32 %139, %143
  br i1 %144, label %152, label %145

145:                                              ; preds = %133
  %146 = load i32, ptr %16, align 4, !tbaa !5
  %147 = load i32, ptr %15, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = icmp sgt i32 %146, %150
  br i1 %151, label %152, label %153

152:                                              ; preds = %145, %133
  store i32 18, ptr %13, align 4
  br label %206

153:                                              ; preds = %145
  %154 = load i32, ptr %12, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  %156 = load i32, ptr @sz, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr @sz, align 4, !tbaa !5
  %158 = sext i32 %156 to i64
  %159 = getelementptr inbounds [10000 x i32], ptr @out, i64 0, i64 %158
  store i32 %155, ptr %159, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %178, %153
  %161 = load i32, ptr %17, align 4, !tbaa !5
  %162 = load i32, ptr %15, align 4, !tbaa !5
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  store i32 19, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %181

165:                                              ; preds = %160
  %166 = load i32, ptr %17, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = load i32, ptr %16, align 4, !tbaa !5
  %171 = icmp sgt i32 %169, %170
  br i1 %171, label %172, label %177

172:                                              ; preds = %165
  %173 = load i32, ptr %16, align 4, !tbaa !5
  %174 = load i32, ptr %17, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %175
  store i32 %173, ptr %176, align 4, !tbaa !5
  br label %177

177:                                              ; preds = %172, %165
  br label %178

178:                                              ; preds = %177
  %179 = load i32, ptr %17, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %17, align 4, !tbaa !5
  br label %160, !llvm.loop !15

181:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %182 = load i32, ptr %15, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %18, align 4, !tbaa !5
  br label %184

184:                                              ; preds = %202, %181
  %185 = load i32, ptr %18, align 4, !tbaa !5
  %186 = load i32, ptr @n, align 4, !tbaa !5
  %187 = icmp slt i32 %185, %186
  br i1 %187, label %189, label %188

188:                                              ; preds = %184
  store i32 22, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %205

189:                                              ; preds = %184
  %190 = load i32, ptr %18, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = load i32, ptr %16, align 4, !tbaa !5
  %195 = icmp slt i32 %193, %194
  br i1 %195, label %196, label %201

196:                                              ; preds = %189
  %197 = load i32, ptr %16, align 4, !tbaa !5
  %198 = load i32, ptr %18, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %199
  store i32 %197, ptr %200, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %196, %189
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %18, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %18, align 4, !tbaa !5
  br label %184, !llvm.loop !16

205:                                              ; preds = %188
  store i32 0, ptr %13, align 4
  br label %206

206:                                              ; preds = %205, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %207 = load i32, ptr %13, align 4
  switch i32 %207, label %237 [
    i32 0, label %208
    i32 18, label %209
  ]

208:                                              ; preds = %206
  br label %209

209:                                              ; preds = %208, %206
  %210 = load i32, ptr %12, align 4, !tbaa !5
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %12, align 4, !tbaa !5
  br label %128, !llvm.loop !17

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

213:                                              ; preds = %232, %212
  %214 = load i32, ptr %19, align 4, !tbaa !5
  %215 = load i32, ptr @sz, align 4, !tbaa !5
  %216 = icmp slt i32 %214, %215
  br i1 %216, label %218, label %217

217:                                              ; preds = %213
  store i32 25, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %235

218:                                              ; preds = %213
  %219 = load i32, ptr %19, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [10000 x i32], ptr @out, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = load i32, ptr %19, align 4, !tbaa !5
  %224 = load i32, ptr @sz, align 4, !tbaa !5
  %225 = sub nsw i32 %224, 1
  %226 = icmp eq i32 %223, %225
  %227 = zext i1 %226 to i64
  %228 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %227
  %229 = load i8, ptr %228, align 1, !tbaa !18
  %230 = sext i8 %229 to i32
  %231 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %222, i32 noundef %230)
  br label %232

232:                                              ; preds = %218
  %233 = load i32, ptr %19, align 4, !tbaa !5
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %19, align 4, !tbaa !5
  br label %213, !llvm.loop !19

235:                                              ; preds = %217
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %236 = load i32, ptr %1, align 4
  ret i32 %236

237:                                              ; preds = %206
  unreachable
}

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

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

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

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@all = external dso_local local_unnamed_addr global i32, align 4
@perm = external dso_local global [25000000 x i32], align 16
@ord = external dso_local local_unnamed_addr global [25000000 x i32], align 16
@L = external dso_local local_unnamed_addr global [5000 x i32], align 16
@R = external dso_local local_unnamed_addr global [5000 x i32], align 16
@sz = external dso_local local_unnamed_addr global i32, align 4
@out = external dso_local local_unnamed_addr global [10000 x i32], align 16
@.str = external hidden unnamed_addr constant [17 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca 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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull %6)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = mul nsw i32 %11, %10
  store i32 %12, ptr @all, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph.preheader, label %.preheader50

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

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

vector.ph:                                        ; preds = %.lr.ph.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>
  %14 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %index
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store <4 x i32> %vec.ind, ptr %14, align 16, !tbaa !5
  store <4 x i32> %step.add, ptr %15, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, label %middle.block, label %vector.body, !llvm.loop !9

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

.preheader51:                                     ; preds = %.lr.ph, %middle.block
  br i1 %13, label %.lr.ph54, label %.preheader50

.lr.ph:                                           ; preds = %.lr.ph.preheader172, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader172 ]
  %17 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %18, ptr %17, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader51, label %.lr.ph, !llvm.loop !13

.preheader50:                                     ; preds = %.lr.ph54, %0, %.preheader51
  %19 = phi i32 [ %12, %.preheader51 ], [ %12, %0 ], [ %44, %.lr.ph54 ]
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr %6, align 4, !tbaa !5
  %.not55 = icmp eq i32 %20, 0
  br i1 %.not55, label %.preheader49, label %.lr.ph56

.lr.ph54:                                         ; preds = %.preheader51, %.lr.ph54
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph54 ], [ 0, %.preheader51 ]
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = mul nsw i64 %25, %23
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = add nsw i64 %26, %28
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = srem i64 %29, %31
  %33 = mul nsw i64 %32, %25
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = add nsw i64 %33, %35
  %37 = srem i64 %36, %31
  %38 = trunc nsw i64 %37 to i32
  store i32 %38, ptr %1, align 4, !tbaa !5
  %39 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv71
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %40 = trunc nuw nsw i64 %indvars.iv.next72 to i32
  %41 = srem i32 %38, %40
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %42
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %39, ptr noundef nonnull align 4 dereferenceable(4) %43) #5
  %44 = load i32, ptr @all, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next72, %45
  br i1 %46, label %.lr.ph54, label %.preheader50, !llvm.loop !14

.preheader49.loopexit:                            ; preds = %.lr.ph56
  %.pre = load i32, ptr @all, align 4, !tbaa !5
  br label %.preheader49

.preheader49:                                     ; preds = %.preheader49.loopexit, %.preheader50
  %47 = phi i32 [ %.pre, %.preheader49.loopexit ], [ %19, %.preheader50 ]
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph58.preheader, label %.preheader48

.lr.ph58.preheader:                               ; preds = %.preheader49
  %wide.trip.count77 = zext nneg i32 %47 to i64
  %xtraiter = and i64 %wide.trip.count77, 3
  %49 = icmp ult i32 %47, 4
  br i1 %49, label %.preheader48.loopexit.unr-lcssa, label %.lr.ph58.preheader.new

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

.lr.ph56:                                         ; preds = %.preheader50, %.lr.ph56
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %2, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %53
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = add nsw i32 %55, -1
  store i32 %56, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %57
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %54, ptr noundef nonnull align 4 dereferenceable(4) %58) #5
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %6, align 4, !tbaa !5
  %.not = icmp eq i32 %59, 0
  br i1 %.not, label %.preheader49.loopexit, label %.lr.ph56, !llvm.loop !15

.preheader48.loopexit.unr-lcssa:                  ; preds = %.lr.ph58, %.lr.ph58.preheader
  %indvars.iv74.unr = phi i64 [ 0, %.lr.ph58.preheader ], [ %indvars.iv.next75.3, %.lr.ph58 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader48, label %.lr.ph58.epil

.lr.ph58.epil:                                    ; preds = %.preheader48.loopexit.unr-lcssa, %.lr.ph58.epil
  %indvars.iv74.epil = phi i64 [ %indvars.iv.next75.epil, %.lr.ph58.epil ], [ %indvars.iv74.unr, %.preheader48.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph58.epil ], [ 0, %.preheader48.loopexit.unr-lcssa ]
  %61 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv74.epil
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %63
  %65 = trunc nuw nsw i64 %indvars.iv74.epil to i32
  store i32 %65, ptr %64, align 4, !tbaa !5
  %indvars.iv.next75.epil = add nuw nsw i64 %indvars.iv74.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 %.preheader48, label %.lr.ph58.epil, !llvm.loop !16

.preheader48:                                     ; preds = %.preheader48.loopexit.unr-lcssa, %.lr.ph58.epil, %.preheader49
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.lr.ph60, label %.preheader47

.lr.ph60:                                         ; preds = %.preheader48
  %68 = load i32, ptr @m, align 4, !tbaa !5
  %69 = add nsw i32 %68, -1
  %70 = zext nneg i32 %66 to i64
  %71 = shl nuw nsw i64 %70, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @L, i8 0, i64 %71, i1 false), !tbaa !5
  %min.iters.check102 = icmp ult i32 %66, 8
  br i1 %min.iters.check102, label %scalar.ph101.preheader, label %vector.ph103

scalar.ph101.preheader:                           ; preds = %middle.block100, %.lr.ph60
  %indvars.iv79.ph = phi i64 [ 0, %.lr.ph60 ], [ %n.vec105, %middle.block100 ]
  br label %scalar.ph101

vector.ph103:                                     ; preds = %.lr.ph60
  %n.vec105 = and i64 %70, 2147483640
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %69, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body107

vector.body107:                                   ; preds = %vector.body107, %vector.ph103
  %index108 = phi i64 [ 0, %vector.ph103 ], [ %index.next109, %vector.body107 ]
  %72 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %index108
  %73 = getelementptr inbounds i8, ptr %72, i64 16
  store <4 x i32> %broadcast.splat, ptr %72, align 16, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %73, align 16, !tbaa !5
  %index.next109 = add nuw i64 %index108, 8
  %74 = icmp eq i64 %index.next109, %n.vec105
  br i1 %74, label %middle.block100, label %vector.body107, !llvm.loop !18

middle.block100:                                  ; preds = %vector.body107
  %cmp.n110 = icmp eq i64 %n.vec105, %70
  br i1 %cmp.n110, label %.preheader47, label %scalar.ph101.preheader

.lr.ph58:                                         ; preds = %.lr.ph58, %.lr.ph58.preheader.new
  %indvars.iv74 = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %indvars.iv.next75.3, %.lr.ph58 ]
  %niter = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %niter.next.3, %.lr.ph58 ]
  %75 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv74
  %76 = load i32, ptr %75, align 16, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %77
  %79 = trunc nuw nsw i64 %indvars.iv74 to i32
  store i32 %79, ptr %78, align 4, !tbaa !5
  %indvars.iv.next75 = or disjoint i64 %indvars.iv74, 1
  %80 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv.next75
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %82
  %84 = trunc nuw nsw i64 %indvars.iv.next75 to i32
  store i32 %84, ptr %83, align 4, !tbaa !5
  %indvars.iv.next75.1 = or disjoint i64 %indvars.iv74, 2
  %85 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv.next75.1
  %86 = load i32, ptr %85, align 8, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %87
  %89 = trunc nuw nsw i64 %indvars.iv.next75.1 to i32
  store i32 %89, ptr %88, align 4, !tbaa !5
  %indvars.iv.next75.2 = or disjoint i64 %indvars.iv74, 3
  %90 = getelementptr inbounds [25000000 x i32], ptr @perm, i64 0, i64 %indvars.iv.next75.2
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %92
  %94 = trunc nuw nsw i64 %indvars.iv.next75.2 to i32
  store i32 %94, ptr %93, align 4, !tbaa !5
  %indvars.iv.next75.3 = add nuw nsw i64 %indvars.iv74, 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 %.preheader48.loopexit.unr-lcssa, label %.lr.ph58, !llvm.loop !19

.preheader47:                                     ; preds = %scalar.ph101, %middle.block100, %.preheader48
  br i1 %48, label %.lr.ph67, label %.preheader

scalar.ph101:                                     ; preds = %scalar.ph101.preheader, %scalar.ph101
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %scalar.ph101 ], [ %indvars.iv79.ph, %scalar.ph101.preheader ]
  %95 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %indvars.iv79
  store i32 %69, ptr %95, align 4, !tbaa !5
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond83.not = icmp eq i64 %indvars.iv.next80, %70
  br i1 %exitcond83.not, label %.preheader47, label %scalar.ph101, !llvm.loop !20

.preheader:                                       ; preds = %.loopexit, %.preheader47
  %96 = load i32, ptr @sz, align 4, !tbaa !5
  %97 = icmp sgt i32 %96, 0
  br i1 %97, label %.lr.ph69, label %._crit_edge

.lr.ph67:                                         ; preds = %.preheader47, %.loopexit
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %.loopexit ], [ 0, %.preheader47 ]
  %98 = getelementptr inbounds [25000000 x i32], ptr @ord, i64 0, i64 %indvars.iv93
  %99 = load i32, ptr %98, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  call void @_Z3rdxiRiS_(i32 noundef %99, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp slt i32 %100, %104
  br i1 %105, label %.loopexit, label %106

106:                                              ; preds = %.lr.ph67
  %107 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %102
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = icmp sgt i32 %100, %108
  br i1 %109, label %.loopexit, label %110

110:                                              ; preds = %106
  %111 = load i32, ptr @sz, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr @sz, align 4, !tbaa !5
  %113 = sext i32 %111 to i64
  %114 = getelementptr inbounds [10000 x i32], ptr @out, i64 0, i64 %113
  %115 = trunc i64 %indvars.iv93 to i32
  %116 = add i32 %115, 1
  store i32 %116, ptr %114, align 4, !tbaa !5
  %117 = icmp sgt i32 %101, 0
  br i1 %117, label %.lr.ph62.preheader, label %.preheader46

.lr.ph62.preheader:                               ; preds = %110
  %wide.trip.count87 = zext nneg i32 %101 to i64
  %min.iters.check141 = icmp ult i32 %101, 8
  br i1 %min.iters.check141, label %.lr.ph62.preheader171, label %vector.ph142

.lr.ph62.preheader171:                            ; preds = %middle.block139, %.lr.ph62.preheader
  %indvars.iv84.ph = phi i64 [ 0, %.lr.ph62.preheader ], [ %n.vec144, %middle.block139 ]
  br label %.lr.ph62

vector.ph142:                                     ; preds = %.lr.ph62.preheader
  %n.vec144 = and i64 %wide.trip.count87, 2147483640
  %broadcast.splatinsert150 = insertelement <4 x i32> poison, i32 %100, i64 0
  %broadcast.splat151 = shufflevector <4 x i32> %broadcast.splatinsert150, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body146

vector.body146:                                   ; preds = %pred.store.continue167, %vector.ph142
  %index147 = phi i64 [ 0, %vector.ph142 ], [ %index.next168, %pred.store.continue167 ]
  %118 = or disjoint i64 %index147, 4
  %119 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %index147
  %120 = getelementptr inbounds i8, ptr %119, i64 16
  %wide.load148 = load <4 x i32>, ptr %119, align 16, !tbaa !5
  %wide.load149 = load <4 x i32>, ptr %120, align 16, !tbaa !5
  %121 = icmp sgt <4 x i32> %wide.load148, %broadcast.splat151
  %122 = icmp sgt <4 x i32> %wide.load149, %broadcast.splat151
  %123 = extractelement <4 x i1> %121, i64 0
  br i1 %123, label %pred.store.if152, label %pred.store.continue153

pred.store.if152:                                 ; preds = %vector.body146
  %124 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %index147
  store i32 %100, ptr %124, align 16, !tbaa !5
  br label %pred.store.continue153

pred.store.continue153:                           ; preds = %pred.store.if152, %vector.body146
  %125 = extractelement <4 x i1> %121, i64 1
  br i1 %125, label %pred.store.if154, label %pred.store.continue155

pred.store.if154:                                 ; preds = %pred.store.continue153
  %126 = or disjoint i64 %index147, 1
  %127 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %126
  store i32 %100, ptr %127, align 4, !tbaa !5
  br label %pred.store.continue155

pred.store.continue155:                           ; preds = %pred.store.if154, %pred.store.continue153
  %128 = extractelement <4 x i1> %121, i64 2
  br i1 %128, label %pred.store.if156, label %pred.store.continue157

pred.store.if156:                                 ; preds = %pred.store.continue155
  %129 = or disjoint i64 %index147, 2
  %130 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %129
  store i32 %100, ptr %130, align 8, !tbaa !5
  br label %pred.store.continue157

pred.store.continue157:                           ; preds = %pred.store.if156, %pred.store.continue155
  %131 = extractelement <4 x i1> %121, i64 3
  br i1 %131, label %pred.store.if158, label %pred.store.continue159

pred.store.if158:                                 ; preds = %pred.store.continue157
  %132 = or disjoint i64 %index147, 3
  %133 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %132
  store i32 %100, ptr %133, align 4, !tbaa !5
  br label %pred.store.continue159

pred.store.continue159:                           ; preds = %pred.store.if158, %pred.store.continue157
  %134 = extractelement <4 x i1> %122, i64 0
  br i1 %134, label %pred.store.if160, label %pred.store.continue161

pred.store.if160:                                 ; preds = %pred.store.continue159
  %135 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %118
  store i32 %100, ptr %135, align 16, !tbaa !5
  br label %pred.store.continue161

pred.store.continue161:                           ; preds = %pred.store.if160, %pred.store.continue159
  %136 = extractelement <4 x i1> %122, i64 1
  br i1 %136, label %pred.store.if162, label %pred.store.continue163

pred.store.if162:                                 ; preds = %pred.store.continue161
  %137 = or disjoint i64 %index147, 5
  %138 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %137
  store i32 %100, ptr %138, align 4, !tbaa !5
  br label %pred.store.continue163

pred.store.continue163:                           ; preds = %pred.store.if162, %pred.store.continue161
  %139 = extractelement <4 x i1> %122, i64 2
  br i1 %139, label %pred.store.if164, label %pred.store.continue165

pred.store.if164:                                 ; preds = %pred.store.continue163
  %140 = or disjoint i64 %index147, 6
  %141 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %140
  store i32 %100, ptr %141, align 8, !tbaa !5
  br label %pred.store.continue165

pred.store.continue165:                           ; preds = %pred.store.if164, %pred.store.continue163
  %142 = extractelement <4 x i1> %122, i64 3
  br i1 %142, label %pred.store.if166, label %pred.store.continue167

pred.store.if166:                                 ; preds = %pred.store.continue165
  %143 = or disjoint i64 %index147, 7
  %144 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %143
  store i32 %100, ptr %144, align 4, !tbaa !5
  br label %pred.store.continue167

pred.store.continue167:                           ; preds = %pred.store.if166, %pred.store.continue165
  %index.next168 = add nuw i64 %index147, 8
  %145 = icmp eq i64 %index.next168, %n.vec144
  br i1 %145, label %middle.block139, label %vector.body146, !llvm.loop !21

middle.block139:                                  ; preds = %pred.store.continue167
  %cmp.n169 = icmp eq i64 %n.vec144, %wide.trip.count87
  br i1 %cmp.n169, label %.preheader46, label %.lr.ph62.preheader171

.preheader46:                                     ; preds = %185, %middle.block139, %110
  %146 = load i32, ptr @n, align 4, !tbaa !5
  %.03463 = add nsw i32 %101, 1
  %147 = icmp slt i32 %.03463, %146
  br i1 %147, label %.lr.ph65.preheader, label %.loopexit

.lr.ph65.preheader:                               ; preds = %.preheader46
  %148 = sext i32 %.03463 to i64
  %149 = add i32 %146, -2
  %150 = sub i32 %149, %101
  %151 = zext i32 %150 to i64
  %152 = add nuw nsw i64 %151, 1
  %min.iters.check113 = icmp ult i32 %150, 7
  br i1 %min.iters.check113, label %.lr.ph65.preheader170, label %vector.ph114

.lr.ph65.preheader170:                            ; preds = %middle.block111, %.lr.ph65.preheader
  %indvars.iv89.ph = phi i64 [ %148, %.lr.ph65.preheader ], [ %ind.end, %middle.block111 ]
  br label %.lr.ph65

vector.ph114:                                     ; preds = %.lr.ph65.preheader
  %n.vec116 = and i64 %152, 8589934584
  %ind.end = add nsw i64 %n.vec116, %148
  %broadcast.splatinsert121 = insertelement <4 x i32> poison, i32 %100, i64 0
  %broadcast.splat122 = shufflevector <4 x i32> %broadcast.splatinsert121, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body118

vector.body118:                                   ; preds = %pred.store.continue136, %vector.ph114
  %index119 = phi i64 [ 0, %vector.ph114 ], [ %index.next137, %pred.store.continue136 ]
  %offset.idx = add i64 %index119, %148
  %153 = add i64 %offset.idx, 4
  %154 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %offset.idx
  %155 = getelementptr inbounds i8, ptr %154, i64 16
  %wide.load = load <4 x i32>, ptr %154, align 4, !tbaa !5
  %wide.load120 = load <4 x i32>, ptr %155, align 4, !tbaa !5
  %156 = icmp slt <4 x i32> %wide.load, %broadcast.splat122
  %157 = icmp slt <4 x i32> %wide.load120, %broadcast.splat122
  %158 = extractelement <4 x i1> %156, i64 0
  br i1 %158, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body118
  %159 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %offset.idx
  store i32 %100, ptr %159, align 4, !tbaa !5
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body118
  %160 = extractelement <4 x i1> %156, i64 1
  br i1 %160, label %pred.store.if123, label %pred.store.continue124

pred.store.if123:                                 ; preds = %pred.store.continue
  %161 = add i64 %offset.idx, 1
  %162 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %161
  store i32 %100, ptr %162, align 4, !tbaa !5
  br label %pred.store.continue124

pred.store.continue124:                           ; preds = %pred.store.if123, %pred.store.continue
  %163 = extractelement <4 x i1> %156, i64 2
  br i1 %163, label %pred.store.if125, label %pred.store.continue126

pred.store.if125:                                 ; preds = %pred.store.continue124
  %164 = add i64 %offset.idx, 2
  %165 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %164
  store i32 %100, ptr %165, align 4, !tbaa !5
  br label %pred.store.continue126

pred.store.continue126:                           ; preds = %pred.store.if125, %pred.store.continue124
  %166 = extractelement <4 x i1> %156, i64 3
  br i1 %166, label %pred.store.if127, label %pred.store.continue128

pred.store.if127:                                 ; preds = %pred.store.continue126
  %167 = add i64 %offset.idx, 3
  %168 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %167
  store i32 %100, ptr %168, align 4, !tbaa !5
  br label %pred.store.continue128

pred.store.continue128:                           ; preds = %pred.store.if127, %pred.store.continue126
  %169 = extractelement <4 x i1> %157, i64 0
  br i1 %169, label %pred.store.if129, label %pred.store.continue130

pred.store.if129:                                 ; preds = %pred.store.continue128
  %170 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %153
  store i32 %100, ptr %170, align 4, !tbaa !5
  br label %pred.store.continue130

pred.store.continue130:                           ; preds = %pred.store.if129, %pred.store.continue128
  %171 = extractelement <4 x i1> %157, i64 1
  br i1 %171, label %pred.store.if131, label %pred.store.continue132

pred.store.if131:                                 ; preds = %pred.store.continue130
  %172 = add i64 %offset.idx, 5
  %173 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %172
  store i32 %100, ptr %173, align 4, !tbaa !5
  br label %pred.store.continue132

pred.store.continue132:                           ; preds = %pred.store.if131, %pred.store.continue130
  %174 = extractelement <4 x i1> %157, i64 2
  br i1 %174, label %pred.store.if133, label %pred.store.continue134

pred.store.if133:                                 ; preds = %pred.store.continue132
  %175 = add i64 %offset.idx, 6
  %176 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %175
  store i32 %100, ptr %176, align 4, !tbaa !5
  br label %pred.store.continue134

pred.store.continue134:                           ; preds = %pred.store.if133, %pred.store.continue132
  %177 = extractelement <4 x i1> %157, i64 3
  br i1 %177, label %pred.store.if135, label %pred.store.continue136

pred.store.if135:                                 ; preds = %pred.store.continue134
  %178 = add i64 %offset.idx, 7
  %179 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %178
  store i32 %100, ptr %179, align 4, !tbaa !5
  br label %pred.store.continue136

pred.store.continue136:                           ; preds = %pred.store.if135, %pred.store.continue134
  %index.next137 = add nuw i64 %index119, 8
  %180 = icmp eq i64 %index.next137, %n.vec116
  br i1 %180, label %middle.block111, label %vector.body118, !llvm.loop !22

middle.block111:                                  ; preds = %pred.store.continue136
  %cmp.n138 = icmp eq i64 %152, %n.vec116
  br i1 %cmp.n138, label %.loopexit, label %.lr.ph65.preheader170

.lr.ph62:                                         ; preds = %.lr.ph62.preheader171, %185
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %185 ], [ %indvars.iv84.ph, %.lr.ph62.preheader171 ]
  %181 = getelementptr inbounds [5000 x i32], ptr @R, i64 0, i64 %indvars.iv84
  %182 = load i32, ptr %181, align 4, !tbaa !5
  %183 = icmp sgt i32 %182, %100
  br i1 %183, label %184, label %185

184:                                              ; preds = %.lr.ph62
  store i32 %100, ptr %181, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %.lr.ph62, %184
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
  br i1 %exitcond88.not, label %.preheader46, label %.lr.ph62, !llvm.loop !23

.lr.ph65:                                         ; preds = %.lr.ph65.preheader170, %190
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %190 ], [ %indvars.iv89.ph, %.lr.ph65.preheader170 ]
  %186 = getelementptr inbounds [5000 x i32], ptr @L, i64 0, i64 %indvars.iv89
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = icmp slt i32 %187, %100
  br i1 %188, label %189, label %190

189:                                              ; preds = %.lr.ph65
  store i32 %100, ptr %186, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %.lr.ph65, %189
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next90 to i32
  %exitcond92.not = icmp eq i32 %146, %lftr.wideiv
  br i1 %exitcond92.not, label %.loopexit, label %.lr.ph65, !llvm.loop !24

.loopexit:                                        ; preds = %190, %middle.block111, %.preheader46, %.lr.ph67, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %191 = load i32, ptr @all, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = icmp slt i64 %indvars.iv.next94, %192
  br i1 %193, label %.lr.ph67, label %.preheader, !llvm.loop !25

._crit_edge:                                      ; preds = %.lr.ph69, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph69:                                         ; preds = %.preheader, %.lr.ph69
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %.lr.ph69 ], [ 0, %.preheader ]
  %194 = phi i32 [ %205, %.lr.ph69 ], [ %96, %.preheader ]
  %195 = getelementptr inbounds [10000 x i32], ptr @out, i64 0, i64 %indvars.iv96
  %196 = load i32, ptr %195, align 4, !tbaa !5
  %197 = add nsw i32 %194, -1
  %198 = zext i32 %197 to i64
  %199 = icmp eq i64 %indvars.iv96, %198
  %200 = zext i1 %199 to i64
  %201 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %200
  %202 = load i8, ptr %201, align 1, !tbaa !26
  %203 = sext i8 %202 to i32
  %204 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %196, i32 noundef %203)
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %205 = load i32, ptr @sz, align 4, !tbaa !5
  %206 = sext i32 %205 to i64
  %207 = icmp slt i64 %indvars.iv.next97, %206
  br i1 %207, label %.lr.ph69, label %._crit_edge, !llvm.loop !27
}

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

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

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

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

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

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

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

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

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

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


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