; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-11-02 (E - Post Offices - dby)

; 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.Tree = type { [40012 x i32] }

@val = external dso_local global [10003 x i32], align 16
@c = external dso_local global [20006 x i32], align 16
@s = external dso_local global [20006 x i32], align 16
@l = external dso_local global [20006 x i32], align 16
@r = external dso_local global [20006 x i32], align 16
@ord = external dso_local global [20006 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tree = external dso_local global [102 x %struct.Tree], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

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

23:                                               ; preds = %281, %0
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %25 = icmp ne i32 %24, -1
  br i1 %25, label %26, label %34

26:                                               ; preds = %23
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %32, label %29

29:                                               ; preds = %26
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br label %32

32:                                               ; preds = %29, %26
  %33 = phi i1 [ true, %26 ], [ %31, %29 ]
  br label %34

34:                                               ; preds = %32, %23
  %35 = phi i1 [ false, %23 ], [ %33, %32 ]
  br i1 %35, label %36, label %286

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

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

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

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [10003 x i32], ptr @val, i64 0, i64 %45
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %46)
  br label %48

48:                                               ; preds = %42
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !5
  br label %37, !llvm.loop !9

51:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %4, align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds ([10003 x i32], ptr @val, i64 0, i64 1), align 4, !tbaa !5
  store i32 -1, ptr @val, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %64, %51
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %54
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [20006 x i32], ptr @c, i64 0, i64 %61
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %62)
  br label %64

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

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

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

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

73:                                               ; preds = %68
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %7)
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr @val, i64 %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [10003 x i32], ptr @val, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sub nsw i32 %82, %83
  store i32 %84, ptr %8, align 4, !tbaa !5
  %85 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @val, ptr noundef %77, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %86 = ptrtoint ptr %85 to i64
  %87 = sub i64 %86, ptrtoint (ptr @val to i64)
  %88 = sdiv exact i64 %87, 4
  %89 = add nsw i64 %88, 1
  %90 = trunc i64 %89 to i32
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [20006 x i32], ptr @l, i64 0, i64 %92
  store i32 %90, ptr %93, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr @val, i64 %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10003 x i32], ptr @val, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = add nsw i32 %101, %102
  store i32 %103, ptr %9, align 4, !tbaa !5
  %104 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @val, ptr noundef %96, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %105 = ptrtoint ptr %104 to i64
  %106 = sub i64 %105, ptrtoint (ptr @val to i64)
  %107 = sdiv exact i64 %106, 4
  %108 = trunc i64 %107 to i32
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [20006 x i32], ptr @r, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [20006 x i32], ptr @s, i64 0, i64 %113
  store i32 1, ptr %114, align 4, !tbaa !5
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %117
  store i32 %115, ptr %118, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %73
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %6, align 4, !tbaa !5
  br label %68, !llvm.loop !12

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

123:                                              ; preds = %160, %122
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = load i32, ptr @n, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

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

128:                                              ; preds = %123
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = load i32, ptr @n, align 4, !tbaa !5
  %131 = add nsw i32 %129, %130
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [20006 x i32], ptr @c, i64 0, i64 %132
  %134 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %133)
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = add nsw i32 %135, 2
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = load i32, ptr @n, align 4, !tbaa !5
  %139 = add nsw i32 %137, %138
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [20006 x i32], ptr @r, i64 0, i64 %140
  store i32 %136, ptr %141, align 4, !tbaa !5
  %142 = load i32, ptr %10, align 4, !tbaa !5
  %143 = load i32, ptr @n, align 4, !tbaa !5
  %144 = add nsw i32 %142, %143
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [20006 x i32], ptr @l, i64 0, i64 %145
  store i32 %136, ptr %146, align 4, !tbaa !5
  %147 = load i32, ptr %10, align 4, !tbaa !5
  %148 = load i32, ptr @n, align 4, !tbaa !5
  %149 = add nsw i32 %147, %148
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [20006 x i32], ptr @s, i64 0, i64 %150
  store i32 0, ptr %151, align 4, !tbaa !5
  %152 = load i32, ptr @n, align 4, !tbaa !5
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = add nsw i32 %152, %153
  %155 = load i32, ptr %10, align 4, !tbaa !5
  %156 = load i32, ptr @n, align 4, !tbaa !5
  %157 = add nsw i32 %155, %156
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %158
  store i32 %154, ptr %159, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %128
  %161 = load i32, ptr %10, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %10, align 4, !tbaa !5
  br label %123, !llvm.loop !13

