; LLVM IR from kazunetakahashi/atcoder :: 2017/1027_ABC073 (D)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@r = external dso_local global [10 x i32], align 16
@dist = external dso_local global [210 x [210 x i32]], align 16
@A = external dso_local global [100010 x i32], align 16
@B = external dso_local global [100010 x i32], align 16
@C = external dso_local global [100010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZL5infty = external hidden constant i32, align 4
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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
  store i32 0, ptr %1, align 4
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) @R)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %32, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @R, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %35

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %24
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr %29, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %22
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

35:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %64, %35
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr @M, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %67

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %43
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %44)
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %47
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef nonnull align 4 dereferenceable(4) %48)
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %51
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 4 dereferenceable(4) %52)
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr %56, align 4, !tbaa !5
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = add nsw i32 %62, -1
  store i32 %63, ptr %61, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %41
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !5
  br label %36, !llvm.loop !11

67:                                               ; preds = %40
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @dist, ptr noundef getelementptr inbounds (i32, ptr @dist, i64 44100), ptr noundef nonnull align 4 dereferenceable(4) @_ZL5infty)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %80, %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = load i32, ptr @N, align 4, !tbaa !5
  %71 = icmp slt i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %83

73:                                               ; preds = %68
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %75
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [210 x i32], ptr %76, i64 0, i64 %78
  store i32 0, ptr %79, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %73
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %4, align 4, !tbaa !5
  br label %68, !llvm.loop !12

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

84:                                               ; preds = %122, %83
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = load i32, ptr @M, align 4, !tbaa !5
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %125

89:                                               ; preds = %84
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %98
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [210 x i32], ptr %99, i64 0, i64 %104
  store i32 %93, ptr %105, align 4, !tbaa !5
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %114
  %116 = load i32, ptr %5, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [210 x i32], ptr %115, i64 0, i64 %120
  store i32 %109, ptr %121, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %89
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %5, align 4, !tbaa !5
  br label %84, !llvm.loop !13

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

126:                                              ; preds = %196, %125
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = load i32, ptr @N, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %199

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

132:                                              ; preds = %192, %131
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = load i32, ptr @N, align 4, !tbaa !5
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %195

137:                                              ; preds = %132
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = icmp eq i32 %138, %139
  br i1 %140, label %141, label %142

141:                                              ; preds = %137
  br label %192

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

143:                                              ; preds = %188, %142
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = load i32, ptr @N, align 4, !tbaa !5
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %143
  store i32 20, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %191

148:                                              ; preds = %143
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = load i32, ptr %9, align 4, !tbaa !5
  %151 = icmp eq i32 %149, %150
  br i1 %151, label %152, label %153

152:                                              ; preds = %148
  br label %188

153:                                              ; preds = %148
  %154 = load i32, ptr %6, align 4, !tbaa !5
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = icmp eq i32 %154, %155
  br i1 %156, label %157, label %158

157:                                              ; preds = %153
  br label %188

158:                                              ; preds = %153
  %159 = load i32, ptr %8, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %160
  %162 = load i32, ptr %9, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [210 x i32], ptr %161, i64 0, i64 %163
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %165 = load i32, ptr %8, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %166
  %168 = load i32, ptr %6, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [210 x i32], ptr %167, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = load i32, ptr %6, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %173
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [210 x i32], ptr %174, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = add nsw i32 %171, %178
  store i32 %179, ptr %10, align 4, !tbaa !5
  %180 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %164, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr %8, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %183
  %185 = load i32, ptr %9, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [210 x i32], ptr %184, i64 0, i64 %186
  store i32 %181, ptr %187, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %188

188:                                              ; preds = %158, %157, %152
  %189 = load i32, ptr %9, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %9, align 4, !tbaa !5
  br label %143, !llvm.loop !14

191:                                              ; preds = %147
  br label %192

192:                                              ; preds = %191, %141
  %193 = load i32, ptr %8, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %8, align 4, !tbaa !5
  br label %132, !llvm.loop !15

