; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Week of Code/Week 25/Problem F (F)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [522 x i64] }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%"class.std::bitset<33368>::reference" = type { ptr, i64 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@g = external dso_local global [100100 x %"class.std::vector"], align 16
@suka = external dso_local global [100100 x i32], align 16
@qt = external dso_local global [100100 x i32], align 16
@qu = external dso_local global [100100 x i32], align 16
@qx = external dso_local global [100100 x i32], align 16
@qans = external dso_local global [100100 x i32], align 16
@bs = external dso_local global [100100 x %"class.std::bitset"], align 16
@used = external dso_local global [100100 x i8], align 16
@L = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@ord = external dso_local global %"class.std::vector", align 8
@o = external dso_local global %"class.std::vector.0", align 8
@q2 = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3prei(i32 noundef) #0

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3uinRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4put1ii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4get1i(i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm33368EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<33368>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(4176), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm33368EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5calc2ii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4get2iii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"class.std::bitset<33368>::reference", align 8
  %20 = alloca ptr, align 8
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %22 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %29 = 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)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %46, %0
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %49

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5, ptr noundef %6)
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %5, align 4, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = add nsw i32 %41, -1
  store i32 %42, ptr %6, align 4, !tbaa !5
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %44
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %46

46:                                               ; preds = %37
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %4, align 4, !tbaa !5
  br label %32, !llvm.loop !9

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

50:                                               ; preds = %64, %49
  %51 = load i32, ptr %7, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %67

55:                                               ; preds = %50
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100100 x i8], ptr @used, i64 0, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !11, !range !13, !noundef !14
  %60 = trunc i8 %59 to i1
  br i1 %60, label %63, label %61

61:                                               ; preds = %55
  %62 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z3prei(i32 noundef %62)
  br label %63

63:                                               ; preds = %61, %55
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %7, align 4, !tbaa !5
  br label %50, !llvm.loop !15

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

68:                                               ; preds = %94, %67
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = load i32, ptr %3, 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 %8) #7
  br label %97

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 -1, ptr %11, align 4, !tbaa !5
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %9, ptr noundef %10)
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %10, align 4, !tbaa !5
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = icmp ne i32 %77, 3
  br i1 %78, label %79, label %81

79:                                               ; preds = %73
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %11)
  br label %81

81:                                               ; preds = %79, %73
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %84
  store i32 %82, ptr %85, align 4, !tbaa !5
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100100 x i32], ptr @qu, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  %90 = load i32, ptr %11, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100100 x i32], ptr @qx, i64 0, i64 %92
  store i32 %90, ptr %93, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %94

94:                                               ; preds = %81
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %8, align 4, !tbaa !5
  br label %68, !llvm.loop !16

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

98:                                               ; preds = %111, %97
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %103, label %102

102:                                              ; preds = %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %114

103:                                              ; preds = %98
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = icmp ne i32 %107, 2
  br i1 %108, label %109, label %110

109:                                              ; preds = %103
  br label %111

110:                                              ; preds = %103
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @q2, ptr noundef nonnull align 4 dereferenceable(4) %12)
  br label %111

111:                                              ; preds = %110, %109
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %12, align 4, !tbaa !5
  br label %98, !llvm.loop !17

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

115:                                              ; preds = %126, %114
  %116 = load i32, ptr %13, align 4, !tbaa !5
  %117 = add nsw i32 %116, 600
  %118 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @q2) #7
  %119 = trunc i64 %118 to i32
  %120 = icmp sle i32 %117, %119
  br i1 %120, label %122, label %121

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

122:                                              ; preds = %115
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = add nsw i32 %124, 600
  call void @_Z5calc2ii(i32 noundef %123, i32 noundef %125)
  br label %126

126:                                              ; preds = %122
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = add nsw i32 %127, 600
  store i32 %128, ptr %13, align 4, !tbaa !5
  br label %115, !llvm.loop !18

129:                                              ; preds = %121
  store i32 0, ptr @L, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %277, %129
  %131 = load i32, ptr @L, align 4, !tbaa !5
  %132 = load i32, ptr @n, align 4, !tbaa !5
  %133 = icmp slt i32 %131, %132
  br i1 %133, label %134, label %280

134:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %135 = load i32, ptr @L, align 4, !tbaa !5
  %136 = add nsw i32 %135, 33368
  store i32 %136, ptr %14, align 4, !tbaa !5
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %138 = load i32, ptr %137, align 4, !tbaa !5
  store i32 %138, ptr @R, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %152, %134
  %140 = load i32, ptr %15, align 4, !tbaa !5
  %141 = load i32, ptr @n, align 4, !tbaa !5
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %144, label %143

143:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %155

144:                                              ; preds = %139
  %145 = load i32, ptr %15, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %146
  %148 = call noundef nonnull align 8 dereferenceable(4176) ptr @_ZNSt6bitsetILm33368EE5resetEv(ptr noundef nonnull align 8 dereferenceable(4176) %147) #7
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [100100 x i32], ptr @suka, i64 0, i64 %150
  store i32 -1, ptr %151, align 4, !tbaa !5
  br label %152

152:                                              ; preds = %144
  %153 = load i32, ptr %15, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %15, align 4, !tbaa !5
  br label %139, !llvm.loop !19

155:                                              ; preds = %143
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @o) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %208, %155
  %157 = load i32, ptr %16, align 4, !tbaa !5
  %158 = load i32, ptr @n, align 4, !tbaa !5
  %159 = icmp slt i32 %157, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %156
  store i32 23, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %211

161:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %162 = load i32, ptr %16, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ord, i64 noundef %163) #7
  %165 = load i32, ptr %164, align 4, !tbaa !5
  store i32 %165, ptr %18, align 4, !tbaa !5
  %166 = load i32, ptr @L, align 4, !tbaa !5
  %167 = load i32, ptr %18, align 4, !tbaa !5
  %168 = icmp sle i32 %166, %167
  br i1 %168, label %169, label %182

169:                                              ; preds = %161
  %170 = load i32, ptr %18, align 4, !tbaa !5
  %171 = load i32, ptr @R, align 4, !tbaa !5
  %172 = icmp slt i32 %170, %171
  br i1 %172, label %173, label %182

173:                                              ; preds = %169
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  %174 = load i32, ptr %18, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %175
  %177 = load i32, ptr %18, align 4, !tbaa !5
  %178 = load i32, ptr @L, align 4, !tbaa !5
  %179 = sub nsw i32 %177, %178
  %180 = sext i32 %179 to i64
  call void @_ZNSt6bitsetILm33368EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<33368>::reference") align 8 %19, ptr noundef nonnull align 8 dereferenceable(4176) %176, i64 noundef %180)
  %181 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm33368EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %19, i1 noundef zeroext true) #7
  call void @_ZNSt6bitsetILm33368EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %19) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  br label %182

182:                                              ; preds = %173, %169, %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %183 = load i32, ptr %18, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %184
  store ptr %185, ptr %20, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %186 = load ptr, ptr %20, align 8, !tbaa !20
  %187 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %186) #7
  %188 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %187, ptr %188, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %189 = load ptr, ptr %20, align 8, !tbaa !20
  %190 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %189) #7
  %191 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %22, i32 0, i32 0
  store ptr %190, ptr %191, align 8
  br label %192

192:                                              ; preds = %205, %182
  %193 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #7
  br i1 %193, label %195, label %194

194:                                              ; preds = %192
  store i32 26, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %207

195:                                              ; preds = %192
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  %196 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %197 = load i32, ptr %196, align 4, !tbaa !5
  store i32 %197, ptr %23, align 4, !tbaa !5
  %198 = load i32, ptr %23, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %199
  %201 = load i32, ptr %18, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %202
  %204 = call noundef nonnull align 8 dereferenceable(4176) ptr @_ZNSt6bitsetILm33368EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(4176) %203, ptr noundef nonnull align 8 dereferenceable(4176) %200) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  br label %205

205:                                              ; preds = %195
  %206 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  br label %192

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

208:                                              ; preds = %207
  %209 = load i32, ptr %16, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %16, align 4, !tbaa !5
  br label %156, !llvm.loop !22

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

212:                                              ; preds = %273, %211
  %213 = load i32, ptr %24, align 4, !tbaa !5
  %214 = load i32, ptr %3, align 4, !tbaa !5
  %215 = icmp slt i32 %213, %214
  br i1 %215, label %217, label %216