163:                                              ; preds = %127
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i32, ptr @ord, i64 %165
  %167 = load i32, ptr @n, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr %166, i64 %168
  call void @_ZSt4sortIPiPFbiiEEvT_S3_T0_(ptr noundef @ord, ptr noundef %169, ptr noundef @_Z3cmpii)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %180, %163
  %171 = load i32, ptr %11, align 4, !tbaa !5
  %172 = load i32, ptr @m, align 4, !tbaa !5
  %173 = icmp sle i32 %171, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %170
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %183

175:                                              ; preds = %170
  %176 = load i32, ptr %11, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %177
  %179 = load i32, ptr %4, align 4, !tbaa !5
  call void @_ZN4Tree5buildEiii(ptr noundef nonnull align 4 dereferenceable(160048) %178, i32 noundef 1, i32 noundef %179, i32 noundef 1)
  br label %180

180:                                              ; preds = %175
  %181 = load i32, ptr %11, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %11, align 4, !tbaa !5
  br label %170, !llvm.loop !14

183:                                              ; preds = %174
  %184 = load i32, ptr %4, align 4, !tbaa !5
  call void @_ZN4Tree6modifyEiiiiii(ptr noundef nonnull align 4 dereferenceable(160048) @tree, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef 1, i32 noundef %184, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %185

185:                                              ; preds = %256, %183
  %186 = load i32, ptr %12, align 4, !tbaa !5
  %187 = load i32, ptr @n, align 4, !tbaa !5
  %188 = load i32, ptr @n, align 4, !tbaa !5
  %189 = add nsw i32 %187, %188
  %190 = icmp slt i32 %186, %189
  br i1 %190, label %192, label %191

191:                                              ; preds = %185
  store i32 19, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %259

192:                                              ; preds = %185
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %193 = load i32, ptr %12, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [20006 x i32], ptr @l, i64 0, i64 %197
  %199 = load i32, ptr %198, align 4, !tbaa !5
  store i32 %199, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %200 = load i32, ptr %12, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [20006 x i32], ptr @r, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  store i32 %206, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %207 = load i32, ptr %12, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [20006 x i32], ptr @c, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  store i32 %213, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %214 = load i32, ptr %12, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [20006 x i32], ptr @s, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  store i32 %220, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %221

221:                                              ; preds = %252, %192
  %222 = load i32, ptr %18, align 4, !tbaa !5
  %223 = load i32, ptr @m, align 4, !tbaa !5
  %224 = load i32, ptr %17, align 4, !tbaa !5
  %225 = sub nsw i32 %223, %224
  %226 = icmp sle i32 %222, %225
  br i1 %226, label %228, label %227

227:                                              ; preds = %221
  store i32 22, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %255

228:                                              ; preds = %221
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %229 = load i32, ptr %18, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %230
  %232 = load i32, ptr %14, align 4, !tbaa !5
  %233 = sub nsw i32 %232, 1
  %234 = load i32, ptr %4, align 4, !tbaa !5
  %235 = call noundef i32 @_ZN4Tree5queryEiiii(ptr noundef nonnull align 4 dereferenceable(160048) %231, i32 noundef %233, i32 noundef 1, i32 noundef %234, i32 noundef 1)
  store i32 %235, ptr %19, align 4, !tbaa !5
  %236 = load i32, ptr %19, align 4, !tbaa !5
  %237 = icmp ne i32 %236, 1073741823
  br i1 %237, label %238, label %251

238:                                              ; preds = %228
  %239 = load i32, ptr %16, align 4, !tbaa !5
  %240 = load i32, ptr %19, align 4, !tbaa !5
  %241 = add nsw i32 %240, %239
  store i32 %241, ptr %19, align 4, !tbaa !5
  %242 = load i32, ptr %18, align 4, !tbaa !5
  %243 = load i32, ptr %17, align 4, !tbaa !5
  %244 = add nsw i32 %242, %243
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %245
  %247 = load i32, ptr %14, align 4, !tbaa !5
  %248 = load i32, ptr %15, align 4, !tbaa !5
  %249 = load i32, ptr %19, align 4, !tbaa !5
  %250 = load i32, ptr %4, align 4, !tbaa !5
  call void @_ZN4Tree6modifyEiiiiii(ptr noundef nonnull align 4 dereferenceable(160048) %246, i32 noundef %247, i32 noundef %248, i32 noundef %249, i32 noundef 1, i32 noundef %250, i32 noundef 1)
  br label %251

251:                                              ; preds = %238, %228
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %252

252:                                              ; preds = %251
  %253 = load i32, ptr %18, align 4, !tbaa !5
  %254 = add nsw i32 %253, 1
  store i32 %254, ptr %18, align 4, !tbaa !5
  br label %221, !llvm.loop !15

255:                                              ; preds = %227
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %256

256:                                              ; preds = %255
  %257 = load i32, ptr %12, align 4, !tbaa !5
  %258 = add nsw i32 %257, 1
  store i32 %258, ptr %12, align 4, !tbaa !5
  br label %185, !llvm.loop !16

259:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 1073741823, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %260

260:                                              ; preds = %278, %259
  %261 = load i32, ptr %22, align 4, !tbaa !5
  %262 = load i32, ptr @m, align 4, !tbaa !5
  %263 = icmp sle i32 %261, %262
  br i1 %263, label %265, label %264

264:                                              ; preds = %260
  store i32 25, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %281

265:                                              ; preds = %260
  %266 = load i32, ptr %22, align 4, !tbaa !5
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %267
  %269 = load i32, ptr %4, align 4, !tbaa !5
  %270 = load i32, ptr %4, align 4, !tbaa !5
  %271 = call noundef i32 @_ZN4Tree5queryEiiii(ptr noundef nonnull align 4 dereferenceable(160048) %268, i32 noundef %269, i32 noundef 1, i32 noundef %270, i32 noundef 1)
  store i32 %271, ptr %21, align 4, !tbaa !5
  %272 = load i32, ptr %21, align 4, !tbaa !5
  %273 = load i32, ptr %20, align 4, !tbaa !5
  %274 = icmp slt i32 %272, %273
  br i1 %274, label %275, label %277

275:                                              ; preds = %265
  %276 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %276, ptr %20, align 4, !tbaa !5
  br label %277

277:                                              ; preds = %275, %265
  br label %278

278:                                              ; preds = %277
  %279 = load i32, ptr %22, align 4, !tbaa !5
  %280 = add nsw i32 %279, 1
  store i32 %280, ptr %22, align 4, !tbaa !5
  br label %260, !llvm.loop !17

281:                                              ; preds = %264
  %282 = load i32, ptr %2, align 4, !tbaa !5
  %283 = add nsw i32 %282, 1
  store i32 %283, ptr %2, align 4, !tbaa !5
  %284 = load i32, ptr %20, align 4, !tbaa !5
  %285 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %283, i32 noundef %284)
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %23, !llvm.loop !18