195:                                              ; preds = %136
  br label %196

196:                                              ; preds = %195
  %197 = load i32, ptr %6, align 4, !tbaa !5
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %6, align 4, !tbaa !5
  br label %126, !llvm.loop !16

199:                                              ; preds = %130
  %200 = load i32, ptr @R, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds i32, ptr @r, i64 %201
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @r, ptr noundef %202)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1000000007, ptr %11, align 4, !tbaa !5
  br label %203

203:                                              ; preds = %233, %199
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %204

204:                                              ; preds = %227, %203
  %205 = load i32, ptr %13, align 4, !tbaa !5
  %206 = load i32, ptr @R, align 4, !tbaa !5
  %207 = sub nsw i32 %206, 1
  %208 = icmp slt i32 %205, %207
  br i1 %208, label %210, label %209

209:                                              ; preds = %204
  store i32 25, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %230

210:                                              ; preds = %204
  %211 = load i32, ptr %13, align 4, !tbaa !5
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %215
  %217 = load i32, ptr %13, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [210 x i32], ptr %216, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !5
  %225 = load i32, ptr %12, align 4, !tbaa !5
  %226 = add nsw i32 %225, %224
  store i32 %226, ptr %12, align 4, !tbaa !5
  br label %227

227:                                              ; preds = %210
  %228 = load i32, ptr %13, align 4, !tbaa !5
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %13, align 4, !tbaa !5
  br label %204, !llvm.loop !17

230:                                              ; preds = %209
  %231 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %232 = load i32, ptr %231, align 4, !tbaa !5
  store i32 %232, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %233

233:                                              ; preds = %230
  %234 = load i32, ptr @R, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds i32, ptr @r, i64 %235
  %237 = call noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef @r, ptr noundef %236)
  br i1 %237, label %203, label %238, !llvm.loop !18

238:                                              ; preds = %233
  %239 = load i32, ptr %11, align 4, !tbaa !5
  %240 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %239)
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %240, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %242 = load i32, ptr %1, align 4
  ret i32 %242
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef, ptr noundef) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@r = external dso_local global [10 x i32], align 16
@dist = external dso_local global [210 x [210 x i32]], align 16
@A = external dso_local global [100010 x i32], align 16
@B = external dso_local global [100010 x i32], align 16
@C = external dso_local global [100010 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZL5infty = external hidden constant i32, align 4
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse 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 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) @R)
  %7 = load i32, ptr @R, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.preheader58

.preheader58:                                     ; preds = %.lr.ph, %0
  %9 = load i32, ptr @M, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph61, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %indvars.iv
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %13 = load i32, ptr %11, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr %11, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @R, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %.preheader58, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph61, %.preheader58
  tail call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @dist, ptr noundef nonnull getelementptr inbounds (i8, ptr @dist, i64 176400), ptr noundef nonnull align 4 dereferenceable(4) @_ZL5infty)
  %18 = load i32, ptr @N, align 4
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph64.preheader, label %.preheader57

.lr.ph64.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %18 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %20 = icmp ult i32 %18, 4
  br i1 %20, label %.preheader57.loopexit.unr-lcssa, label %.lr.ph64.preheader.new

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

.lr.ph61:                                         ; preds = %.preheader58, %.lr.ph61
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %.lr.ph61 ], [ 0, %.preheader58 ]
  %21 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv84
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %23 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv84
  %24 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) %23)
  %25 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %indvars.iv84
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %27 = load i32, ptr %21, align 4, !tbaa !5
  %28 = add nsw i32 %27, -1
  store i32 %28, ptr %21, align 4, !tbaa !5
  %29 = load i32, ptr %23, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr %23, align 4, !tbaa !5
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %31 = load i32, ptr @M, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = icmp slt i64 %indvars.iv.next85, %32
  br i1 %33, label %.lr.ph61, label %._crit_edge, !llvm.loop !11

.preheader57.loopexit.unr-lcssa:                  ; preds = %.lr.ph64, %.lr.ph64.preheader
  %indvars.iv87.unr = phi i64 [ 0, %.lr.ph64.preheader ], [ %indvars.iv.next88.3, %.lr.ph64 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader57, label %.lr.ph64.epil

.lr.ph64.epil:                                    ; preds = %.preheader57.loopexit.unr-lcssa, %.lr.ph64.epil
  %indvars.iv87.epil = phi i64 [ %indvars.iv.next88.epil, %.lr.ph64.epil ], [ %indvars.iv87.unr, %.preheader57.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph64.epil ], [ 0, %.preheader57.loopexit.unr-lcssa ]
  %34 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv87.epil, i64 %indvars.iv87.epil
  store i32 0, ptr %34, align 4, !tbaa !5
  %indvars.iv.next88.epil = add nuw nsw i64 %indvars.iv87.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 %.preheader57, label %.lr.ph64.epil, !llvm.loop !12

.preheader57:                                     ; preds = %.preheader57.loopexit.unr-lcssa, %.lr.ph64.epil, %._crit_edge
  %35 = load i32, ptr @M, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph66.preheader, label %.preheader56

.lr.ph66.preheader:                               ; preds = %.preheader57
  %wide.trip.count93 = zext nneg i32 %35 to i64
  %xtraiter119 = and i64 %wide.trip.count93, 1
  %37 = icmp eq i32 %35, 1
  br i1 %37, label %.preheader56.loopexit.unr-lcssa, label %.lr.ph66.preheader.new

.lr.ph66.preheader.new:                           ; preds = %.lr.ph66.preheader
  %unroll_iter122 = and i64 %wide.trip.count93, 2147483646
  br label %.lr.ph66

.lr.ph64:                                         ; preds = %.lr.ph64, %.lr.ph64.preheader.new
  %indvars.iv87 = phi i64 [ 0, %.lr.ph64.preheader.new ], [ %indvars.iv.next88.3, %.lr.ph64 ]
  %niter = phi i64 [ 0, %.lr.ph64.preheader.new ], [ %niter.next.3, %.lr.ph64 ]
  %38 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv87, i64 %indvars.iv87
  store i32 0, ptr %38, align 16, !tbaa !5
  %indvars.iv.next88 = or disjoint i64 %indvars.iv87, 1
  %39 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv.next88, i64 %indvars.iv.next88
  store i32 0, ptr %39, align 4, !tbaa !5
  %indvars.iv.next88.1 = or disjoint i64 %indvars.iv87, 2
  %40 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv.next88.1, i64 %indvars.iv.next88.1
  store i32 0, ptr %40, align 8, !tbaa !5
  %indvars.iv.next88.2 = or disjoint i64 %indvars.iv87, 3
  %41 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv.next88.2, i64 %indvars.iv.next88.2
  store i32 0, ptr %41, align 4, !tbaa !5
  %indvars.iv.next88.3 = add nuw nsw i64 %indvars.iv87, 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 %.preheader57.loopexit.unr-lcssa, label %.lr.ph64, !llvm.loop !14

.preheader56.loopexit.unr-lcssa:                  ; preds = %.lr.ph66, %.lr.ph66.preheader
  %indvars.iv90.unr = phi i64 [ 0, %.lr.ph66.preheader ], [ %indvars.iv.next91.1, %.lr.ph66 ]
  %lcmp.mod121.not = icmp eq i64 %xtraiter119, 0
  br i1 %lcmp.mod121.not, label %.preheader56, label %.lr.ph66.epil

.lr.ph66.epil:                                    ; preds = %.preheader56.loopexit.unr-lcssa
  %42 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %indvars.iv90.unr
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv90.unr
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv90.unr
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %46, i64 %49
  store i32 %43, ptr %50, align 4, !tbaa !5
  %51 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %49, i64 %46
  store i32 %43, ptr %51, align 4, !tbaa !5
  br label %.preheader56

.preheader56:                                     ; preds = %.lr.ph66.epil, %.preheader56.loopexit.unr-lcssa, %.preheader57
  br i1 %19, label %.preheader55, label %._crit_edge74

.lr.ph66:                                         ; preds = %.lr.ph66, %.lr.ph66.preheader.new
  %indvars.iv90 = phi i64 [ 0, %.lr.ph66.preheader.new ], [ %indvars.iv.next91.1, %.lr.ph66 ]
  %niter123 = phi i64 [ 0, %.lr.ph66.preheader.new ], [ %niter123.next.1, %.lr.ph66 ]
  %52 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %indvars.iv90
  %53 = load i32, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv90
  %55 = load i32, ptr %54, align 8, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv90
  %58 = load i32, ptr %57, align 8, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %56, i64 %59
  store i32 %53, ptr %60, align 4, !tbaa !5
  %61 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %59, i64 %56
  store i32 %53, ptr %61, align 4, !tbaa !5
  %indvars.iv.next91 = or disjoint i64 %indvars.iv90, 1
  %62 = getelementptr inbounds [100010 x i32], ptr @C, i64 0, i64 %indvars.iv.next91
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = getelementptr inbounds [100010 x i32], ptr @A, i64 0, i64 %indvars.iv.next91
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100010 x i32], ptr @B, i64 0, i64 %indvars.iv.next91
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %66, i64 %69
  store i32 %63, ptr %70, align 4, !tbaa !5
  %71 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %69, i64 %66
  store i32 %63, ptr %71, align 4, !tbaa !5
  %indvars.iv.next91.1 = add nuw nsw i64 %indvars.iv90, 2
  %niter123.next.1 = add i64 %niter123, 2
  %niter123.ncmp.1 = icmp eq i64 %niter123.next.1, %unroll_iter122
  br i1 %niter123.ncmp.1, label %.preheader56.loopexit.unr-lcssa, label %.lr.ph66, !llvm.loop !15

