; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Random/Almost Equal - Advanced (A)

; 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.height = type { i32, i32, i32 }
%struct.quer = type { i32, i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree.0" }
%"class.std::_Rb_tree.0" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@ans = external dso_local global i64, align 8
@h = external dso_local global [100100 x %struct.height], align 16
@res = external dso_local global [100100 x i64], align 16
@q = external dso_local global [100100 x %struct.quer], align 16
@comp = external dso_local global %"class.std::set", align 8
@f = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addi(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3remi(i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %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
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %81, %0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

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

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.height, ptr %28, i32 0, i32 0
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %29)
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.height, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = load i32, ptr @k, align 4, !tbaa !5
  %37 = add nsw i32 %35, %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %39
  %41 = getelementptr inbounds %struct.height, ptr %40, i32 0, i32 1
  store i32 %37, ptr %41, align 4, !tbaa !11
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %43
  %45 = getelementptr inbounds %struct.height, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = load i32, ptr @k, align 4, !tbaa !5
  %48 = sub nsw i32 %46, %47
  %49 = sub nsw i32 %48, 1
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %51
  %53 = getelementptr inbounds %struct.height, ptr %52, i32 0, i32 2
  store i32 %49, ptr %53, align 4, !tbaa !12
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.height, ptr %56, i32 0, i32 0
  %58 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %57)
  %59 = getelementptr inbounds { ptr, i8 }, ptr %3, i32 0, i32 0
  %60 = extractvalue { ptr, i8 } %58, 0
  store ptr %60, ptr %59, align 8
  %61 = getelementptr inbounds { ptr, i8 }, ptr %3, i32 0, i32 1
  %62 = extractvalue { ptr, i8 } %58, 1
  store i8 %62, ptr %61, align 8
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %64
  %66 = getelementptr inbounds %struct.height, ptr %65, i32 0, i32 1
  %67 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %66)
  %68 = getelementptr inbounds { ptr, i8 }, ptr %4, i32 0, i32 0
  %69 = extractvalue { ptr, i8 } %67, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, i8 }, ptr %4, i32 0, i32 1
  %71 = extractvalue { ptr, i8 } %67, 1
  store i8 %71, ptr %70, align 8
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %73
  %75 = getelementptr inbounds %struct.height, ptr %74, i32 0, i32 2
  %76 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %75)
  %77 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 0
  %78 = extractvalue { ptr, i8 } %76, 0
  store ptr %78, ptr %77, align 8
  %79 = getelementptr inbounds { ptr, i8 }, ptr %5, i32 0, i32 1
  %80 = extractvalue { ptr, i8 } %76, 1
  store i8 %80, ptr %79, align 8
  br label %81

81:                                               ; preds = %25
  %82 = load i32, ptr %2, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !13

84:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %85 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #6
  %86 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %7, i32 0, i32 0
  store ptr %85, ptr %86, align 8
  br label %87

87:                                               ; preds = %97, %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %88 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #6
  %89 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %8, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  %90 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %100

92:                                               ; preds = %87
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %6, align 4, !tbaa !5
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  %96 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %95)
  store i32 %93, ptr %96, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %92
  %98 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #6
  %99 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %9, i32 0, i32 0
  store ptr %98, ptr %99, align 8
  br label %87, !llvm.loop !15

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

101:                                              ; preds = %137, %100
  %102 = load i32, ptr %10, align 4, !tbaa !5
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %140

106:                                              ; preds = %101
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %108
  %110 = getelementptr inbounds %struct.height, ptr %109, i32 0, i32 0
  %111 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %110)
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %114
  %116 = getelementptr inbounds %struct.height, ptr %115, i32 0, i32 0
  store i32 %112, ptr %116, align 4, !tbaa !9
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %118
  %120 = getelementptr inbounds %struct.height, ptr %119, i32 0, i32 1
  %121 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %120)
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = load i32, ptr %10, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %124
  %126 = getelementptr inbounds %struct.height, ptr %125, i32 0, i32 1
  store i32 %122, ptr %126, align 4, !tbaa !11
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %128
  %130 = getelementptr inbounds %struct.height, ptr %129, i32 0, i32 2
  %131 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %130)
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.height, ptr %135, i32 0, i32 2
  store i32 %132, ptr %136, align 4, !tbaa !12
  br label %137