286:                                              ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %287 = load i32, ptr %1, align 4
  ret i32 %287
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpii(i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Tree5buildEiii(ptr noundef nonnull align 4 dereferenceable(160048), i32 noundef, i32 noundef, i32 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Tree6modifyEiiiiii(ptr noundef nonnull align 4 dereferenceable(160048), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4Tree5queryEiiii(ptr noundef nonnull align 4 dereferenceable(160048), i32 noundef, i32 noundef, i32 noundef, i32 noundef) #5 align 2

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.Tree = type { [40012 x i32] }

@val = external dso_local global [10003 x i32], align 16
@c = external dso_local global [20006 x i32], align 16
@s = external dso_local local_unnamed_addr global [20006 x i32], align 16
@l = external dso_local local_unnamed_addr global [20006 x i32], align 16
@r = external dso_local local_unnamed_addr global [20006 x i32], align 16
@ord = external dso_local global [20006 x i32], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@tree = external dso_local global [102 x %struct.Tree], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %.not116 = icmp eq i32 %4, -1
  br i1 %.not116, label %.critedge, label %.lr.ph119

.lr.ph119:                                        ; preds = %0, %._crit_edge114
  %.063117 = phi i32 [ %112, %._crit_edge114 ], [ 0, %0 ]
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp ne i32 %5, 0
  %7 = load i32, ptr @m, align 4
  %8 = icmp ne i32 %7, 0
  %9 = select i1 %6, i1 true, i1 %8
  br i1 %9, label %.preheader81, label %.critedge

.preheader81:                                     ; preds = %.lr.ph119
  %10 = icmp sgt i32 %5, 1
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader81
  %11 = phi i32 [ %5, %.preheader81 ], [ %16, %.lr.ph ]
  %12 = add nsw i32 %11, 1
  store i32 0, ptr getelementptr inbounds (i8, ptr @val, i64 4), align 4, !tbaa !5
  store i32 -1, ptr @val, align 16, !tbaa !5
  %13 = icmp sgt i32 %11, 0
  br i1 %13, label %.lr.ph86, label %._crit_edge87.thread

._crit_edge87.thread:                             ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  br label %._crit_edge91.thread

.lr.ph:                                           ; preds = %.preheader81, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader81 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = getelementptr inbounds [10003 x i32], ptr @val, i64 0, i64 %indvars.iv.next
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %14)
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge87:                                    ; preds = %.lr.ph86
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %19 = icmp sgt i32 %24, 0
  br i1 %19, label %.lr.ph90, label %._crit_edge91.thread

.lr.ph90:                                         ; preds = %._crit_edge87
  %20 = zext nneg i32 %12 to i64
  %21 = getelementptr inbounds i32, ptr @val, i64 %20
  br label %28

.lr.ph86:                                         ; preds = %._crit_edge, %.lr.ph86
  %indvars.iv124 = phi i64 [ %indvars.iv.next125, %.lr.ph86 ], [ 0, %._crit_edge ]
  %22 = getelementptr inbounds [20006 x i32], ptr @c, i64 0, i64 %indvars.iv124
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %22)
  %indvars.iv.next125 = add nuw nsw i64 %indvars.iv124, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next125, %25
  br i1 %26, label %.lr.ph86, label %._crit_edge87, !llvm.loop !11

._crit_edge91.thread:                             ; preds = %._crit_edge87, %._crit_edge87.thread
  %.ph = phi i32 [ %11, %._crit_edge87.thread ], [ %24, %._crit_edge87 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  br label %._crit_edge95

._crit_edge91:                                    ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %27 = icmp sgt i32 %53, 0
  br i1 %27, label %.lr.ph94, label %._crit_edge95

28:                                               ; preds = %.lr.ph90, %28
  %indvars.iv127 = phi i64 [ 0, %.lr.ph90 ], [ %indvars.iv.next128, %28 ]
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %30 = getelementptr inbounds [10003 x i32], ptr @val, i64 0, i64 %indvars.iv.next128
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = sub nsw i32 %31, %32
  store i32 %33, ptr %2, align 4, !tbaa !5
  %34 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @val, ptr noundef nonnull %21, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %35 = ptrtoint ptr %34 to i64
  %36 = sub i64 %35, ptrtoint (ptr @val to i64)
  %37 = lshr exact i64 %36, 2
  %38 = trunc i64 %37 to i32
  %39 = add i32 %38, 1
  %40 = getelementptr inbounds [20006 x i32], ptr @l, i64 0, i64 %indvars.iv127
  store i32 %39, ptr %40, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %41 = load i32, ptr %30, align 4, !tbaa !5
  %42 = load i32, ptr %1, align 4, !tbaa !5
  %43 = add nsw i32 %42, %41
  store i32 %43, ptr %3, align 4, !tbaa !5
  %44 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @val, ptr noundef nonnull %21, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %45 = ptrtoint ptr %44 to i64
  %46 = sub i64 %45, ptrtoint (ptr @val to i64)
  %47 = lshr exact i64 %46, 2
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds [20006 x i32], ptr @r, i64 0, i64 %indvars.iv127
  store i32 %48, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %50 = getelementptr inbounds [20006 x i32], ptr @s, i64 0, i64 %indvars.iv127
  store i32 1, ptr %50, align 4, !tbaa !5
  %51 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %indvars.iv127
  %52 = trunc nuw nsw i64 %indvars.iv127 to i32
  store i32 %52, ptr %51, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next128, %54
  br i1 %55, label %28, label %._crit_edge91, !llvm.loop !12

._crit_edge95:                                    ; preds = %.lr.ph94, %._crit_edge91.thread, %._crit_edge91
  %.lcssa82 = phi i32 [ %53, %._crit_edge91 ], [ %.ph, %._crit_edge91.thread ], [ %66, %.lr.ph94 ]
  %56 = sext i32 %.lcssa82 to i64
  %57 = getelementptr inbounds i32, ptr @ord, i64 %56
  %58 = getelementptr inbounds i32, ptr %57, i64 %56
  call void @_ZSt4sortIPiPFbiiEEvT_S3_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %58, ptr noundef nonnull @_Z3cmpii)
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %.not7797 = icmp slt i32 %59, 0
  br i1 %.not7797, label %._crit_edge101, label %.lr.ph100

.lr.ph94:                                         ; preds = %._crit_edge91, %.lr.ph94
  %60 = phi i32 [ %66, %.lr.ph94 ], [ %53, %._crit_edge91 ]
  %.06992 = phi i32 [ %73, %.lr.ph94 ], [ 0, %._crit_edge91 ]
  %61 = add nsw i32 %60, %.06992
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [20006 x i32], ptr @c, i64 0, i64 %62
  %64 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %63)
  %65 = add nuw nsw i32 %.06992, 2
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = add nsw i32 %66, %.06992
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [20006 x i32], ptr @r, i64 0, i64 %68
  store i32 %65, ptr %69, align 4, !tbaa !5
  %70 = getelementptr inbounds [20006 x i32], ptr @l, i64 0, i64 %68
  store i32 %65, ptr %70, align 4, !tbaa !5
  %71 = getelementptr inbounds [20006 x i32], ptr @s, i64 0, i64 %68
  store i32 0, ptr %71, align 4, !tbaa !5
  %72 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %68
  store i32 %67, ptr %72, align 4, !tbaa !5
  %73 = add nuw nsw i32 %.06992, 1
  %74 = icmp slt i32 %73, %66
  br i1 %74, label %.lr.ph94, label %._crit_edge95, !llvm.loop !13

