; LLVM IR from tangjz/acm-icpc :: lydsy (2762)

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

@n = external dso_local global i32, align 4
@num = external dso_local global [100001 x [2 x i32]], align 16
@tot = external dso_local global i32, align 4
@vis = external dso_local global [100001 x i8], align 16
@Tree = external dso_local global %struct.SegmentTree, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11SegmentTree6changeEiRKi(ptr noundef nonnull align 4 dereferenceable(16777216), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

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

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

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

11:                                               ; preds = %136, %0
  %12 = load i32, ptr %7, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %11
  %17 = getelementptr inbounds [10 x i8], ptr %6, i64 0, i64 0
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %17)
  %19 = getelementptr inbounds [10 x i8], ptr %6, i64 0, i64 0
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = sext i8 %20 to i32
  %22 = icmp eq i32 %21, 65
  br i1 %22, label %23, label %90

23:                                               ; preds = %16
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @tot, align 4, !tbaa !5
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sub nsw i32 %27, %28
  store i32 %29, ptr %3, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %37, label %32

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

35:                                               ; preds = %32
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef 1000000)
  br label %36

36:                                               ; preds = %35, %32
  br label %89

37:                                               ; preds = %23
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %46, label %40

40:                                               ; preds = %37
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = icmp slt i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %40
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef -1)
  br label %45

44:                                               ; preds = %40
  call void @_Z5checkii(i32 noundef 1, i32 noundef 1000000)
  br label %45

45:                                               ; preds = %44, %43
  br label %88

46:                                               ; preds = %37
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %49, label %65

49:                                               ; preds = %46
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %52, label %57

52:                                               ; preds = %49
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sdiv i32 %53, %54
  %56 = add nsw i32 %55, 1
  call void @_Z5checkii(i32 noundef %56, i32 noundef 1000000)
  br label %64

57:                                               ; preds = %49
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = sub nsw i32 0, %59
  %61 = sdiv i32 %58, %60
  %62 = add nsw i32 %61, 1
  %63 = sub nsw i32 0, %62
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef %63)
  br label %64

64:                                               ; preds = %57, %52
  br label %87

65:                                               ; preds = %46
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = icmp slt i32 %66, 0
  br i1 %67, label %68, label %86

68:                                               ; preds = %65
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %71, label %78

71:                                               ; preds = %68
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sub nsw i32 0, %72
  %74 = sub nsw i32 %73, 1
  %75 = load i32, ptr %2, align 4, !tbaa !5
  %76 = sdiv i32 %74, %75
  %77 = sub nsw i32 0, %76
  call void @_Z5checkii(i32 noundef %77, i32 noundef 1000000)
  br label %85

78:                                               ; preds = %68
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sub nsw i32 0, %79
  %81 = sub nsw i32 %80, 1
  %82 = load i32, ptr %2, align 4, !tbaa !5
  %83 = sub nsw i32 0, %82
  %84 = sdiv i32 %81, %83
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef %84)
  br label %85

85:                                               ; preds = %78, %71
  br label %86

86:                                               ; preds = %85, %65
  br label %87

87:                                               ; preds = %86, %64
  br label %88

88:                                               ; preds = %87, %45
  br label %89

89:                                               ; preds = %88, %36
  br label %135

90:                                               ; preds = %16
  %91 = getelementptr inbounds [10 x i8], ptr %6, i64 0, i64 0
  %92 = load i8, ptr %91, align 1, !tbaa !9
  %93 = sext i8 %92 to i32
  %94 = icmp eq i32 %93, 68
  br i1 %94, label %95, label %128

95:                                               ; preds = %90
  %96 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %97 = load i32, ptr %2, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !10, !range !12, !noundef !13
  %101 = trunc i8 %100 to i1
  br i1 %101, label %103, label %102

102:                                              ; preds = %95
  br label %136

103:                                              ; preds = %95
  %104 = load i32, ptr %2, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100001 x [2 x i32]], ptr @num, i64 0, i64 %105
  %107 = getelementptr inbounds [2 x i32], ptr %106, i64 0, i64 0
  %108 = load i32, ptr %107, align 8, !tbaa !5
  %109 = add nsw i32 %108, 1000001
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 -1, ptr %8, align 4, !tbaa !5
  call void @_ZN11SegmentTree6changeEiRKi(ptr noundef nonnull align 4 dereferenceable(16777216) @Tree, i32 noundef %109, ptr noundef nonnull align 4 dereferenceable(4) %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %110 = load i32, ptr %2, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [100001 x [2 x i32]], ptr @num, i64 0, i64 %111
  %113 = getelementptr inbounds [2 x i32], ptr %112, i64 0, i64 1
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = icmp slt i32 %114, 1000000
  br i1 %115, label %116, label %124

116:                                              ; preds = %103
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100001 x [2 x i32]], ptr @num, i64 0, i64 %118
  %120 = getelementptr inbounds [2 x i32], ptr %119, i64 0, i64 1
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  %123 = add nsw i32 %122, 1000001
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @_ZN11SegmentTree6changeEiRKi(ptr noundef nonnull align 4 dereferenceable(16777216) @Tree, i32 noundef %123, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %124

124:                                              ; preds = %116, %103
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %126
  store i8 0, ptr %127, align 1, !tbaa !10
  br label %134

128:                                              ; preds = %90
  %129 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %130 = load i32, ptr %2, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1000001
  %132 = call noundef i32 @_ZN11SegmentTree5queryEi(ptr noundef nonnull align 4 dereferenceable(16777216) @Tree, i32 noundef %131)
  %133 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %132)
  br label %134