.preheader55:                                     ; preds = %.preheader56, %._crit_edge72
  %72 = phi i32 [ %77, %._crit_edge72 ], [ %18, %.preheader56 ]
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %._crit_edge72 ], [ 0, %.preheader56 ]
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph71, label %._crit_edge72

._crit_edge74:                                    ; preds = %._crit_edge72, %.preheader56
  %74 = load i32, ptr @R, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr @r, i64 %75
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @r, ptr noundef nonnull %76)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 1000000007, ptr %2, align 4, !tbaa !5
  br label %109

._crit_edge72:                                    ; preds = %.loopexit, %.preheader55
  %77 = phi i32 [ %72, %.preheader55 ], [ %105, %.loopexit ]
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %78 = sext i32 %77 to i64
  %79 = icmp slt i64 %indvars.iv.next102, %78
  br i1 %79, label %.preheader55, label %._crit_edge74, !llvm.loop !16

.lr.ph71:                                         ; preds = %.preheader55, %.loopexit
  %80 = phi i32 [ %105, %.loopexit ], [ %72, %.preheader55 ]
  %81 = phi i32 [ %106, %.loopexit ], [ %72, %.preheader55 ]
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.loopexit ], [ 0, %.preheader55 ]
  %82 = icmp ne i64 %indvars.iv101, %indvars.iv98
  %83 = icmp sgt i32 %81, 0
  %or.cond81 = and i1 %82, %83
  br i1 %or.cond81, label %.lr.ph68, label %.loopexit

.lr.ph68:                                         ; preds = %.lr.ph71
  %84 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv98, i64 %indvars.iv101
  br label %85

85:                                               ; preds = %.lr.ph68, %99
  %86 = phi i32 [ %80, %.lr.ph68 ], [ %100, %99 ]
  %87 = phi i32 [ %81, %.lr.ph68 ], [ %101, %99 ]
  %88 = phi i32 [ %81, %.lr.ph68 ], [ %102, %99 ]
  %indvars.iv95 = phi i64 [ 0, %.lr.ph68 ], [ %indvars.iv.next96, %99 ]
  %89 = icmp eq i64 %indvars.iv98, %indvars.iv95
  %90 = icmp eq i64 %indvars.iv101, %indvars.iv95
  %or.cond = or i1 %89, %90
  br i1 %or.cond, label %99, label %91

