; LLVM IR from tangjz/acm-icpc :: hdu (6085)

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

%struct.Bitset = type { i32, [782 x i64] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@a = external dso_local global [50001 x i32], align 16
@b = external dso_local global [50001 x i32], align 16
@mx1 = external dso_local global i32, align 4
@mx2 = external dso_local global i32, align 4
@c = external dso_local global [65 x i32], align 16
@A = external dso_local global %struct.Bitset, align 8
@B = external dso_local global %struct.Bitset, align 8
@C = external dso_local global %struct.Bitset, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

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

15:                                               ; preds = %228, %0
  %16 = load i32, ptr @t, align 4, !tbaa !5
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr @t, align 4, !tbaa !5
  %18 = icmp ne i32 %16, 0
  br i1 %18, label %19, label %229

19:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %28, %19
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = icmp slt i32 %21, 65
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %31

24:                                               ; preds = %20
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [65 x i32], ptr @c, i64 0, i64 %26
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %24
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !9

31:                                               ; preds = %23
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m, ptr noundef @q)
  store i32 0, ptr @mx1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %57, %31
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %60

38:                                               ; preds = %33
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr @a, i64 %40
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %41)
  %43 = load i32, ptr @mx1, align 4, !tbaa !5
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = icmp slt i32 %43, %47
  br i1 %48, label %49, label %55

49:                                               ; preds = %38
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  store i32 %53, ptr @mx1, align 4, !tbaa !5
  %54 = icmp ne i32 %53, 0
  br label %55

55:                                               ; preds = %49, %38
  %56 = phi i1 [ false, %38 ], [ %54, %49 ]
  br label %57

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

60:                                               ; preds = %37
  %61 = load i32, ptr @mx1, align 4, !tbaa !5
  %62 = ashr i32 %61, 6
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr @A, align 8, !tbaa !12
  call void @_ZN6Bitset5resetEv(ptr noundef nonnull align 8 dereferenceable(6264) @A)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %74, %60
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(6264) @A, i32 noundef %73)
  br label %74

74:                                               ; preds = %69
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !5
  br label %64, !llvm.loop !14

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

78:                                               ; preds = %102, %77
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = load i32, ptr @m, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %105

83:                                               ; preds = %78
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i32, ptr @b, i64 %85
  %87 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %86)
  %88 = load i32, ptr @mx2, align 4, !tbaa !5
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = icmp slt i32 %88, %92
  br i1 %93, label %94, label %100

94:                                               ; preds = %83
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  store i32 %98, ptr @mx2, align 4, !tbaa !5
  %99 = icmp ne i32 %98, 0
  br label %100

100:                                              ; preds = %94, %83
  %101 = phi i1 [ false, %83 ], [ %99, %94 ]
  br label %102

102:                                              ; preds = %100
  %103 = load i32, ptr %5, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %5, align 4, !tbaa !5
  br label %78, !llvm.loop !15

105:                                              ; preds = %82
  %106 = load i32, ptr @mx2, align 4, !tbaa !5
  %107 = sub nsw i32 %106, 1
  %108 = ashr i32 %107, 6
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @B, align 8, !tbaa !12
  call void @_ZN6Bitset5resetEv(ptr noundef nonnull align 8 dereferenceable(6264) @B)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %173, %105
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = load i32, ptr @m, align 4, !tbaa !5
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %176

115:                                              ; preds = %110
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = icmp slt i32 %119, 65
  br i1 %120, label %121, label %130

121:                                              ; preds = %115
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [65 x i32], ptr @c, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %127, align 4, !tbaa !5
  br label %173

130:                                              ; preds = %115
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sub nsw i32 %134, 1
  %136 = ashr i32 %135, 6
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr @C, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %165, %130
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = load i32, ptr @mx1, align 4, !tbaa !5
  %141 = icmp sle i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %172

143:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %144 = load i32, ptr %8, align 4, !tbaa !5
  %145 = load i32, ptr %6, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = add nsw i32 %144, %148
  %150 = sub nsw i32 %149, 1
  %151 = load i32, ptr @mx1, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %153, label %161

153:                                              ; preds = %143
  %154 = load i32, ptr %8, align 4, !tbaa !5
  %155 = load i32, ptr %6, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !5
  %159 = add nsw i32 %154, %158
  %160 = sub nsw i32 %159, 1
  br label %163