134:                                              ; preds = %128, %124
  br label %135

135:                                              ; preds = %134, %89
  br label %136

136:                                              ; preds = %135, %102
  %137 = load i32, ptr %7, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %7, align 4, !tbaa !5
  br label %11, !llvm.loop !14

139:                                              ; preds = %15
  call void @llvm.lifetime.end.p0(i64 10, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

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

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

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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"bool", !7, i64 0}
!12 = !{i8 0, i8 2}
!13 = !{}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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

@n = external dso_local global i32, align 4
@num = external dso_local local_unnamed_addr global [100001 x [2 x i32]], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@vis = external dso_local local_unnamed_addr global [100001 x i8], align 16
@Tree = external dso_local global %struct.SegmentTree, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN11SegmentTree6changeEiRKi(ptr noundef nonnull align 4 dereferenceable(16777216), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [10 x i8], align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %4) #5
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not8 = icmp slt i32 %8, 1
  br i1 %.not8, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %72, %0
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph:                                           ; preds = %0, %72
  %.09 = phi i32 [ %73, %72 ], [ 1, %0 ]
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %4)
  %10 = load i8, ptr %4, align 1, !tbaa !9
  switch i8 %10, label %66 [
    i8 65, label %11
    i8 68, label %46
  ]

11:                                               ; preds = %.lr.ph
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %13 = load i32, ptr @tot, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr @tot, align 4, !tbaa !5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sub nsw i32 %15, %16
  store i32 %17, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %.not6 = icmp eq i32 %18, 0
  br i1 %.not6, label %19, label %22

19:                                               ; preds = %11
  %20 = icmp slt i32 %17, 0
  br i1 %20, label %21, label %72

21:                                               ; preds = %19
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef 1000000)
  br label %72

22:                                               ; preds = %11
  %.not7 = icmp eq i32 %15, %16
  br i1 %.not7, label %23, label %27

23:                                               ; preds = %22
  %24 = icmp slt i32 %18, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %23
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef -1)
  br label %72

26:                                               ; preds = %23
  call void @_Z5checkii(i32 noundef 1, i32 noundef 1000000)
  br label %72

27:                                               ; preds = %22
  %28 = icmp sgt i32 %17, 0
  %29 = icmp sgt i32 %18, 0
  br i1 %28, label %30, label %38

30:                                               ; preds = %27
  br i1 %29, label %31, label %34

31:                                               ; preds = %30
  %32 = udiv i32 %17, %18
  %33 = add nuw nsw i32 %32, 1
  call void @_Z5checkii(i32 noundef %33, i32 noundef 1000000)
  br label %72

34:                                               ; preds = %30
  %35 = sub nsw i32 0, %18
  %36 = udiv i32 %17, %35
  %37 = xor i32 %36, -1
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef %37)
  br label %72

38:                                               ; preds = %27
  %39 = xor i32 %17, -1
  br i1 %29, label %40, label %43

40:                                               ; preds = %38
  %41 = udiv i32 %39, %18
  %42 = sub nsw i32 0, %41
  call void @_Z5checkii(i32 noundef %42, i32 noundef 1000000)
  br label %72

43:                                               ; preds = %38
  %44 = sub nsw i32 0, %18
  %45 = udiv i32 %39, %44
  call void @_Z5checkii(i32 noundef -1000000, i32 noundef %45)
  br label %72

46:                                               ; preds = %.lr.ph
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %48 = load i32, ptr %1, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %49
  %51 = load i8, ptr %50, align 1, !tbaa !10, !range !12, !noundef !13
  %52 = trunc nuw i8 %51 to i1
  br i1 %52, label %53, label %72

53:                                               ; preds = %46
  %54 = getelementptr inbounds [100001 x [2 x i32]], ptr @num, i64 0, i64 %49
  %55 = load i32, ptr %54, align 8, !tbaa !5
  %56 = add nsw i32 %55, 1000001
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 -1, ptr %5, align 4, !tbaa !5
  call void @_ZN11SegmentTree6changeEiRKi(ptr noundef nonnull align 4 dereferenceable(16777216) @Tree, i32 noundef %56, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100001 x [2 x i32]], ptr @num, i64 0, i64 %58, i64 1
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = icmp slt i32 %60, 1000000
  br i1 %61, label %62, label %64

62:                                               ; preds = %53
  %63 = add nsw i32 %60, 1000002
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @_ZN11SegmentTree6changeEiRKi(ptr noundef nonnull align 4 dereferenceable(16777216) @Tree, i32 noundef %63, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  %.pre10 = sext i32 %.pre to i64
  br label %64

64:                                               ; preds = %62, %53
  %.pre-phi = phi i64 [ %.pre10, %62 ], [ %58, %53 ]
  %65 = getelementptr inbounds [100001 x i8], ptr @vis, i64 0, i64 %.pre-phi
  store i8 0, ptr %65, align 1, !tbaa !10
  br label %72

66:                                               ; preds = %.lr.ph
  %67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %68 = load i32, ptr %1, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1000001
  %70 = call noundef i32 @_ZN11SegmentTree5queryEi(ptr noundef nonnull align 4 dereferenceable(16777216) @Tree, i32 noundef %69)
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %70)
  br label %72

72:                                               ; preds = %26, %25, %43, %40, %31, %34, %19, %21, %66, %64, %46
  %73 = add nuw nsw i32 %.09, 1
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.09, %74
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !14
}

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

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

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

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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind }

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

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


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass