; LLVM IR from tangjz/acm-icpc :: codeforces/complete (924E)

; 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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [157 x i64] }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@a = external dso_local global [10001 x i32], align 16
@b = external dso_local global [10001 x i32], align 16
@s = external dso_local global [10001 x i32], align 16
@lbt = external dso_local global [65537 x i32], align 16
@mx = external dso_local global i32, align 4
@msk = external dso_local global { [157 x i64] }, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6lowBitRKSt6bitsetILm10001EERKmS4_(ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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 %"class.std::bitset", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::bitset", align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::bitset", align 8
  %18 = alloca i32, align 4
  %19 = alloca %"class.std::bitset", align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  store i32 -1, ptr @lbt, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %43, %0
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp slt i32 %23, 65537
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = and i32 %27, 1
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  br label %38

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = ashr i32 %32, 1
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  br label %38

38:                                               ; preds = %31, %30
  %39 = phi i32 [ 0, %30 ], [ %37, %31 ]
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %41
  store i32 %39, ptr %42, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %38
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !9

46:                                               ; preds = %25
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @L, ptr noundef @R)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %58, %46
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = icmp sle i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %61

53:                                               ; preds = %48
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr @a, i64 %55
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %56)
  br label %58

58:                                               ; preds = %53
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %3, align 4, !tbaa !5
  br label %48, !llvm.loop !11

61:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %62 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %62, ptr %4, align 4, !tbaa !5
  store i32 0, ptr @n, align 4, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef 0, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  br label %64

64:                                               ; preds = %98, %61
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %6)
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %82

73:                                               ; preds = %69
  %74 = load i32, ptr %5, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr @n, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr @n, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %80
  store i32 %77, ptr %81, align 4, !tbaa !5
  br label %97

82:                                               ; preds = %69
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr @m, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr @m, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %89
  store i32 %86, ptr %90, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1256, ptr %7) #7
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %7, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %95) #7
  %96 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %7) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr %7) #7
  br label %97

97:                                               ; preds = %82, %73
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %5, align 4, !tbaa !5
  br label %64, !llvm.loop !12

101:                                              ; preds = %68
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr @a, i64 %103
  %105 = getelementptr inbounds i32, ptr %104, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef getelementptr inbounds (i32, ptr @a, i64 1), ptr noundef %105)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %125, %101
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = icmp sle i32 %107, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %128

111:                                              ; preds = %106
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = add nsw i32 %116, %120
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %123
  store i32 %121, ptr %124, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %111
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %8, align 4, !tbaa !5
  br label %106, !llvm.loop !13

128:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %129 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %129, ptr %9, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %166, %128
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = load i32, ptr @mx, align 4, !tbaa !5
  %133 = icmp sgt i32 %131, %132
  br i1 %133, label %135, label %134

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

135:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %136 = load i32, ptr @L, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  store i64 %137, ptr %11, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %138 = load i32, ptr @R, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  store i64 %139, ptr %12, align 8, !tbaa !14
  %140 = call noundef i32 @_Z6lowBitRKSt6bitsetILm10001EERKmS4_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  store i32 %140, ptr %10, align 4, !tbaa !5
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = icmp ne i32 %141, -1
  br i1 %142, label %143, label %159

143:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i32, ptr @s, i64 %145
  %147 = getelementptr inbounds i32, ptr %146, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %148 = load i32, ptr @R, align 4, !tbaa !5
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = sub nsw i32 %148, %149
  store i32 %150, ptr %14, align 4, !tbaa !5
  %151 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @s, ptr noundef %147, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %152 = ptrtoint ptr %151 to i64
  %153 = sub i64 %152, ptrtoint (ptr @s to i64)
  %154 = sdiv exact i64 %153, 4
  %155 = sub nsw i64 %154, 1
  %156 = trunc i64 %155 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  store i32 %156, ptr %13, align 4, !tbaa !5
  %157 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %158 = load i32, ptr %157, align 4, !tbaa !5
  store i32 %158, ptr @mx, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %159