161:                                              ; preds = %143
  %162 = load i32, ptr @mx1, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %161, %153
  %164 = phi i32 [ %160, %153 ], [ %162, %161 ]
  store i32 %164, ptr %9, align 4, !tbaa !5
  call void @_ZN6Bitset3getERKS_RKiS3_(ptr noundef nonnull align 8 dereferenceable(6264) @C, ptr noundef nonnull align 8 dereferenceable(6264) @A, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @_ZN6BitseteOERKS_(ptr noundef nonnull align 8 dereferenceable(6264) @B, ptr noundef nonnull align 8 dereferenceable(6264) @C)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %165

165:                                              ; preds = %163
  %166 = load i32, ptr %6, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = load i32, ptr %8, align 4, !tbaa !5
  %171 = add nsw i32 %170, %169
  store i32 %171, ptr %8, align 4, !tbaa !5
  br label %138, !llvm.loop !16

172:                                              ; preds = %142
  br label %173

173:                                              ; preds = %172, %121
  %174 = load i32, ptr %6, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %6, align 4, !tbaa !5
  br label %110, !llvm.loop !17

176:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %177

177:                                              ; preds = %206, %176
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = icmp slt i32 %178, 65
  br i1 %179, label %181, label %180

180:                                              ; preds = %177
  store i32 22, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %209

181:                                              ; preds = %177
  %182 = load i32, ptr %10, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [65 x i32], ptr @c, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = and i32 %185, 1
  %187 = icmp ne i32 %186, 0
  br i1 %187, label %188, label %205

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

189:                                              ; preds = %201, %188
  %190 = load i32, ptr %11, align 4, !tbaa !5
  %191 = load i32, ptr @n, align 4, !tbaa !5
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

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

194:                                              ; preds = %189
  %195 = load i32, ptr %11, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = load i32, ptr %10, align 4, !tbaa !5
  %200 = srem i32 %198, %199
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(6264) @B, i32 noundef %200)
  br label %201

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

204:                                              ; preds = %193
  br label %205

205:                                              ; preds = %204, %181
  br label %206

206:                                              ; preds = %205
  %207 = load i32, ptr %10, align 4, !tbaa !5
  %208 = add nsw i32 %207, 1
  store i32 %208, ptr %10, align 4, !tbaa !5
  br label %177, !llvm.loop !19

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

210:                                              ; preds = %225, %209
  %211 = load i32, ptr %12, align 4, !tbaa !5
  %212 = load i32, ptr @q, align 4, !tbaa !5
  %213 = icmp slt i32 %211, %212
  br i1 %213, label %215, label %214

214:                                              ; preds = %210
  store i32 28, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %228

215:                                              ; preds = %210
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %216 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %13)
  %217 = load i32, ptr %13, align 4, !tbaa !5
  %218 = call noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(6264) @B, i32 noundef %217)
  br i1 %218, label %219, label %220

219:                                              ; preds = %215
  br label %221

220:                                              ; preds = %215
  br label %221

221:                                              ; preds = %220, %219
  %222 = phi ptr [ @.str.2, %219 ], [ @.str.3, %220 ]
  %223 = getelementptr inbounds [2 x i8], ptr %222, i64 0, i64 0
  %224 = call i32 @puts(ptr noundef %223)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %225

225:                                              ; preds = %221
  %226 = load i32, ptr %12, align 4, !tbaa !5
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %12, align 4, !tbaa !5
  br label %210, !llvm.loop !20

228:                                              ; preds = %214
  br label %15, !llvm.loop !21

229:                                              ; preds = %15
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset5resetEv(ptr noundef nonnull align 8 dereferenceable(6264)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(6264), i32 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset3getERKS_RKiS3_(ptr noundef nonnull align 8 dereferenceable(6264), ptr noundef nonnull align 8 dereferenceable(6264), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6BitseteOERKS_(ptr noundef nonnull align 8 dereferenceable(6264), ptr noundef nonnull align 8 dereferenceable(6264)) #3 align 2

declare i32 @puts(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(6264), i32 noundef) #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

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

%struct.Bitset = type { i32, [782 x i64] }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@a = external dso_local global [50001 x i32], align 16
@b = external dso_local global [50001 x i32], align 16
@mx1 = external dso_local local_unnamed_addr global i32, align 4
@mx2 = external dso_local local_unnamed_addr global i32, align 4
@c = external dso_local local_unnamed_addr global [65 x i32], align 16
@A = external dso_local global %struct.Bitset, align 8
@B = external dso_local global %struct.Bitset, align 8
@C = external dso_local global %struct.Bitset, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @t, align 4, !tbaa !5
  %.not76 = icmp eq i32 %5, 0
  br i1 %.not76, label %._crit_edge77, label %.preheader51

.loopexit49:                                      ; preds = %.lr.ph75, %.preheader48
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %._crit_edge77, label %.preheader51, !llvm.loop !9

.preheader51:                                     ; preds = %0, %.loopexit49
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(256) getelementptr inbounds (i8, ptr @c, i64 4), i8 0, i64 256, i1 false), !tbaa !5
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @q)
  store i32 0, ptr @mx1, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %23, %.preheader51
  %12 = phi i32 [ 0, %.preheader51 ], [ %24, %23 ]
  %13 = ashr i32 %12, 6
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr @A, align 8, !tbaa !11
  call void @_ZN6Bitset5resetEv(ptr noundef nonnull align 8 dereferenceable(6264) @A)
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph56, label %._crit_edge57

