; LLVM IR from tangjz/acm-icpc :: buaa/oj3rd (972)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_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 }

@cnt = external dso_local global %"class.std::map", align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@Log = external dso_local global [100002 x i32], align 16
@st = external dso_local global [100002 x [17 x i64]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 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 i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %29, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 100002
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = ashr i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !5
  br label %29

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

32:                                               ; preds = %18
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %34

34:                                               ; preds = %195, %32
  %35 = load i32, ptr @t, align 4, !tbaa !5
  %36 = add nsw i32 %35, -1
  store i32 %36, ptr @t, align 4, !tbaa !5
  %37 = icmp ne i32 %35, 0
  br i1 %37, label %38, label %196

38:                                               ; preds = %34
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @cnt) #5
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %52, %38
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %55

45:                                               ; preds = %40
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %47
  %49 = getelementptr inbounds [17 x i64], ptr %48, i64 0, i64 0
  %50 = getelementptr inbounds i64, ptr %49, i64 0
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %50)
  br label %52

52:                                               ; preds = %45
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %3, align 4, !tbaa !5
  br label %40, !llvm.loop !11

55:                                               ; preds = %44
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %57
  %59 = getelementptr inbounds [17 x i64], ptr %58, i64 0, i64 0
  store i64 0, ptr %59, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %111, %55
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp sle i32 %61, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %60
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %114

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

70:                                               ; preds = %107, %69
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = shl i32 1, %73
  %75 = add nsw i32 %71, %74
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = icmp sle i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %70
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %110

79:                                               ; preds = %70
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %81
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [17 x i64], ptr %82, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !12
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = sub nsw i32 %89, 1
  %91 = shl i32 1, %90
  %92 = add nsw i32 %88, %91
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %93
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = sub nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [17 x i64], ptr %94, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !12
  %100 = and i64 %87, %99
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %102
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [17 x i64], ptr %103, i64 0, i64 %105
  store i64 %100, ptr %106, align 8, !tbaa !12
  br label %107

107:                                              ; preds = %79
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %6, align 4, !tbaa !5
  br label %70, !llvm.loop !14

110:                                              ; preds = %78
  br label %111

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

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

115:                                              ; preds = %172, %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = load i32, ptr @n, align 4, !tbaa !5
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %175

120:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %121 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %121, ptr %8, align 4, !tbaa !5
  br label %122

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

126:                                              ; preds = %122
  store i32 19, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %171

127:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %128 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %128, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %129 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %129, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = call noundef i64 @_Z3rmqii(i32 noundef %130, i32 noundef %131)
  store i64 %132, ptr %12, align 8, !tbaa !12
  br label %133

133:                                              ; preds = %153, %127
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = icmp slt i32 %134, %135
  br i1 %136, label %137, label %154

137:                                              ; preds = %133
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = add nsw i32 %138, %139
  %141 = add nsw i32 %140, 1
  %142 = ashr i32 %141, 1
  store i32 %142, ptr %11, align 4, !tbaa !5
  %143 = load i32, ptr %7, align 4, !tbaa !5
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = call noundef i64 @_Z3rmqii(i32 noundef %143, i32 noundef %144)
  %146 = load i64, ptr %12, align 8, !tbaa !12
  %147 = icmp slt i64 %145, %146
  br i1 %147, label %148, label %151

148:                                              ; preds = %137
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = sub nsw i32 %149, 1
  store i32 %150, ptr %10, align 4, !tbaa !5
  br label %153

151:                                              ; preds = %137
  %152 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %152, ptr %9, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %151, %148
  br label %133, !llvm.loop !16

154:                                              ; preds = %133
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = load i32, ptr %8, align 4, !tbaa !5
  %157 = sub nsw i32 %155, %156
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = load i32, ptr @n, align 4, !tbaa !5
  %160 = icmp slt i32 %158, %159
  %161 = zext i1 %160 to i32
  %162 = add nsw i32 %157, %161
  %163 = sext i32 %162 to i64
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @cnt, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %165 = load i64, ptr %164, align 8, !tbaa !12
  %166 = add nsw i64 %165, %163
  store i64 %166, ptr %164, align 8, !tbaa !12
  %167 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %167, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %168