159:                                              ; preds = %143, %135
  call void @llvm.lifetime.start.p0(i64 1256, ptr %15) #7
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %15, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %164) #7
  %165 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %15) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %166

166:                                              ; preds = %159
  %167 = load i32, ptr %9, align 4, !tbaa !5
  %168 = add nsw i32 %167, -1
  store i32 %168, ptr %9, align 4, !tbaa !5
  br label %130, !llvm.loop !16

169:                                              ; preds = %134
  %170 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) @msk) #7
  %171 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef 0, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %172 = load i32, ptr @mx, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %16, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %186, %169
  %175 = load i32, ptr %16, align 4, !tbaa !5
  %176 = load i32, ptr @n, align 4, !tbaa !5
  %177 = icmp sle i32 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %189

179:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 1256, ptr %17) #7
  %180 = load i32, ptr %16, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %17, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %184) #7
  %185 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %17) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr %17) #7
  br label %186

186:                                              ; preds = %179
  %187 = load i32, ptr %16, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %16, align 4, !tbaa !5
  br label %174, !llvm.loop !17

189:                                              ; preds = %178
  %190 = load i32, ptr @n, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = load i32, ptr @mx, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = sub nsw i32 %193, %197
  %199 = sext i32 %198 to i64
  %200 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEm(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %199)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 1, ptr %18, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %213, %189
  %202 = load i32, ptr %18, align 4, !tbaa !5
  %203 = load i32, ptr @m, align 4, !tbaa !5
  %204 = icmp sle i32 %202, %203
  br i1 %204, label %206, label %205

205:                                              ; preds = %201
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %216

206:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 1256, ptr %19) #7
  %207 = load i32, ptr %18, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %19, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %211) #7
  %212 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %19) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr %19) #7
  br label %213

213:                                              ; preds = %206
  %214 = load i32, ptr %18, align 4, !tbaa !5
  %215 = add nsw i32 %214, 1
  store i32 %215, ptr %18, align 4, !tbaa !5
  br label %201, !llvm.loop !18

216:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %217 = load i32, ptr @L, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  store i64 %218, ptr %20, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %219 = load i32, ptr @R, align 4, !tbaa !5
  %220 = load i32, ptr @mx, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %221
  %223 = load i32, ptr %222, align 4, !tbaa !5
  %224 = sub nsw i32 %219, %223
  %225 = sext i32 %224 to i64
  store i64 %225, ptr %21, align 8, !tbaa !14
  %226 = call noundef i32 @_Z6lowBitRKSt6bitsetILm10001EERKmS4_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %227 = icmp ne i32 %226, -1
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br i1 %227, label %228, label %231

228:                                              ; preds = %216
  %229 = load i32, ptr @mx, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr @mx, align 4, !tbaa !5
  br label %231

231:                                              ; preds = %228, %216
  %232 = load i32, ptr @mx, align 4, !tbaa !5
  %233 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %232)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef, i1 noundef zeroext) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(1256)) #0 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) #4 align 2

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = { 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 #6 = { 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 #7 = { 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 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!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::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [157 x i64] }

@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@a = external dso_local global [10001 x i32], align 16
@b = external dso_local local_unnamed_addr global [10001 x i32], align 16
@s = external dso_local global [10001 x i32], align 16
@lbt = external dso_local local_unnamed_addr global [65537 x i32], align 16
@mx = external dso_local global i32, align 4
@msk = external dso_local global { [157 x i64] }, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6lowBitRKSt6bitsetILm10001EERKmS4_(ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::bitset", align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::bitset", align 8
  %8 = alloca %"class.std::bitset", align 8
  %9 = alloca %"class.std::bitset", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store i32 -1, ptr @lbt, align 16, !tbaa !5
  br label %16

12:                                               ; preds = %16
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @L, ptr noundef nonnull @R)
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %.not52 = icmp slt i32 %14, 1
  br i1 %.not52, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %12
  store i32 0, ptr @n, align 4, !tbaa !5
  %15 = tail call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef 0, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  br label %._crit_edge58

16:                                               ; preds = %16, %0
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %16 ]
  %17 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %indvars.iv
  store i32 0, ptr %17, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = lshr exact i64 %indvars.iv.next, 1
  %19 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  %22 = getelementptr inbounds [65537 x i32], ptr @lbt, i64 0, i64 %indvars.iv.next
  store i32 %21, ptr %22, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 65537
  br i1 %exitcond.not.1, label %12, label %16, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph
  store i32 0, ptr @n, align 4, !tbaa !5
  %23 = tail call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef 0, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %.not4154 = icmp slt i32 %27, 1
  br i1 %.not4154, label %._crit_edge58, label %.lr.ph57.preheader