91:                                               ; preds = %85
  %92 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv98, i64 %indvars.iv95
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %93 = load i32, ptr %84, align 4, !tbaa !5
  %94 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %indvars.iv101, i64 %indvars.iv95
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = add nsw i32 %95, %93
  store i32 %96, ptr %1, align 4, !tbaa !5
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %92, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %98 = load i32, ptr %97, align 4, !tbaa !5
  store i32 %98, ptr %92, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %.pre = load i32, ptr @N, align 4
  br label %99

99:                                               ; preds = %85, %91
  %100 = phi i32 [ %86, %85 ], [ %.pre, %91 ]
  %101 = phi i32 [ %87, %85 ], [ %.pre, %91 ]
  %102 = phi i32 [ %88, %85 ], [ %.pre, %91 ]
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %103 = sext i32 %102 to i64
  %104 = icmp slt i64 %indvars.iv.next96, %103
  br i1 %104, label %85, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %99, %.lr.ph71
  %105 = phi i32 [ %80, %.lr.ph71 ], [ %100, %99 ]
  %106 = phi i32 [ %81, %.lr.ph71 ], [ %101, %99 ]
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %107 = sext i32 %106 to i64
  %108 = icmp slt i64 %indvars.iv.next99, %107
  br i1 %108, label %.lr.ph71, label %._crit_edge72, !llvm.loop !19

109:                                              ; preds = %._crit_edge79, %._crit_edge74
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %110 = load i32, ptr @R, align 4, !tbaa !5
  %111 = icmp sgt i32 %110, 1
  br i1 %111, label %.lr.ph78.preheader, label %._crit_edge79

.lr.ph78.preheader:                               ; preds = %109
  %112 = add nsw i32 %110, -1
  %wide.trip.count107 = zext nneg i32 %112 to i64
  %.pre109 = load i32, ptr @r, align 16, !tbaa !5
  %113 = add nsw i64 %wide.trip.count107, -1
  %xtraiter124 = and i64 %wide.trip.count107, 3
  %114 = icmp ult i64 %113, 3
  br i1 %114, label %._crit_edge79.loopexit.unr-lcssa, label %.lr.ph78.preheader.new

.lr.ph78.preheader.new:                           ; preds = %.lr.ph78.preheader
  %unroll_iter128 = and i64 %wide.trip.count107, 2147483644
  br label %.lr.ph78

._crit_edge79.loopexit.unr-lcssa:                 ; preds = %.lr.ph78, %.lr.ph78.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph78.preheader ], [ %157, %.lr.ph78 ]
  %.unr = phi i32 [ %.pre109, %.lr.ph78.preheader ], [ %153, %.lr.ph78 ]
  %indvars.iv104.unr = phi i64 [ 0, %.lr.ph78.preheader ], [ %indvars.iv.next105.3, %.lr.ph78 ]
  %storemerge75.unr = phi i32 [ 0, %.lr.ph78.preheader ], [ %157, %.lr.ph78 ]
  %lcmp.mod126.not = icmp eq i64 %xtraiter124, 0
  br i1 %lcmp.mod126.not, label %._crit_edge79, label %.lr.ph78.epil