168:                                              ; preds = %154
  %169 = load i32, ptr %8, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %8, align 4, !tbaa !5
  br label %122, !llvm.loop !17

171:                                              ; preds = %126
  br label %172

172:                                              ; preds = %171
  %173 = load i32, ptr %7, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %7, align 4, !tbaa !5
  br label %115, !llvm.loop !18

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

176:                                              ; preds = %192, %175
  %177 = load i32, ptr %13, align 4, !tbaa !5
  %178 = load i32, ptr @m, align 4, !tbaa !5
  %179 = icmp slt i32 %177, %178
  br i1 %179, label %181, label %180

180:                                              ; preds = %176
  store i32 24, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %195

181:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %182 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %14)
  %183 = call noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @cnt, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %184 = icmp ne i64 %183, 0
  br i1 %184, label %185, label %188

185:                                              ; preds = %181
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @cnt, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %187 = load i64, ptr %186, align 8, !tbaa !12
  br label %189

188:                                              ; preds = %181
  br label %189

189:                                              ; preds = %188, %185
  %190 = phi i64 [ %187, %185 ], [ 0, %188 ]
  %191 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %190)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %192

192:                                              ; preds = %189
  %193 = load i32, ptr %13, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %13, align 4, !tbaa !5
  br label %176, !llvm.loop !19

195:                                              ; preds = %180
  br label %34, !llvm.loop !20

196:                                              ; preds = %34
  ret i32 0
}

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

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

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

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

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

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

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

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


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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_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 }

@cnt = external dso_local global %"class.std::map", align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@Log = external dso_local local_unnamed_addr global [100002 x i32], align 16
@st = external dso_local global [100002 x [17 x i64]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  br label %7

3:                                                ; preds = %7
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @t, align 4, !tbaa !5
  %.not75 = icmp eq i32 %5, 0
  br i1 %.not75, label %._crit_edge78, label %.lr.ph77

7:                                                ; preds = %7, %0
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.1, %7 ]
  %8 = lshr exact i64 %indvars.iv, 1
  %9 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = add nsw i32 %10, 1
  %12 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %indvars.iv
  store i32 %11, ptr %12, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %13 = lshr exact i64 %indvars.iv, 1
  %14 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  %17 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %indvars.iv.next
  store i32 %16, ptr %17, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 100002
  br i1 %exitcond.not.1, label %3, label %7, !llvm.loop !9

.loopexit:                                        ; preds = %101, %.preheader57
  %18 = load i32, ptr @t, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %18, 0
  br i1 %.not, label %._crit_edge78, label %.lr.ph77, !llvm.loop !11

.lr.ph77:                                         ; preds = %3, %.loopexit
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @cnt) #6
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %.lr.ph77.._crit_edge_crit_edge

.lr.ph77.._crit_edge_crit_edge:                   ; preds = %.lr.ph77
  %.pre = sext i32 %21 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph77.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.lr.ph77.._crit_edge_crit_edge ], [ %33, %.lr.ph ]
  %23 = phi i32 [ %21, %.lr.ph77.._crit_edge_crit_edge ], [ %32, %.lr.ph ]
  %24 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %.pre-phi
  store i64 0, ptr %24, align 8, !tbaa !12
  %25 = add nsw i32 %23, 1
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100002 x i32], ptr @Log, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %.not5365 = icmp slt i32 %28, 1
  br i1 %.not5365, label %.preheader58, label %.preheader56.preheader

.preheader56.preheader:                           ; preds = %._crit_edge
  %29 = add nuw i32 %28, 1
  %wide.trip.count = zext i32 %29 to i64
  br label %.preheader56