.lr.ph:                                           ; preds = %.preheader51, %23
  %indvars.iv = phi i64 [ %indvars.iv.next, %23 ], [ 0, %.preheader51 ]
  %17 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %17)
  %19 = load i32, ptr @mx1, align 4, !tbaa !5
  %20 = load i32, ptr %17, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %.lr.ph
  store i32 %20, ptr @mx1, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %.lr.ph, %22
  %24 = phi i32 [ %19, %.lr.ph ], [ %20, %22 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge57:                                    ; preds = %.lr.ph56, %._crit_edge
  store i32 0, ptr @mx2, align 4, !tbaa !5
  %28 = load i32, ptr @m, align 4, !tbaa !5
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph60, label %._crit_edge61

.lr.ph56:                                         ; preds = %._crit_edge, %.lr.ph56
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph56 ], [ 0, %._crit_edge ]
  %30 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %indvars.iv81
  %31 = load i32, ptr %30, align 4, !tbaa !5
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(6264) @A, i32 noundef %31)
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next82, %33
  br i1 %34, label %.lr.ph56, label %._crit_edge57, !llvm.loop !14

._crit_edge61:                                    ; preds = %47, %._crit_edge57
  %35 = phi i32 [ 0, %._crit_edge57 ], [ %48, %47 ]
  %36 = add nsw i32 %35, -1
  %37 = ashr i32 %36, 6
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr @B, align 8, !tbaa !11
  call void @_ZN6Bitset5resetEv(ptr noundef nonnull align 8 dereferenceable(6264) @B)
  %39 = load i32, ptr @m, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph69, label %.preheader50

.lr.ph60:                                         ; preds = %._crit_edge57, %47
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %47 ], [ 0, %._crit_edge57 ]
  %41 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv84
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %41)
  %43 = load i32, ptr @mx2, align 4, !tbaa !5
  %44 = load i32, ptr %41, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %.lr.ph60
  store i32 %44, ptr @mx2, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %.lr.ph60, %46
  %48 = phi i32 [ %43, %.lr.ph60 ], [ %44, %46 ]
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next85, %50
  br i1 %51, label %.lr.ph60, label %._crit_edge61, !llvm.loop !15

.preheader50:                                     ; preds = %75, %._crit_edge61
  %.pre96 = load i32, ptr @n, align 4
  br label %81

.lr.ph69:                                         ; preds = %._crit_edge61, %75
  %.pre97 = phi i32 [ %.pre98, %75 ], [ %39, %._crit_edge61 ]
  %52 = phi i32 [ %76, %75 ], [ %39, %._crit_edge61 ]
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %75 ], [ 0, %._crit_edge61 ]
  %53 = getelementptr inbounds [50001 x i32], ptr @b, i64 0, i64 %indvars.iv87
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp slt i32 %54, 65
  br i1 %55, label %56, label %61

56:                                               ; preds = %.lr.ph69
  %57 = sext i32 %54 to i64
  %58 = getelementptr inbounds [65 x i32], ptr @c, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %58, align 4, !tbaa !5
  br label %75

61:                                               ; preds = %.lr.ph69
  %62 = add nsw i32 %54, -1
  %63 = lshr i32 %62, 6
  %64 = add nuw nsw i32 %63, 1
  store i32 %64, ptr @C, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  %65 = load i32, ptr @mx1, align 4, !tbaa !5
  %.not4662 = icmp slt i32 %65, 0
  br i1 %.not4662, label %._crit_edge66, label %.lr.ph65

._crit_edge66.loopexit:                           ; preds = %.lr.ph65
  %.pre.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %._crit_edge66