.lr.ph78.epil:                                    ; preds = %._crit_edge79.loopexit.unr-lcssa, %.lr.ph78.epil
  %115 = phi i32 [ %118, %.lr.ph78.epil ], [ %.unr, %._crit_edge79.loopexit.unr-lcssa ]
  %indvars.iv104.epil = phi i64 [ %indvars.iv.next105.epil, %.lr.ph78.epil ], [ %indvars.iv104.unr, %._crit_edge79.loopexit.unr-lcssa ]
  %storemerge75.epil = phi i32 [ %122, %.lr.ph78.epil ], [ %storemerge75.unr, %._crit_edge79.loopexit.unr-lcssa ]
  %epil.iter125 = phi i64 [ %epil.iter125.next, %.lr.ph78.epil ], [ 0, %._crit_edge79.loopexit.unr-lcssa ]
  %116 = sext i32 %115 to i64
  %indvars.iv.next105.epil = add nuw nsw i64 %indvars.iv104.epil, 1
  %117 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %indvars.iv.next105.epil
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %116, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = add nsw i32 %121, %storemerge75.epil
  %epil.iter125.next = add i64 %epil.iter125, 1
  %epil.iter125.cmp.not = icmp eq i64 %epil.iter125.next, %xtraiter124
  br i1 %epil.iter125.cmp.not, label %._crit_edge79, label %.lr.ph78.epil, !llvm.loop !20

._crit_edge79:                                    ; preds = %._crit_edge79.loopexit.unr-lcssa, %.lr.ph78.epil, %109
  %storemerge.lcssa = phi i32 [ 0, %109 ], [ %.lcssa.ph, %._crit_edge79.loopexit.unr-lcssa ], [ %122, %.lr.ph78.epil ]
  store i32 %storemerge.lcssa, ptr %3, align 4, !tbaa !5
  %123 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %124 = load i32, ptr %123, align 4, !tbaa !5
  store i32 %124, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %125 = load i32, ptr @R, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i32, ptr @r, i64 %126
  %128 = call noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef nonnull @r, ptr noundef nonnull %127)
  br i1 %128, label %109, label %158, !llvm.loop !21

.lr.ph78:                                         ; preds = %.lr.ph78, %.lr.ph78.preheader.new
  %129 = phi i32 [ %.pre109, %.lr.ph78.preheader.new ], [ %153, %.lr.ph78 ]
  %indvars.iv104 = phi i64 [ 0, %.lr.ph78.preheader.new ], [ %indvars.iv.next105.3, %.lr.ph78 ]
  %storemerge75 = phi i32 [ 0, %.lr.ph78.preheader.new ], [ %157, %.lr.ph78 ]
  %niter129 = phi i64 [ 0, %.lr.ph78.preheader.new ], [ %niter129.next.3, %.lr.ph78 ]
  %130 = sext i32 %129 to i64
  %indvars.iv.next105 = or disjoint i64 %indvars.iv104, 1
  %131 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %indvars.iv.next105
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %130, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = add nsw i32 %135, %storemerge75
  %137 = sext i32 %132 to i64
  %indvars.iv.next105.1 = or disjoint i64 %indvars.iv104, 2
  %138 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %indvars.iv.next105.1
  %139 = load i32, ptr %138, align 8, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %137, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = add nsw i32 %142, %136
  %144 = sext i32 %139 to i64
  %indvars.iv.next105.2 = or disjoint i64 %indvars.iv104, 3
  %145 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %indvars.iv.next105.2
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %144, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = add nsw i32 %149, %143
  %151 = sext i32 %146 to i64
  %indvars.iv.next105.3 = add nuw nsw i64 %indvars.iv104, 4
  %152 = getelementptr inbounds [10 x i32], ptr @r, i64 0, i64 %indvars.iv.next105.3
  %153 = load i32, ptr %152, align 16, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [210 x [210 x i32]], ptr @dist, i64 0, i64 %151, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = add nsw i32 %156, %150
  %niter129.next.3 = add i64 %niter129, 4
  %niter129.ncmp.3 = icmp eq i64 %niter129.next.3, %unroll_iter128
  br i1 %niter129.ncmp.3, label %._crit_edge79.loopexit.unr-lcssa, label %.lr.ph78, !llvm.loop !22

158:                                              ; preds = %._crit_edge79
  %159 = load i32, ptr %2, align 4, !tbaa !5
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %159)
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %160, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZSt16next_permutationIPiEbT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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


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