216:                                              ; preds = %212
  store i32 28, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #7
  br label %276

217:                                              ; preds = %212
  %218 = load i32, ptr %24, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !5
  %222 = icmp eq i32 %221, 3
  br i1 %222, label %223, label %260

223:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #7
  %224 = load i32, ptr %24, align 4, !tbaa !5
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [100100 x i32], ptr @qu, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !5
  store i32 %227, ptr %25, align 4, !tbaa !5
  %228 = load i32, ptr %25, align 4, !tbaa !5
  %229 = load i32, ptr @L, align 4, !tbaa !5
  %230 = icmp slt i32 %228, %229
  br i1 %230, label %235, label %231

231:                                              ; preds = %223
  %232 = load i32, ptr %25, align 4, !tbaa !5
  %233 = load i32, ptr @R, align 4, !tbaa !5
  %234 = icmp sge i32 %232, %233
  br i1 %234, label %235, label %236

235:                                              ; preds = %231, %223
  store i32 30, ptr %17, align 4
  br label %257

236:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %237 = load i32, ptr %25, align 4, !tbaa !5
  %238 = call noundef i32 @_Z4get1i(i32 noundef %237)
  store i32 %238, ptr %26, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #7
  %239 = load i32, ptr %26, align 4, !tbaa !5
  %240 = icmp sge i32 %239, 0
  br i1 %240, label %241, label %246

241:                                              ; preds = %236
  %242 = load i32, ptr %26, align 4, !tbaa !5
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [100100 x i32], ptr @qx, i64 0, i64 %243
  %245 = load i32, ptr %244, align 4, !tbaa !5
  br label %247

246:                                              ; preds = %236
  br label %247

247:                                              ; preds = %246, %241
  %248 = phi i32 [ %245, %241 ], [ 0, %246 ]
  store i32 %248, ptr %27, align 4, !tbaa !5
  %249 = load i32, ptr %25, align 4, !tbaa !5
  %250 = load i32, ptr %26, align 4, !tbaa !5
  %251 = load i32, ptr %24, align 4, !tbaa !5
  %252 = call noundef i32 @_Z4get2iii(i32 noundef %249, i32 noundef %250, i32 noundef %251)
  call void @_Z3uinRii(ptr noundef nonnull align 4 dereferenceable(4) %27, i32 noundef %252)
  %253 = load i32, ptr %27, align 4, !tbaa !5
  %254 = load i32, ptr %24, align 4, !tbaa !5
  %255 = sext i32 %254 to i64
  %256 = getelementptr inbounds [100100 x i32], ptr @qans, i64 0, i64 %255
  store i32 %253, ptr %256, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  store i32 0, ptr %17, align 4
  br label %257

257:                                              ; preds = %247, %235
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #7
  %258 = load i32, ptr %17, align 4
  switch i32 %258, label %305 [
    i32 0, label %259
    i32 30, label %273
  ]

259:                                              ; preds = %257
  br label %260

260:                                              ; preds = %259, %217
  %261 = load i32, ptr %24, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = icmp eq i32 %264, 1
  br i1 %265, label %266, label %272

266:                                              ; preds = %260
  %267 = load i32, ptr %24, align 4, !tbaa !5
  %268 = sext i32 %267 to i64
  %269 = getelementptr inbounds [100100 x i32], ptr @qu, i64 0, i64 %268
  %270 = load i32, ptr %269, align 4, !tbaa !5
  %271 = load i32, ptr %24, align 4, !tbaa !5
  call void @_Z4put1ii(i32 noundef %270, i32 noundef %271)
  br label %272

272:                                              ; preds = %266, %260
  br label %273

273:                                              ; preds = %272, %257
  %274 = load i32, ptr %24, align 4, !tbaa !5
  %275 = add nsw i32 %274, 1
  store i32 %275, ptr %24, align 4, !tbaa !5
  br label %212, !llvm.loop !23

276:                                              ; preds = %216
  br label %277

277:                                              ; preds = %276
  %278 = load i32, ptr @L, align 4, !tbaa !5
  %279 = add nsw i32 %278, 33368
  store i32 %279, ptr @L, align 4, !tbaa !5
  br label %130, !llvm.loop !24

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