.lr.ph57.preheader:                               ; preds = %._crit_edge
  %24 = add nuw i32 %27, 1
  %wide.trip.count = zext i32 %24 to i64
  br label %.lr.ph57

.lr.ph:                                           ; preds = %12, %.lr.ph
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph ], [ 1, %12 ]
  %25 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv81
  %26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %25)
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %.not.not = icmp slt i64 %indvars.iv81, %28
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge58:                                    ; preds = %52, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr @a, i64 %30
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 4), ptr noundef nonnull %32)
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %.not4259 = icmp slt i32 %33, 1
  br i1 %.not4259, label %.preheader, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %._crit_edge58
  %.pre = load i32, ptr @s, align 16, !tbaa !5
  %34 = zext nneg i32 %33 to i64
  %xtraiter = and i64 %34, 3
  %35 = icmp ult i32 %33, 4
  br i1 %35, label %.preheader.loopexit.unr-lcssa, label %.lr.ph62.preheader.new

.lr.ph62.preheader.new:                           ; preds = %.lr.ph62.preheader
  %unroll_iter = and i64 %34, 2147483644
  br label %.lr.ph62

.lr.ph57:                                         ; preds = %.lr.ph57.preheader, %52
  %indvars.iv84 = phi i64 [ 1, %.lr.ph57.preheader ], [ %indvars.iv.next85, %52 ]
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %.not47 = icmp eq i32 %37, 0
  %38 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv84
  %39 = load i32, ptr %38, align 4, !tbaa !5
  br i1 %.not47, label %45, label %40

40:                                               ; preds = %.lr.ph57
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr @n, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %43
  store i32 %39, ptr %44, align 4, !tbaa !5
  br label %52

45:                                               ; preds = %.lr.ph57
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr @m, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %48
  store i32 %39, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1256, ptr nonnull %2) #7
  %50 = sext i32 %39 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %2, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %50) #7
  %51 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %2) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr nonnull %2) #7
  br label %52

52:                                               ; preds = %40, %45
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count
  br i1 %exitcond87.not, label %._crit_edge58, label %.lr.ph57, !llvm.loop !12

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph62, %.lr.ph62.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph62.preheader ], [ %76, %.lr.ph62 ]
  %indvars.iv88.unr = phi i64 [ 1, %.lr.ph62.preheader ], [ %indvars.iv.next89.3, %.lr.ph62 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph62.epil

.lr.ph62.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph62.epil
  %53 = phi i32 [ %56, %.lr.ph62.epil ], [ %.unr, %.preheader.loopexit.unr-lcssa ]
  %indvars.iv88.epil = phi i64 [ %indvars.iv.next89.epil, %.lr.ph62.epil ], [ %indvars.iv88.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph62.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %54 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv88.epil
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, %53
  %57 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %indvars.iv88.epil
  store i32 %56, ptr %57, align 4, !tbaa !5
  %indvars.iv.next89.epil = add nuw nsw i64 %indvars.iv88.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 %.preheader, label %.lr.ph62.epil, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph62.epil, %._crit_edge58
  %58 = load i32, ptr @mx, align 4, !tbaa !5
  %59 = icmp sgt i32 %33, %58
  br i1 %59, label %.lr.ph65.preheader, label %._crit_edge66

.lr.ph65.preheader:                               ; preds = %.preheader
  %60 = sext i32 %33 to i64
  br label %.lr.ph65

.lr.ph62:                                         ; preds = %.lr.ph62, %.lr.ph62.preheader.new
  %61 = phi i32 [ %.pre, %.lr.ph62.preheader.new ], [ %76, %.lr.ph62 ]
  %indvars.iv88 = phi i64 [ 1, %.lr.ph62.preheader.new ], [ %indvars.iv.next89.3, %.lr.ph62 ]
  %niter = phi i64 [ 0, %.lr.ph62.preheader.new ], [ %niter.next.3, %.lr.ph62 ]
  %62 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv88
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, %61
  %65 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %indvars.iv88
  store i32 %64, ptr %65, align 4, !tbaa !5
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %66 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv.next89
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, %64
  %69 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %indvars.iv.next89
  store i32 %68, ptr %69, align 4, !tbaa !5
  %indvars.iv.next89.1 = add nuw nsw i64 %indvars.iv88, 2
  %70 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv.next89.1
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %71, %68
  %73 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %indvars.iv.next89.1
  store i32 %72, ptr %73, align 4, !tbaa !5
  %indvars.iv.next89.2 = add nuw nsw i64 %indvars.iv88, 3
  %74 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv.next89.2
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = add nsw i32 %75, %72
  %77 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %indvars.iv.next89.2
  store i32 %76, ptr %77, align 4, !tbaa !5
  %indvars.iv.next89.3 = add nuw nsw i64 %indvars.iv88, 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 %.preheader.loopexit.unr-lcssa, label %.lr.ph62, !llvm.loop !15

._crit_edge66:                                    ; preds = %99, %.preheader
  %78 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256) @msk) #7
  %79 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef 0, i1 noundef zeroext true)
  %80 = load i32, ptr @mx, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %.not43.not67 = icmp slt i32 %80, %81
  br i1 %.not43.not67, label %.lr.ph70.preheader, label %._crit_edge66.._crit_edge71_crit_edge

._crit_edge66.._crit_edge71_crit_edge:            ; preds = %._crit_edge66
  %.pre104 = sext i32 %81 to i64
  br label %._crit_edge71

.lr.ph70.preheader:                               ; preds = %._crit_edge66
  %82 = sext i32 %80 to i64
  br label %.lr.ph70

.lr.ph65:                                         ; preds = %.lr.ph65.preheader, %99
  %indvars.iv93 = phi i64 [ %60, %.lr.ph65.preheader ], [ %indvars.iv.next94, %99 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %83 = load i32, ptr @L, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  store i64 %84, ptr %3, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %85 = load i32, ptr @R, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  store i64 %86, ptr %4, align 8, !tbaa !16
  %87 = call noundef i32 @_Z6lowBitRKSt6bitsetILm10001EERKmS4_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %.not46 = icmp eq i32 %87, -1
  br i1 %.not46, label %99, label %88

88:                                               ; preds = %.lr.ph65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @s, i64 4), i64 %indvars.iv93
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %89 = load i32, ptr @R, align 4, !tbaa !5
  %90 = sub nsw i32 %89, %87
  store i32 %90, ptr %6, align 4, !tbaa !5
  %91 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @s, ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %92 = ptrtoint ptr %91 to i64
  %93 = sub i64 %92, ptrtoint (ptr @s to i64)
  %94 = lshr exact i64 %93, 2
  %95 = trunc i64 %94 to i32
  %96 = add i32 %95, -1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  store i32 %96, ptr %5, align 4, !tbaa !5
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %98 = load i32, ptr %97, align 4, !tbaa !5
  store i32 %98, ptr @mx, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %99

99:                                               ; preds = %88, %.lr.ph65
  call void @llvm.lifetime.start.p0(i64 1256, ptr nonnull %7) #7
  %100 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv93
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %7, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %102) #7
  %103 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %7) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr nonnull %7) #7
  %indvars.iv.next94 = add nsw i64 %indvars.iv93, -1
  %104 = load i32, ptr @mx, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = icmp sgt i64 %indvars.iv.next94, %105
  br i1 %106, label %.lr.ph65, label %._crit_edge66, !llvm.loop !18