._crit_edge101:                                   ; preds = %.lr.ph100, %._crit_edge95
  call void @_ZN4Tree6modifyEiiiiii(ptr noundef nonnull align 4 dereferenceable(160048) @tree, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef 1, i32 noundef %12, i32 noundef 1)
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp sgt i32 %75, 0
  %.pre143 = load i32, ptr @m, align 4, !tbaa !5
  br i1 %76, label %.lr.ph109, label %.preheader

.lr.ph100:                                        ; preds = %._crit_edge95, %.lr.ph100
  %indvars.iv130 = phi i64 [ %indvars.iv.next131, %.lr.ph100 ], [ 0, %._crit_edge95 ]
  %77 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %indvars.iv130
  call void @_ZN4Tree5buildEiii(ptr noundef nonnull align 4 dereferenceable(160048) %77, i32 noundef 1, i32 noundef %12, i32 noundef 1)
  %indvars.iv.next131 = add nuw nsw i64 %indvars.iv130, 1
  %78 = load i32, ptr @m, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %.not77.not = icmp slt i64 %indvars.iv130, %79
  br i1 %.not77.not, label %.lr.ph100, label %._crit_edge101, !llvm.loop !14

.preheader:                                       ; preds = %._crit_edge106, %._crit_edge101
  %80 = phi i32 [ %.pre143, %._crit_edge101 ], [ %97, %._crit_edge106 ]
  %.not78110 = icmp slt i32 %80, 0
  br i1 %.not78110, label %._crit_edge114, label %.lr.ph113