281:                                              ; preds = %300, %280
  %282 = load i32, ptr %28, align 4, !tbaa !5
  %283 = load i32, ptr %3, align 4, !tbaa !5
  %284 = icmp slt i32 %282, %283
  br i1 %284, label %286, label %285

285:                                              ; preds = %281
  store i32 31, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  br label %303

286:                                              ; preds = %281
  %287 = load i32, ptr %28, align 4, !tbaa !5
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %288
  %290 = load i32, ptr %289, align 4, !tbaa !5
  %291 = icmp eq i32 %290, 3
  br i1 %291, label %292, label %299

292:                                              ; preds = %286
  %293 = load i32, ptr %28, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [100100 x i32], ptr @qans, i64 0, i64 %294
  %296 = load i32, ptr %295, align 4, !tbaa !5
  %297 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %296)
  %298 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %297, i8 noundef signext 10)
  br label %299

299:                                              ; preds = %292, %286
  br label %300

300:                                              ; preds = %299
  %301 = load i32, ptr %28, align 4, !tbaa !5
  %302 = add nsw i32 %301, 1
  store i32 %302, ptr %28, align 4, !tbaa !5
  br label %281, !llvm.loop !25

303:                                              ; preds = %285
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %304 = load i32, ptr %1, align 4
  ret i32 %304

305:                                              ; preds = %257
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm33368EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

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

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

!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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !21, i64 0}
!21 = !{!"any pointer", !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [522 x i64] }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%"class.std::bitset<33368>::reference" = type { ptr, i64 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }

@g = external dso_local global [100100 x %"class.std::vector"], align 16
@suka = external dso_local local_unnamed_addr global [100100 x i32], align 16
@qt = external dso_local local_unnamed_addr global [100100 x i32], align 16
@qu = external dso_local local_unnamed_addr global [100100 x i32], align 16
@qx = external dso_local local_unnamed_addr global [100100 x i32], align 16
@qans = external dso_local local_unnamed_addr global [100100 x i32], align 16
@bs = external dso_local global [100100 x %"class.std::bitset"], align 16
@used = external dso_local local_unnamed_addr global [100100 x i8], align 16
@L = external dso_local local_unnamed_addr global i32, align 4
@R = external dso_local local_unnamed_addr global i32, align 4
@n = external dso_local global i32, align 4
@ord = external dso_local global %"class.std::vector", align 8
@o = external dso_local global %"class.std::vector.0", align 8
@q2 = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3prei(i32 noundef) 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 nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3uinRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4put1ii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4get1i(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm33368EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<33368>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(4176), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm33368EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5calc2ii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4get2iii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %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 %"class.std::bitset<33368>::reference", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %13 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %14 = 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)
  %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) %1)
  %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) %2)
  %17 = load i32, ptr %1, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %.preheader77

.preheader77:                                     ; preds = %.lr.ph, %0
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph80, label %.preheader76

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.05278 = phi i32 [ %28, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr %3, align 4, !tbaa !5
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %23 to i64
  %27 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %26
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %28 = add nuw nsw i32 %.05278, 1
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %.lr.ph, label %.preheader77, !llvm.loop !9

.preheader76:                                     ; preds = %39, %.preheader77
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph82, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader76
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  br label %._crit_edge86

.lr.ph80:                                         ; preds = %.preheader77, %39
  %33 = phi i32 [ %40, %39 ], [ %19, %.preheader77 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %39 ], [ 0, %.preheader77 ]
  %34 = getelementptr inbounds [100100 x i8], ptr @used, i64 0, i64 %indvars.iv
  %35 = load i8, ptr %34, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %39, label %37

37:                                               ; preds = %.lr.ph80
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_Z3prei(i32 noundef %38)
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %.lr.ph80, %37
  %40 = phi i32 [ %33, %.lr.ph80 ], [ %.pre, %37 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next, %41
  br i1 %42, label %.lr.ph80, label %.preheader76, !llvm.loop !15

._crit_edge:                                      ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  %43 = icmp sgt i32 %57, 0
  br i1 %43, label %.lr.ph85, label %._crit_edge86

.lr.ph82:                                         ; preds = %.preheader76, %50
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %50 ], [ 0, %.preheader76 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  store i32 -1, ptr %7, align 4, !tbaa !5
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %6, align 4, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %.not69 = icmp eq i32 %47, 3
  br i1 %.not69, label %50, label %48

48:                                               ; preds = %.lr.ph82
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %7)
  %.pre125 = load i32, ptr %5, align 4, !tbaa !5
  %.pre126 = load i32, ptr %6, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %48, %.lr.ph82
  %51 = phi i32 [ %.pre126, %48 ], [ %46, %.lr.ph82 ]
  %52 = phi i32 [ %.pre125, %48 ], [ 3, %.lr.ph82 ]
  %53 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %indvars.iv110
  store i32 %52, ptr %53, align 4, !tbaa !5
  %54 = getelementptr inbounds [100100 x i32], ptr @qu, i64 0, i64 %indvars.iv110
  store i32 %51, ptr %54, align 4, !tbaa !5
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = getelementptr inbounds [100100 x i32], ptr @qx, i64 0, i64 %indvars.iv110
  store i32 %55, ptr %56, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next111, %58
  br i1 %59, label %.lr.ph82, label %._crit_edge, !llvm.loop !16

._crit_edge86:                                    ; preds = %67, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  %60 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @q2) #8
  %61 = trunc i64 %60 to i32
  %.not87 = icmp slt i32 %61, 600
  br i1 %.not87, label %.preheader75, label %.lr.ph90

.lr.ph85:                                         ; preds = %._crit_edge, %67
  %62 = phi i32 [ %68, %67 ], [ %57, %._crit_edge ]
  %storemerge83 = phi i32 [ %70, %67 ], [ 0, %._crit_edge ]
  %63 = sext i32 %storemerge83 to i64
  %64 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %.not68 = icmp eq i32 %65, 2
  br i1 %.not68, label %66, label %67

66:                                               ; preds = %.lr.ph85
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @q2, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %.pre127 = load i32, ptr %8, align 4, !tbaa !5
  %.pre128 = load i32, ptr %2, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %.lr.ph85, %66
  %68 = phi i32 [ %62, %.lr.ph85 ], [ %.pre128, %66 ]
  %69 = phi i32 [ %storemerge83, %.lr.ph85 ], [ %.pre127, %66 ]
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %8, align 4, !tbaa !5
  %71 = icmp slt i32 %70, %68
  br i1 %71, label %.lr.ph85, label %._crit_edge86, !llvm.loop !17

.preheader75:                                     ; preds = %.lr.ph90, %._crit_edge86
  store i32 0, ptr @L, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph105, label %.preheader75..preheader_crit_edge

.preheader75..preheader_crit_edge:                ; preds = %.preheader75
  %.pre130 = load i32, ptr %2, align 4, !tbaa !5
  br label %.preheader

.lr.ph90:                                         ; preds = %._crit_edge86, %.lr.ph90
  %74 = phi i32 [ %75, %.lr.ph90 ], [ 600, %._crit_edge86 ]
  %.05688 = phi i32 [ %74, %.lr.ph90 ], [ 0, %._crit_edge86 ]
  call void @_Z5calc2ii(i32 noundef %.05688, i32 noundef %74)
  %75 = add nuw nsw i32 %74, 600
  %76 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @q2) #8
  %77 = trunc i64 %76 to i32
  %.not = icmp sgt i32 %75, %77
  br i1 %.not, label %.preheader75, label %.lr.ph90, !llvm.loop !18

.preheader:                                       ; preds = %._crit_edge103, %.preheader75..preheader_crit_edge
  %78 = phi i32 [ %.pre130, %.preheader75..preheader_crit_edge ], [ %124, %._crit_edge103 ]
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %.lr.ph107, label %._crit_edge108

.lr.ph105:                                        ; preds = %.preheader75, %._crit_edge103
  %storemerge65104 = phi i32 [ %127, %._crit_edge103 ], [ 0, %.preheader75 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  %80 = add nsw i32 %storemerge65104, 33368
  store i32 %80, ptr %9, align 4, !tbaa !5
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %82 = load i32, ptr %81, align 4, !tbaa !5
  store i32 %82, ptr @R, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.lr.ph93, label %._crit_edge94

._crit_edge94:                                    ; preds = %.lr.ph93, %.lr.ph105
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @o) #8
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph100, label %.preheader74