.lr.ph:                                           ; preds = %.lr.ph77, %.lr.ph
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph ], [ 0, %.lr.ph77 ]
  %30 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv81
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %30)
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next82, %33
  br i1 %34, label %.lr.ph, label %._crit_edge, !llvm.loop !14

.preheader58:                                     ; preds = %._crit_edge64, %._crit_edge
  %35 = icmp sgt i32 %23, 0
  br i1 %35, label %.preheader, label %.preheader57

.preheader56:                                     ; preds = %.preheader56.preheader, %._crit_edge64
  %indvars.iv87 = phi i64 [ 1, %.preheader56.preheader ], [ %indvars.iv.next88, %._crit_edge64 ]
  %36 = add nsw i64 %indvars.iv87, -1
  %37 = trunc nuw nsw i64 %36 to i32
  %38 = shl nuw i32 1, %37
  %.not5561 = icmp sgt i32 %38, %23
  br i1 %.not5561, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %.preheader56
  %39 = sext i32 %38 to i64
  %invariant.op = sub nsw i64 %.pre-phi, %39
  %smax = call i64 @llvm.smax.i64(i64 %invariant.op, i64 0)
  %40 = icmp slt i64 %invariant.op, 1
  br i1 %40, label %._crit_edge64.loopexit.unr-lcssa, label %.lr.ph63.new

.lr.ph63.new:                                     ; preds = %.lr.ph63
  %41 = add nuw nsw i64 %smax, 1
  %unroll_iter = and i64 %41, 9223372036854775806
  br label %50

._crit_edge64.loopexit.unr-lcssa:                 ; preds = %50, %.lr.ph63
  %indvars.iv84.unr = phi i64 [ 0, %.lr.ph63 ], [ %indvars.iv.next85.1, %50 ]
  %42 = and i64 %smax, 1
  %lcmp.mod.not.not = icmp eq i64 %42, 0
  br i1 %lcmp.mod.not.not, label %._crit_edge64.loopexit.epilog-lcssa, label %._crit_edge64

._crit_edge64.loopexit.epilog-lcssa:              ; preds = %._crit_edge64.loopexit.unr-lcssa
  %43 = add nuw nsw i64 %indvars.iv84.unr, %39
  %44 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv84.unr, i64 %36
  %45 = load i64, ptr %44, align 8, !tbaa !12
  %46 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %43, i64 %36
  %47 = load i64, ptr %46, align 8, !tbaa !12
  %48 = and i64 %47, %45
  %49 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv84.unr, i64 %indvars.iv87
  store i64 %48, ptr %49, align 8, !tbaa !12
  br label %._crit_edge64

._crit_edge64:                                    ; preds = %._crit_edge64.loopexit.epilog-lcssa, %._crit_edge64.loopexit.unr-lcssa, %.preheader56
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond90.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count
  br i1 %exitcond90.not, label %.preheader58, label %.preheader56, !llvm.loop !15

50:                                               ; preds = %50, %.lr.ph63.new
  %indvars.iv84 = phi i64 [ 0, %.lr.ph63.new ], [ %indvars.iv.next85.1, %50 ]
  %niter = phi i64 [ 0, %.lr.ph63.new ], [ %niter.next.1, %50 ]
  %51 = add nuw nsw i64 %indvars.iv84, %39
  %52 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv84, i64 %36
  %53 = load i64, ptr %52, align 8, !tbaa !12
  %54 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %51, i64 %36
  %55 = load i64, ptr %54, align 8, !tbaa !12
  %56 = and i64 %55, %53
  %57 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv84, i64 %indvars.iv87
  store i64 %56, ptr %57, align 8, !tbaa !12
  %indvars.iv.next85 = or disjoint i64 %indvars.iv84, 1
  %58 = add nuw nsw i64 %indvars.iv.next85, %39
  %59 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv.next85, i64 %36
  %60 = load i64, ptr %59, align 8, !tbaa !12
  %61 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %58, i64 %36
  %62 = load i64, ptr %61, align 8, !tbaa !12
  %63 = and i64 %62, %60
  %64 = getelementptr inbounds [100002 x [17 x i64]], ptr @st, i64 0, i64 %indvars.iv.next85, i64 %indvars.iv87
  store i64 %63, ptr %64, align 8, !tbaa !12
  %indvars.iv.next85.1 = add nuw nsw i64 %indvars.iv84, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1.not = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1.not, label %._crit_edge64.loopexit.unr-lcssa, label %50, !llvm.loop !16