.lr.ph109:                                        ; preds = %._crit_edge101, %._crit_edge106
  %81 = phi i32 [ %96, %._crit_edge106 ], [ %75, %._crit_edge101 ]
  %82 = phi i32 [ %97, %._crit_edge106 ], [ %.pre143, %._crit_edge101 ]
  %indvars.iv136 = phi i64 [ %indvars.iv.next137, %._crit_edge106 ], [ 0, %._crit_edge101 ]
  %83 = getelementptr inbounds [20006 x i32], ptr @ord, i64 0, i64 %indvars.iv136
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [20006 x i32], ptr @l, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = getelementptr inbounds [20006 x i32], ptr @r, i64 0, i64 %85
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = getelementptr inbounds [20006 x i32], ptr @c, i64 0, i64 %85
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = getelementptr inbounds [20006 x i32], ptr @s, i64 0, i64 %85
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %.not79102 = icmp slt i32 %82, %93
  br i1 %.not79102, label %._crit_edge106, label %.lr.ph105

.lr.ph105:                                        ; preds = %.lr.ph109
  %94 = add nsw i32 %87, -1
  %95 = sext i32 %93 to i64
  br label %101

._crit_edge106.loopexit:                          ; preds = %108
  %.pre142 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge106

._crit_edge106:                                   ; preds = %._crit_edge106.loopexit, %.lr.ph109
  %96 = phi i32 [ %.pre142, %._crit_edge106.loopexit ], [ %81, %.lr.ph109 ]
  %97 = phi i32 [ %109, %._crit_edge106.loopexit ], [ %82, %.lr.ph109 ]
  %indvars.iv.next137 = add nuw nsw i64 %indvars.iv136, 1
  %98 = shl nsw i32 %96, 1
  %99 = sext i32 %98 to i64
  %100 = icmp slt i64 %indvars.iv.next137, %99
  br i1 %100, label %.lr.ph109, label %.preheader, !llvm.loop !15