.lr.ph93:                                         ; preds = %.lr.ph105, %.lr.ph93
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %.lr.ph93 ], [ 0, %.lr.ph105 ]
  %87 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %indvars.iv113
  %88 = call noundef nonnull align 8 dereferenceable(4176) ptr @_ZNSt6bitsetILm33368EE5resetEv(ptr noundef nonnull align 8 dereferenceable(4176) %87) #8
  %89 = getelementptr inbounds [100100 x i32], ptr @suka, i64 0, i64 %indvars.iv113
  store i32 -1, ptr %89, align 4, !tbaa !5
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next114, %91
  br i1 %92, label %.lr.ph93, label %._crit_edge94, !llvm.loop !19

.preheader74:                                     ; preds = %._crit_edge97, %._crit_edge94
  %93 = phi i32 [ %85, %._crit_edge94 ], [ %113, %._crit_edge97 ]
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = icmp sgt i32 %94, 0
  br i1 %95, label %.lr.ph102, label %._crit_edge103

.lr.ph100:                                        ; preds = %._crit_edge94, %._crit_edge97
  %indvars.iv116 = phi i64 [ %indvars.iv.next117, %._crit_edge97 ], [ 0, %._crit_edge94 ]
  %96 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ord, i64 noundef %indvars.iv116) #8
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = load i32, ptr @L, align 4, !tbaa !5
  %.not67 = icmp sle i32 %98, %97
  %99 = load i32, ptr @R, align 4
  %100 = icmp slt i32 %97, %99
  %or.cond = select i1 %.not67, i1 %100, i1 false
  br i1 %or.cond, label %101, label %.lr.ph100._crit_edge

.lr.ph100._crit_edge:                             ; preds = %.lr.ph100
  %.pre132 = sext i32 %97 to i64
  br label %107

101:                                              ; preds = %.lr.ph100
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #8
  %102 = sext i32 %97 to i64
  %103 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %102
  %104 = sub nsw i32 %97, %98
  %105 = sext i32 %104 to i64
  call void @_ZNSt6bitsetILm33368EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<33368>::reference") align 8 %10, ptr noundef nonnull align 8 dereferenceable(4176) %103, i64 noundef %105)
  %106 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm33368EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %10, i1 noundef zeroext true) #8
  call void @_ZNSt6bitsetILm33368EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #8
  br label %107

107:                                              ; preds = %.lr.ph100._crit_edge, %101
  %.pre-phi = phi i64 [ %.pre132, %.lr.ph100._crit_edge ], [ %102, %101 ]
  %108 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @g, i64 0, i64 %.pre-phi
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #8
  %109 = call ptr @_ZNSt6vectorIiSaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %108) #8
  store ptr %109, ptr %11, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #8
  %110 = call ptr @_ZNSt6vectorIiSaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %108) #8
  store ptr %110, ptr %12, align 8
  %111 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  br i1 %111, label %.lr.ph96, label %._crit_edge97

.lr.ph96:                                         ; preds = %107
  %112 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %.pre-phi
  br label %116

._crit_edge97:                                    ; preds = %116, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #8
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = icmp slt i64 %indvars.iv.next117, %114
  br i1 %115, label %.lr.ph100, label %.preheader74, !llvm.loop !20

116:                                              ; preds = %.lr.ph96, %116
  %117 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #8
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100100 x %"class.std::bitset"], ptr @bs, i64 0, i64 %119
  %121 = call noundef nonnull align 8 dereferenceable(4176) ptr @_ZNSt6bitsetILm33368EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(4176) %112, ptr noundef nonnull align 8 dereferenceable(4176) %120) #8
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #8
  %123 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPiSt6vectorIiSaIiEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #8
  br i1 %123, label %116, label %._crit_edge97

._crit_edge103.loopexit:                          ; preds = %157
  %.pre129 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge103

._crit_edge103:                                   ; preds = %._crit_edge103.loopexit, %.preheader74
  %124 = phi i32 [ %158, %._crit_edge103.loopexit ], [ %94, %.preheader74 ]
  %125 = phi i32 [ %.pre129, %._crit_edge103.loopexit ], [ %93, %.preheader74 ]
  %126 = load i32, ptr @L, align 4, !tbaa !5
  %127 = add nsw i32 %126, 33368
  store i32 %127, ptr @L, align 4, !tbaa !5
  %128 = icmp slt i32 %127, %125
  br i1 %128, label %.lr.ph105, label %.preheader, !llvm.loop !21