._crit_edge66:                                    ; preds = %._crit_edge66.loopexit, %61
  %.pre = phi i32 [ %.pre.pre, %._crit_edge66.loopexit ], [ %.pre97, %61 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  br label %75

.lr.ph65:                                         ; preds = %61, %.lr.ph65
  %66 = phi i32 [ %71, %.lr.ph65 ], [ %54, %61 ]
  %67 = phi i32 [ %74, %.lr.ph65 ], [ %65, %61 ]
  %storemerge63 = phi i32 [ %73, %.lr.ph65 ], [ 0, %61 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %68 = add nsw i32 %66, %storemerge63
  %.not47 = icmp sgt i32 %68, %67
  %69 = add nsw i32 %68, -1
  %70 = select i1 %.not47, i32 %67, i32 %69
  store i32 %70, ptr %2, align 4, !tbaa !5
  call void @_ZN6Bitset3getERKS_RKiS3_(ptr noundef nonnull align 8 dereferenceable(6264) @C, ptr noundef nonnull align 8 dereferenceable(6264) @A, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @_ZN6BitseteOERKS_(ptr noundef nonnull align 8 dereferenceable(6264) @B, ptr noundef nonnull align 8 dereferenceable(6264) @C)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %71 = load i32, ptr %53, align 4, !tbaa !5
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = add nsw i32 %72, %71
  store i32 %73, ptr %1, align 4, !tbaa !5
  %74 = load i32, ptr @mx1, align 4, !tbaa !5
  %.not46 = icmp sgt i32 %73, %74
  br i1 %.not46, label %._crit_edge66.loopexit, label %.lr.ph65, !llvm.loop !16

75:                                               ; preds = %._crit_edge66, %56
  %.pre98 = phi i32 [ %.pre, %._crit_edge66 ], [ %.pre97, %56 ]
  %76 = phi i32 [ %.pre, %._crit_edge66 ], [ %52, %56 ]
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next88, %77
  br i1 %78, label %.lr.ph69, label %.preheader50, !llvm.loop !17

.preheader48:                                     ; preds = %.loopexit
  %79 = load i32, ptr @q, align 4, !tbaa !5
  %80 = icmp sgt i32 %79, 0
  br i1 %80, label %.lr.ph75, label %.loopexit49

81:                                               ; preds = %.preheader50, %.loopexit
  %82 = phi i32 [ %.pre96, %.preheader50 ], [ %94, %.loopexit ]
  %indvars.iv93 = phi i64 [ 1, %.preheader50 ], [ %indvars.iv.next94, %.loopexit ]
  %83 = getelementptr inbounds [65 x i32], ptr @c, i64 0, i64 %indvars.iv93
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = and i32 %84, 1
  %.not45 = icmp ne i32 %85, 0
  %86 = icmp sgt i32 %82, 0
  %or.cond = select i1 %.not45, i1 %86, i1 false
  br i1 %or.cond, label %.lr.ph71.preheader, label %.loopexit

.lr.ph71.preheader:                               ; preds = %81
  %87 = trunc nuw nsw i64 %indvars.iv93 to i32
  br label %.lr.ph71

.lr.ph71:                                         ; preds = %.lr.ph71.preheader, %.lr.ph71
  %indvars.iv90 = phi i64 [ 0, %.lr.ph71.preheader ], [ %indvars.iv.next91, %.lr.ph71 ]
  %88 = getelementptr inbounds [50001 x i32], ptr @a, i64 0, i64 %indvars.iv90
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = srem i32 %89, %87
  call void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(6264) @B, i32 noundef %90)
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %91 = load i32, ptr @n, align 4
  %92 = sext i32 %91 to i64
  %93 = icmp slt i64 %indvars.iv.next91, %92
  br i1 %93, label %.lr.ph71, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %.lr.ph71, %81
  %94 = phi i32 [ %82, %81 ], [ %91, %.lr.ph71 ]
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next94, 65
  br i1 %exitcond.not, label %.preheader48, label %81, !llvm.loop !19

.lr.ph75:                                         ; preds = %.preheader48, %.lr.ph75
  %.074 = phi i32 [ %99, %.lr.ph75 ], [ 0, %.preheader48 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %95 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %96 = load i32, ptr %3, align 4, !tbaa !5
  %97 = call noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(6264) @B, i32 noundef %96)
  %.str.2..str.3 = select i1 %97, ptr @.str.2, ptr @.str.3
  %98 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2..str.3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %99 = add nuw nsw i32 %.074, 1
  %100 = load i32, ptr @q, align 4, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %.lr.ph75, label %.loopexit49, !llvm.loop !20

._crit_edge77:                                    ; preds = %.loopexit49, %0
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset5resetEv(ptr noundef nonnull align 8 dereferenceable(6264)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset4flipEi(ptr noundef nonnull align 8 dereferenceable(6264), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6Bitset3getERKS_RKiS3_(ptr noundef nonnull align 8 dereferenceable(6264), ptr noundef nonnull align 8 dereferenceable(6264), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6BitseteOERKS_(ptr noundef nonnull align 8 dereferenceable(6264), ptr noundef nonnull align 8 dereferenceable(6264)) local_unnamed_addr #3 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6Bitset4testEi(ptr noundef nonnull align 8 dereferenceable(6264), i32 noundef) local_unnamed_addr #3 align 2

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

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

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

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


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