.preheader57:                                     ; preds = %._crit_edge71, %.preheader58
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %.lr.ph74, label %.loopexit

.preheader:                                       ; preds = %.preheader58, %._crit_edge71
  %67 = phi i32 [ %69, %._crit_edge71 ], [ %23, %.preheader58 ]
  %.04672 = phi i32 [ %70, %._crit_edge71 ], [ 0, %.preheader58 ]
  %68 = icmp slt i32 %.04672, %67
  br i1 %68, label %.lr.ph70, label %._crit_edge71

._crit_edge71:                                    ; preds = %83, %.preheader
  %69 = phi i32 [ %67, %.preheader ], [ %94, %83 ]
  %70 = add nuw nsw i32 %.04672, 1
  %71 = icmp slt i32 %70, %69
  br i1 %71, label %.preheader, label %.preheader57, !llvm.loop !17

.lr.ph70:                                         ; preds = %.preheader, %83
  %72 = phi i32 [ %94, %83 ], [ %67, %.preheader ]
  %.04569 = phi i32 [ %93, %83 ], [ %.04672, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %73 = call noundef i64 @_Z3rmqii(i32 noundef %.04672, i32 noundef %.04569)
  store i64 %73, ptr %1, align 8, !tbaa !12
  br label %74

74:                                               ; preds = %.lr.ph70, %74
  %.04268 = phi i32 [ %72, %.lr.ph70 ], [ %.1, %74 ]
  %.04367 = phi i32 [ %.04569, %.lr.ph70 ], [ %.144, %74 ]
  %75 = add i32 %.04367, 1
  %76 = add i32 %75, %.04268
  %77 = ashr i32 %76, 1
  %78 = call noundef i64 @_Z3rmqii(i32 noundef %.04672, i32 noundef %77)
  %79 = load i64, ptr %1, align 8, !tbaa !12
  %80 = icmp slt i64 %78, %79
  %81 = add nsw i32 %77, -1
  %.144 = select i1 %80, i32 %.04367, i32 %77
  %.1 = select i1 %80, i32 %81, i32 %.04268
  %82 = icmp slt i32 %.144, %.1
  br i1 %82, label %74, label %83, !llvm.loop !18

83:                                               ; preds = %74
  %84 = sub i32 %.144, %.04569
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = icmp slt i32 %.144, %85
  %87 = zext i1 %86 to i32
  %88 = add nsw i32 %84, %87
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @cnt, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %91 = load i64, ptr %90, align 8, !tbaa !12
  %92 = add nsw i64 %91, %89
  store i64 %92, ptr %90, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %93 = add nsw i32 %.144, 1
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %.lr.ph70, label %._crit_edge71, !llvm.loop !19

.lr.ph74:                                         ; preds = %.preheader57, %101
  %.073 = phi i32 [ %104, %101 ], [ 0, %.preheader57 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %96 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %2)
  %97 = call noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @cnt, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %.not54 = icmp eq i64 %97, 0
  br i1 %.not54, label %101, label %98

98:                                               ; preds = %.lr.ph74
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @cnt, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %100 = load i64, ptr %99, align 8, !tbaa !12
  br label %101

101:                                              ; preds = %.lr.ph74, %98
  %102 = phi i64 [ %100, %98 ], [ 0, %.lr.ph74 ]
  %103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %102)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %104 = add nuw nsw i32 %.073, 1
  %105 = load i32, ptr @m, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %.lr.ph74, label %.loopexit, !llvm.loop !20

._crit_edge78:                                    ; preds = %.loopexit, %3
  ret i32 0
}

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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