137:                                              ; preds = %106
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %10, align 4, !tbaa !5
  br label %101, !llvm.loop !16

140:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %141 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %164, %140
  %143 = load i32, ptr %14, align 4, !tbaa !5
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %167

147:                                              ; preds = %142
  %148 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %12, ptr noundef %13)
  %149 = load i32, ptr %12, align 4, !tbaa !5
  %150 = load i32, ptr %14, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %151
  %153 = getelementptr inbounds %struct.quer, ptr %152, i32 0, i32 0
  store i32 %149, ptr %153, align 4, !tbaa !17
  %154 = load i32, ptr %13, align 4, !tbaa !5
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %156
  %158 = getelementptr inbounds %struct.quer, ptr %157, i32 0, i32 1
  store i32 %154, ptr %158, align 4, !tbaa !19
  %159 = load i32, ptr %14, align 4, !tbaa !5
  %160 = load i32, ptr %14, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %161
  %163 = getelementptr inbounds %struct.quer, ptr %162, i32 0, i32 2
  store i32 %159, ptr %163, align 4, !tbaa !20
  br label %164

164:                                              ; preds = %147
  %165 = load i32, ptr %14, align 4, !tbaa !5
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %14, align 4, !tbaa !5
  br label %142, !llvm.loop !21

167:                                              ; preds = %146
  %168 = load i32, ptr %11, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds %struct.quer, ptr @q, i64 %169
  call void @_ZSt4sortIP4querEvT_S2_(ptr noundef @q, ptr noundef %170)
  %171 = load i32, ptr @q, align 16, !tbaa !17
  store i32 %171, ptr %12, align 4, !tbaa !5
  %172 = load i32, ptr %12, align 4, !tbaa !5
  %173 = sub nsw i32 %172, 1
  store i32 %173, ptr %13, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %178, %167
  %175 = load i32, ptr %13, align 4, !tbaa !5
  %176 = load i32, ptr getelementptr inbounds (%struct.quer, ptr @q, i32 0, i32 1), align 4, !tbaa !19
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %178, label %181

178:                                              ; preds = %174
  %179 = load i32, ptr %13, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %13, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %180)
  br label %174, !llvm.loop !22

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

182:                                              ; preds = %238, %181
  %183 = load i32, ptr %15, align 4, !tbaa !5
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = icmp slt i32 %183, %184
  br i1 %185, label %187, label %186

186:                                              ; preds = %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %241

187:                                              ; preds = %182
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %188 = load i32, ptr %15, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.quer, ptr %190, i32 0, i32 0
  %192 = load i32, ptr %191, align 4, !tbaa !17
  store i32 %192, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %193 = load i32, ptr %15, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %194
  %196 = getelementptr inbounds %struct.quer, ptr %195, i32 0, i32 1
  %197 = load i32, ptr %196, align 4, !tbaa !19
  store i32 %197, ptr %17, align 4, !tbaa !5
  br label %198

198:                                              ; preds = %202, %187
  %199 = load i32, ptr %12, align 4, !tbaa !5
  %200 = load i32, ptr %16, align 4, !tbaa !5
  %201 = icmp slt i32 %199, %200
  br i1 %201, label %202, label %205

202:                                              ; preds = %198
  %203 = load i32, ptr %12, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %12, align 4, !tbaa !5
  call void @_Z3remi(i32 noundef %203)
  br label %198, !llvm.loop !23

205:                                              ; preds = %198
  br label %206

206:                                              ; preds = %210, %205
  %207 = load i32, ptr %12, align 4, !tbaa !5
  %208 = load i32, ptr %16, align 4, !tbaa !5
  %209 = icmp sgt i32 %207, %208
  br i1 %209, label %210, label %213