._crit_edge71.loopexit:                           ; preds = %.lr.ph70
  %.pre102 = load i32, ptr @mx, align 4, !tbaa !5
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge66.._crit_edge71_crit_edge, %._crit_edge71.loopexit
  %.pre-phi = phi i64 [ %.pre104, %._crit_edge66.._crit_edge71_crit_edge ], [ %122, %._crit_edge71.loopexit ]
  %107 = phi i32 [ %80, %._crit_edge66.._crit_edge71_crit_edge ], [ %.pre102, %._crit_edge71.loopexit ]
  %108 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %.pre-phi
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %107 to i64
  %111 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sub nsw i32 %109, %112
  %114 = sext i32 %113 to i64
  %115 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEm(ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %114)
  %116 = load i32, ptr @m, align 4, !tbaa !5
  %.not4473 = icmp slt i32 %116, 1
  br i1 %.not4473, label %._crit_edge77, label %.lr.ph76

.lr.ph70:                                         ; preds = %.lr.ph70.preheader, %.lr.ph70
  %indvars.iv96 = phi i64 [ %82, %.lr.ph70.preheader ], [ %indvars.iv.next97, %.lr.ph70 ]
  %indvars.iv.next97 = add nsw i64 %indvars.iv96, 1
  call void @llvm.lifetime.start.p0(i64 1256, ptr nonnull %8) #7
  %117 = getelementptr inbounds [10001 x i32], ptr @a, i64 0, i64 %indvars.iv.next97
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %8, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %119) #7
  %120 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %8) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr nonnull %8) #7
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %.not43.not = icmp slt i64 %indvars.iv.next97, %122
  br i1 %.not43.not, label %.lr.ph70, label %._crit_edge71.loopexit, !llvm.loop !19

._crit_edge77:                                    ; preds = %.lr.ph76, %._crit_edge71
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %123 = load i32, ptr @L, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  store i64 %124, ptr %10, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %125 = load i32, ptr @R, align 4, !tbaa !5
  %126 = load i32, ptr @mx, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [10001 x i32], ptr @s, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sub nsw i32 %125, %129
  %131 = sext i32 %130 to i64
  store i64 %131, ptr %11, align 8, !tbaa !16
  %132 = call noundef i32 @_Z6lowBitRKSt6bitsetILm10001EERKmS4_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %.not45 = icmp eq i32 %132, -1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %.pre103 = load i32, ptr @mx, align 4, !tbaa !5
  br i1 %.not45, label %141, label %139

.lr.ph76:                                         ; preds = %._crit_edge71, %.lr.ph76
  %indvars.iv99 = phi i64 [ %indvars.iv.next100, %.lr.ph76 ], [ 1, %._crit_edge71 ]
  call void @llvm.lifetime.start.p0(i64 1256, ptr nonnull %9) #7
  %133 = getelementptr inbounds [10001 x i32], ptr @b, i64 0, i64 %indvars.iv99
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  call void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %9, ptr noundef nonnull align 8 dereferenceable(1256) @msk, i64 noundef %135) #7
  %136 = call noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256) @msk, ptr noundef nonnull align 8 dereferenceable(1256) %9) #7
  call void @llvm.lifetime.end.p0(i64 1256, ptr nonnull %9) #7
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %137 = load i32, ptr @m, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %.not44.not = icmp slt i64 %indvars.iv99, %138
  br i1 %.not44.not, label %.lr.ph76, label %._crit_edge77, !llvm.loop !20

139:                                              ; preds = %._crit_edge77
  %140 = add nsw i32 %.pre103, 1
  store i32 %140, ptr @mx, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %139, %._crit_edge77
  %142 = phi i32 [ %140, %139 ], [ %.pre103, %._crit_edge77 ]
  %143 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %142)
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE3setEmb(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef, i1 noundef zeroext) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt6bitsetILm10001EElsEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(1256), ptr noundef nonnull align 8 dereferenceable(1256)) local_unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEv(ptr noundef nonnull align 8 dereferenceable(1256)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(1256) ptr @_ZNSt6bitsetILm10001EE5resetEm(ptr noundef nonnull align 8 dereferenceable(1256), i64 noundef) local_unnamed_addr #4 align 2

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

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


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