101:                                              ; preds = %.lr.ph105, %108
  %indvars.iv133 = phi i64 [ 0, %.lr.ph105 ], [ %indvars.iv.next134, %108 ]
  %102 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %indvars.iv133
  %103 = call noundef i32 @_ZN4Tree5queryEiiii(ptr noundef nonnull align 4 dereferenceable(160048) %102, i32 noundef %94, i32 noundef 1, i32 noundef %12, i32 noundef 1)
  %.not80 = icmp eq i32 %103, 1073741823
  br i1 %.not80, label %108, label %104

104:                                              ; preds = %101
  %105 = add nsw i32 %103, %91
  %106 = add nsw i64 %indvars.iv133, %95
  %107 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %106
  call void @_ZN4Tree6modifyEiiiiii(ptr noundef nonnull align 4 dereferenceable(160048) %107, i32 noundef %87, i32 noundef %89, i32 noundef %105, i32 noundef 1, i32 noundef %12, i32 noundef 1)
  br label %108

108:                                              ; preds = %104, %101
  %indvars.iv.next134 = add nuw nsw i64 %indvars.iv133, 1
  %109 = load i32, ptr @m, align 4, !tbaa !5
  %110 = sub nsw i32 %109, %93
  %111 = sext i32 %110 to i64
  %.not79.not = icmp slt i64 %indvars.iv133, %111
  br i1 %.not79.not, label %101, label %._crit_edge106.loopexit, !llvm.loop !16

._crit_edge114:                                   ; preds = %.lr.ph113, %.preheader
  %.064.lcssa = phi i32 [ 1073741823, %.preheader ], [ %spec.select, %.lr.ph113 ]
  %112 = add nuw nsw i32 %.063117, 1
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %112, i32 noundef %.064.lcssa)
  %114 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %.not = icmp eq i32 %114, -1
  br i1 %.not, label %.critedge, label %.lr.ph119, !llvm.loop !17

.lr.ph113:                                        ; preds = %.preheader, %.lr.ph113
  %indvars.iv139 = phi i64 [ %indvars.iv.next140, %.lr.ph113 ], [ 0, %.preheader ]
  %.064111 = phi i32 [ %spec.select, %.lr.ph113 ], [ 1073741823, %.preheader ]
  %115 = getelementptr inbounds [102 x %struct.Tree], ptr @tree, i64 0, i64 %indvars.iv139
  %116 = call noundef i32 @_ZN4Tree5queryEiiii(ptr noundef nonnull align 4 dereferenceable(160048) %115, i32 noundef %12, i32 noundef 1, i32 noundef %12, i32 noundef 1)
  %spec.select = call i32 @llvm.smin.i32(i32 %116, i32 %.064111)
  %indvars.iv.next140 = add nuw nsw i64 %indvars.iv139, 1
  %117 = load i32, ptr @m, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %.not78.not = icmp slt i64 %indvars.iv139, %118
  br i1 %.not78.not, label %.lr.ph113, label %._crit_edge114, !llvm.loop !18

.critedge:                                        ; preds = %.lr.ph119, %._crit_edge114, %0
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpii(i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Tree5buildEiii(ptr noundef nonnull align 4 dereferenceable(160048), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Tree6modifyEiiiiii(ptr noundef nonnull align 4 dereferenceable(160048), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4Tree5queryEiiii(ptr noundef nonnull align 4 dereferenceable(160048), i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #6

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

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

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


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