210:                                              ; preds = %206
  %211 = load i32, ptr %12, align 4, !tbaa !5
  %212 = add nsw i32 %211, -1
  store i32 %212, ptr %12, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %212)
  br label %206, !llvm.loop !24

213:                                              ; preds = %206
  br label %214

214:                                              ; preds = %218, %213
  %215 = load i32, ptr %13, align 4, !tbaa !5
  %216 = load i32, ptr %17, align 4, !tbaa !5
  %217 = icmp slt i32 %215, %216
  br i1 %217, label %218, label %221

218:                                              ; preds = %214
  %219 = load i32, ptr %13, align 4, !tbaa !5
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %13, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %220)
  br label %214, !llvm.loop !25

221:                                              ; preds = %214
  br label %222

222:                                              ; preds = %226, %221
  %223 = load i32, ptr %13, align 4, !tbaa !5
  %224 = load i32, ptr %17, align 4, !tbaa !5
  %225 = icmp sgt i32 %223, %224
  br i1 %225, label %226, label %229

226:                                              ; preds = %222
  %227 = load i32, ptr %13, align 4, !tbaa !5
  %228 = add nsw i32 %227, -1
  store i32 %228, ptr %13, align 4, !tbaa !5
  call void @_Z3remi(i32 noundef %227)
  br label %222, !llvm.loop !26

229:                                              ; preds = %222
  %230 = load i64, ptr @ans, align 8, !tbaa !27
  %231 = load i32, ptr %15, align 4, !tbaa !5
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %232
  %234 = getelementptr inbounds %struct.quer, ptr %233, i32 0, i32 2
  %235 = load i32, ptr %234, align 4, !tbaa !20
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [100100 x i64], ptr @res, i64 0, i64 %236
  store i64 %230, ptr %237, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %238

238:                                              ; preds = %229
  %239 = load i32, ptr %15, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %15, align 4, !tbaa !5
  br label %182, !llvm.loop !29

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

242:                                              ; preds = %253, %241
  %243 = load i32, ptr %18, align 4, !tbaa !5
  %244 = load i32, ptr %11, align 4, !tbaa !5
  %245 = icmp slt i32 %243, %244
  br i1 %245, label %247, label %246

246:                                              ; preds = %242
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %256

247:                                              ; preds = %242
  %248 = load i32, ptr %18, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [100100 x i64], ptr @res, i64 0, i64 %249
  %251 = load i64, ptr %250, align 8, !tbaa !27
  %252 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %251)
  br label %253

253:                                              ; preds = %247
  %254 = load i32, ptr %18, align 4, !tbaa !5
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %18, align 4, !tbaa !5
  br label %242, !llvm.loop !30

256:                                              ; preds = %246
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

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

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

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

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

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

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

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

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

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


; 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.height = type { i32, i32, i32 }
%struct.quer = type { i32, i32, i32 }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree.0" }
%"class.std::_Rb_tree.0" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global i64, align 8
@h = external dso_local global [100100 x %struct.height], align 16
@res = external dso_local local_unnamed_addr global [100100 x i64], align 16
@q = external dso_local global [100100 x %struct.quer], align 16
@comp = external dso_local global %"class.std::set", align 8
@f = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3remi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %9 = tail call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #6
  store ptr %9, ptr %1, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %10 = tail call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #6
  store ptr %10, ptr %2, align 8
  %11 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br i1 %11, label %.lr.ph60, label %._crit_edge61

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %indvars.iv
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %12)
  %14 = load i32, ptr %12, align 4, !tbaa !9
  %15 = load i32, ptr @k, align 4, !tbaa !5
  %16 = add nsw i32 %15, %14
  %17 = getelementptr inbounds i8, ptr %12, i64 4
  store i32 %16, ptr %17, align 4, !tbaa !11
  %18 = xor i32 %15, -1
  %19 = add i32 %14, %18
  %20 = getelementptr inbounds i8, ptr %12, i64 8
  store i32 %19, ptr %20, align 4, !tbaa !12
  %21 = tail call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %22 = tail call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %23 = tail call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48) @comp, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge61:                                    ; preds = %.lr.ph60, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph64, label %._crit_edge65

.lr.ph60:                                         ; preds = %._crit_edge, %.lr.ph60
  %.04358 = phi i32 [ %29, %.lr.ph60 ], [ 1, %._crit_edge ]
  %29 = add nuw nsw i32 %.04358, 1
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %30)
  store i32 %.04358, ptr %31, align 4, !tbaa !5
  %32 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %33 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @comp) #6
  store ptr %33, ptr %2, align 8
  %34 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br i1 %34, label %.lr.ph60, label %._crit_edge61, !llvm.loop !15

._crit_edge65:                                    ; preds = %.lr.ph64, %._crit_edge61
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %3)
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph68, label %._crit_edge65.._crit_edge69_crit_edge

._crit_edge65.._crit_edge69_crit_edge:            ; preds = %._crit_edge65
  %.pre = sext i32 %36 to i64
  br label %._crit_edge69

.lr.ph64:                                         ; preds = %._crit_edge61, %.lr.ph64
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %.lr.ph64 ], [ 0, %._crit_edge61 ]
  %38 = getelementptr inbounds [100100 x %struct.height], ptr @h, i64 0, i64 %indvars.iv85
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %38)
  %40 = load i32, ptr %39, align 4, !tbaa !5
  store i32 %40, ptr %38, align 4, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %38, i64 4
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %43 = load i32, ptr %42, align 4, !tbaa !5
  store i32 %43, ptr %41, align 4, !tbaa !11
  %44 = getelementptr inbounds i8, ptr %38, i64 8
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 4 dereferenceable(4) %44)
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr %44, align 4, !tbaa !12
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next86, %48
  br i1 %49, label %.lr.ph64, label %._crit_edge65, !llvm.loop !16

._crit_edge69:                                    ; preds = %.lr.ph68, %._crit_edge65.._crit_edge69_crit_edge
  %.pre-phi = phi i64 [ %.pre, %._crit_edge65.._crit_edge69_crit_edge ], [ %62, %.lr.ph68 ]
  %50 = getelementptr inbounds %struct.quer, ptr @q, i64 %.pre-phi
  call void @_ZSt4sortIP4querEvT_S2_(ptr noundef nonnull @q, ptr noundef nonnull %50)
  %51 = load i32, ptr @q, align 16, !tbaa !17
  store i32 %51, ptr %4, align 4, !tbaa !5
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %5, align 4, !tbaa !5
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @q, i64 4), align 4, !tbaa !19
  %.not = icmp sgt i32 %51, %53
  br i1 %.not, label %.preheader56, label %.lr.ph71

.lr.ph68:                                         ; preds = %._crit_edge65, %.lr.ph68
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %.lr.ph68 ], [ 0, %._crit_edge65 ]
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %indvars.iv88
  store i32 %55, ptr %56, align 4, !tbaa !17
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %56, i64 4
  store i32 %57, ptr %58, align 4, !tbaa !19
  %59 = getelementptr inbounds i8, ptr %56, i64 8
  %60 = trunc nuw nsw i64 %indvars.iv88 to i32
  store i32 %60, ptr %59, align 4, !tbaa !20
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next89, %62
  br i1 %63, label %.lr.ph68, label %._crit_edge69, !llvm.loop !21

.preheader56:                                     ; preds = %.lr.ph71, %._crit_edge69
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = icmp sgt i32 %64, 0
  br i1 %65, label %.lr.ph79, label %._crit_edge82

.lr.ph71:                                         ; preds = %._crit_edge69, %.lr.ph71
  %66 = phi i32 [ %68, %.lr.ph71 ], [ %52, %._crit_edge69 ]
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %5, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %67)
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @q, i64 4), align 4, !tbaa !19
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph71, label %.preheader56, !llvm.loop !22

.preheader:                                       ; preds = %._crit_edge77
  %71 = icmp sgt i32 %105, 0
  br i1 %71, label %.lr.ph81, label %._crit_edge82