.lr.ph102:                                        ; preds = %.preheader74, %157
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %157 ], [ 0, %.preheader74 ]
  %129 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %indvars.iv119
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = icmp eq i32 %130, 3
  br i1 %131, label %132, label %150

132:                                              ; preds = %.lr.ph102
  %133 = getelementptr inbounds [100100 x i32], ptr @qu, i64 0, i64 %indvars.iv119
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = load i32, ptr @L, align 4, !tbaa !5
  %136 = icmp sge i32 %134, %135
  %137 = load i32, ptr @R, align 4
  %.not66 = icmp slt i32 %134, %137
  %or.cond71 = select i1 %136, i1 %.not66, i1 false
  br i1 %or.cond71, label %138, label %157

138:                                              ; preds = %132
  %139 = call noundef i32 @_Z4get1i(i32 noundef %134)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #8
  %140 = icmp sgt i32 %139, -1
  br i1 %140, label %141, label %.thread

141:                                              ; preds = %138
  %142 = zext nneg i32 %139 to i64
  %143 = getelementptr inbounds [100100 x i32], ptr @qx, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %141, %138
  %145 = phi i32 [ %144, %141 ], [ 0, %138 ]
  store i32 %145, ptr %13, align 4, !tbaa !5
  %146 = trunc nuw nsw i64 %indvars.iv119 to i32
  %147 = call noundef i32 @_Z4get2iii(i32 noundef %134, i32 noundef %139, i32 noundef %146)
  call void @_Z3uinRii(ptr noundef nonnull align 4 dereferenceable(4) %13, i32 noundef %147)
  %148 = load i32, ptr %13, align 4, !tbaa !5
  %149 = getelementptr inbounds [100100 x i32], ptr @qans, i64 0, i64 %indvars.iv119
  store i32 %148, ptr %149, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  %.pr = load i32, ptr %129, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %.thread, %.lr.ph102
  %151 = phi i32 [ %.pr, %.thread ], [ %130, %.lr.ph102 ]
  %152 = icmp eq i32 %151, 1
  br i1 %152, label %153, label %157

153:                                              ; preds = %150
  %154 = getelementptr inbounds [100100 x i32], ptr @qu, i64 0, i64 %indvars.iv119
  %155 = load i32, ptr %154, align 4, !tbaa !5
  %156 = trunc nuw nsw i64 %indvars.iv119 to i32
  call void @_Z4put1ii(i32 noundef %155, i32 noundef %156)
  br label %157

157:                                              ; preds = %132, %150, %153
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %158 = load i32, ptr %2, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = icmp slt i64 %indvars.iv.next120, %159
  br i1 %160, label %.lr.ph102, label %._crit_edge103.loopexit, !llvm.loop !22

._crit_edge108:                                   ; preds = %170, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph107:                                        ; preds = %.preheader, %170
  %161 = phi i32 [ %171, %170 ], [ %78, %.preheader ]
  %indvars.iv122 = phi i64 [ %indvars.iv.next123, %170 ], [ 0, %.preheader ]
  %162 = getelementptr inbounds [100100 x i32], ptr @qt, i64 0, i64 %indvars.iv122
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = icmp eq i32 %163, 3
  br i1 %164, label %165, label %170

165:                                              ; preds = %.lr.ph107
  %166 = getelementptr inbounds [100100 x i32], ptr @qans, i64 0, i64 %indvars.iv122
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %167)
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %168, i8 noundef signext 10)
  %.pre131 = load i32, ptr %2, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %.lr.ph107, %165
  %171 = phi i32 [ %161, %.lr.ph107 ], [ %.pre131, %165 ]
  %indvars.iv.next123 = add nuw nsw i64 %indvars.iv122, 1
  %172 = sext i32 %171 to i64
  %173 = icmp slt i64 %indvars.iv.next123, %172
  br i1 %173, label %.lr.ph107, label %._crit_edge108, !llvm.loop !23
}

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 #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #7

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

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


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