.lr.ph79:                                         ; preds = %.preheader56, %._crit_edge77
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %._crit_edge77 ], [ 0, %.preheader56 ]
  %72 = getelementptr inbounds [100100 x %struct.quer], ptr @q, i64 0, i64 %indvars.iv91
  %73 = load i32, ptr %72, align 4, !tbaa !17
  %74 = getelementptr inbounds i8, ptr %72, i64 4
  %75 = load i32, ptr %74, align 4, !tbaa !19
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = icmp slt i32 %76, %73
  br i1 %77, label %.lr.ph73, label %.preheader55

.preheader55:                                     ; preds = %.lr.ph73, %.lr.ph79
  %78 = phi i32 [ %76, %.lr.ph79 ], [ %82, %.lr.ph73 ]
  %79 = icmp sgt i32 %78, %73
  br i1 %79, label %.lr.ph74, label %.preheader54

.lr.ph73:                                         ; preds = %.lr.ph79, %.lr.ph73
  %80 = phi i32 [ %82, %.lr.ph73 ], [ %76, %.lr.ph79 ]
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %4, align 4, !tbaa !5
  call void @_Z3remi(i32 noundef %80)
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = icmp slt i32 %82, %73
  br i1 %83, label %.lr.ph73, label %.preheader55, !llvm.loop !23

.preheader54:                                     ; preds = %.lr.ph74, %.preheader55
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = icmp slt i32 %84, %75
  br i1 %85, label %.lr.ph75, label %.preheader53

.lr.ph74:                                         ; preds = %.preheader55, %.lr.ph74
  %86 = phi i32 [ %88, %.lr.ph74 ], [ %78, %.preheader55 ]
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr %4, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %87)
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = icmp sgt i32 %88, %73
  br i1 %89, label %.lr.ph74, label %.preheader54, !llvm.loop !24

.preheader53:                                     ; preds = %.lr.ph75, %.preheader54
  %90 = phi i32 [ %84, %.preheader54 ], [ %94, %.lr.ph75 ]
  %91 = icmp sgt i32 %90, %75
  br i1 %91, label %.lr.ph76, label %._crit_edge77

.lr.ph75:                                         ; preds = %.preheader54, %.lr.ph75
  %92 = phi i32 [ %94, %.lr.ph75 ], [ %84, %.preheader54 ]
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %5, align 4, !tbaa !5
  call void @_Z3addi(i32 noundef %93)
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = icmp slt i32 %94, %75
  br i1 %95, label %.lr.ph75, label %.preheader53, !llvm.loop !25

.lr.ph76:                                         ; preds = %.preheader53, %.lr.ph76
  %96 = phi i32 [ %98, %.lr.ph76 ], [ %90, %.preheader53 ]
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr %5, align 4, !tbaa !5
  call void @_Z3remi(i32 noundef %96)
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = icmp sgt i32 %98, %75
  br i1 %99, label %.lr.ph76, label %._crit_edge77, !llvm.loop !26

._crit_edge77:                                    ; preds = %.lr.ph76, %.preheader53
  %100 = load i64, ptr @ans, align 8, !tbaa !27
  %101 = getelementptr inbounds i8, ptr %72, i64 8
  %102 = load i32, ptr %101, align 4, !tbaa !20
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100100 x i64], ptr @res, i64 0, i64 %103
  store i64 %100, ptr %104, align 8, !tbaa !27
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %105 = load i32, ptr %3, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = icmp slt i64 %indvars.iv.next92, %106
  br i1 %107, label %.lr.ph79, label %.preheader, !llvm.loop !29

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

.lr.ph81:                                         ; preds = %.preheader, %.lr.ph81
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %.lr.ph81 ], [ 0, %.preheader ]
  %108 = getelementptr inbounds [100100 x i64], ptr @res, i64 0, i64 %indvars.iv94
  %109 = load i64, ptr %108, align 8, !tbaa !27
  %110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %109)
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %111 = load i32, ptr %3, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next95, %112
  br i1 %113, label %.lr.ph81, label %._crit_edge82, !llvm.loop !30
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertERKi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

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

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

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

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

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

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

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

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


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