; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-11-22 (D - Database - lzy)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@r1 = external dso_local global i32, align 4
@r2 = external dso_local global i32, align 4
@c1 = external dso_local global i32, align 4
@c2 = external dso_local global i32, align 4
@a = external dso_local global i64, align 8
@b = external dso_local global i64, align 8
@h = external dso_local global [10009 x [19 x %"struct.std::pair"]], align 16
@f = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 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 %"struct.std::pair.0", align 8
  %8 = alloca %"struct.std::pair.0", align 8
  %9 = alloca %"struct.std::pair.0", align 8
  store i32 0, ptr %1, align 4
  br label %10

10:                                               ; preds = %155, %153, %0
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %12 = icmp eq i32 %11, 2
  br i1 %12, label %13, label %167

13:                                               ; preds = %10
  %14 = call i32 @getchar()
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %65, %13
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  store i32 0, ptr @m, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %63, %20
  store i64 0, ptr @a, align 8, !tbaa !9
  store i64 0, ptr @b, align 8, !tbaa !9
  br label %22

22:                                               ; preds = %30, %21
  %23 = call i32 @getchar()
  store i32 %23, ptr @c, align 4, !tbaa !5
  %24 = load i32, ptr @c, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 44
  br i1 %25, label %29, label %26

26:                                               ; preds = %22
  %27 = load i32, ptr @c, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 10
  br i1 %28, label %29, label %30

29:                                               ; preds = %26, %22
  br label %41

30:                                               ; preds = %26
  %31 = load i64, ptr @a, align 8, !tbaa !9
  %32 = mul i64 %31, 100000009
  %33 = load i32, ptr @c, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = add i64 %32, %34
  store i64 %35, ptr @a, align 8, !tbaa !9
  %36 = load i64, ptr @b, align 8, !tbaa !9
  %37 = mul i64 %36, 1000000007
  %38 = load i32, ptr @c, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = add i64 %37, %39
  store i64 %40, ptr @b, align 8, !tbaa !9
  br label %22, !llvm.loop !11

41:                                               ; preds = %29
  %42 = load i64, ptr @a, align 8, !tbaa !9
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %44
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %45, i64 0, i64 %47
  %49 = getelementptr inbounds %"struct.std::pair", ptr %48, i32 0, i32 0
  store i64 %42, ptr %49, align 16, !tbaa !13
  %50 = load i64, ptr @b, align 8, !tbaa !9
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %52
  %54 = load i32, ptr @m, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %53, i64 0, i64 %55
  %57 = getelementptr inbounds %"struct.std::pair", ptr %56, i32 0, i32 1
  store i64 %50, ptr %57, align 8, !tbaa !15
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr @m, align 4, !tbaa !5
  %60 = load i32, ptr @c, align 4, !tbaa !5
  %61 = icmp eq i32 %60, 10
  br i1 %61, label %62, label %63

62:                                               ; preds = %41
  br label %64

63:                                               ; preds = %41
  br label %21, !llvm.loop !16

64:                                               ; preds = %62
  br label %65

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

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

69:                                               ; preds = %148, %68
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = load i32, ptr @m, align 4, !tbaa !5
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  store i32 11, ptr %4, align 4
  br label %151

74:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %5, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %142, %74
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = load i32, ptr @m, align 4, !tbaa !5
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 14, ptr %4, align 4
  br label %145

82:                                               ; preds = %77
  call void @_ZNSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @f) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %136, %82
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 17, ptr %4, align 4
  br label %139

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #6
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %90
  %92 = load i32, ptr %3, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %91, i64 0, i64 %93
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %96
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %97, i64 0, i64 %99
  call void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %7, ptr noundef nonnull align 8 dereferenceable(16) %94, ptr noundef nonnull align 8 dereferenceable(16) %100)
  %101 = call noundef i64 @_ZNKSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 8 dereferenceable(32) %7)
  %102 = icmp ne i64 %101, 0
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #6
  br i1 %102, label %103, label %121

103:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %105
  %107 = load i32, ptr %3, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %106, i64 0, i64 %108
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %111
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %112, i64 0, i64 %114
  call void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %109, ptr noundef nonnull align 8 dereferenceable(16) %115)
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 8 dereferenceable(32) %8)
  %117 = load i32, ptr %116, align 4, !tbaa !5
  store i32 %117, ptr @r1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  %118 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %118, ptr @r2, align 4, !tbaa !5
  %119 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %119, ptr @c1, align 4, !tbaa !5
  %120 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %120, ptr @c2, align 4, !tbaa !5
  store i32 20, ptr %4, align 4
  br label %139

121:                                              ; preds = %88
  %122 = load i32, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %124
  %126 = load i32, ptr %3, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %125, i64 0, i64 %127
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %130
  %132 = load i32, ptr %5, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [19 x %"struct.std::pair"], ptr %131, i64 0, i64 %133
  call void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind writable sret(%"struct.std::pair.0") align 8 %9, ptr noundef nonnull align 8 dereferenceable(16) %128, ptr noundef nonnull align 8 dereferenceable(16) %134)
  %135 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 8 dereferenceable(32) %9)
  store i32 %122, ptr %135, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  br label %136

136:                                              ; preds = %121
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %6, align 4, !tbaa !5
  br label %83, !llvm.loop !18

139:                                              ; preds = %103, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %140 = load i32, ptr %4, align 4
  switch i32 %140, label %145 [
    i32 17, label %141
  ]

141:                                              ; preds = %139
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %5, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %5, align 4, !tbaa !5
  br label %77, !llvm.loop !19

145:                                              ; preds = %139, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  %146 = load i32, ptr %4, align 4
  switch i32 %146, label %151 [
    i32 14, label %147
  ]

147:                                              ; preds = %145
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %3, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %3, align 4, !tbaa !5
  br label %69, !llvm.loop !20

151:                                              ; preds = %145, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %152 = load i32, ptr %4, align 4
  switch i32 %152, label %168 [
    i32 11, label %153
    i32 20, label %155
  ]

153:                                              ; preds = %151
  %154 = call i32 @puts(ptr noundef @.str.1)
  br label %10, !llvm.loop !21

155:                                              ; preds = %151
  %156 = call i32 @puts(ptr noundef @.str.2)
  %157 = load i32, ptr @r1, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  %159 = load i32, ptr @r2, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  %161 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %158, i32 noundef %160)
  %162 = load i32, ptr @c1, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  %164 = load i32, ptr @c2, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %163, i32 noundef %165)
  br label %10, !llvm.loop !21

167:                                              ; preds = %10
  ret i32 0

168:                                              ; preds = %151
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar() #2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #5

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

declare i32 @puts(ptr noundef) #1

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

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 = { "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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSSt4pairIyyE", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@c = external dso_local local_unnamed_addr global i32, align 4
@r1 = external dso_local local_unnamed_addr global i32, align 4
@r2 = external dso_local local_unnamed_addr global i32, align 4
@c1 = external dso_local local_unnamed_addr global i32, align 4
@c2 = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global i64, align 8
@b = external dso_local local_unnamed_addr global i64, align 8
@h = external dso_local global [10009 x [19 x %"struct.std::pair"]], align 16
@f = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::pair.0", align 8
  %2 = alloca %"struct.std::pair.0", align 8
  %3 = alloca %"struct.std::pair.0", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %5 = icmp eq i32 %4, 2
  br i1 %5, label %.lr.ph62, label %._crit_edge63

.lr.ph62:                                         ; preds = %0, %.backedge
  %6 = call i32 @getchar()
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.lr.ph62..preheader_crit_edge

.lr.ph62..preheader_crit_edge:                    ; preds = %.lr.ph62
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %31, %.lr.ph62..preheader_crit_edge
  %9 = phi i32 [ %.pre, %.lr.ph62..preheader_crit_edge ], [ %29, %31 ]
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph59, label %._crit_edge60

.lr.ph:                                           ; preds = %.lr.ph62, %31
  %indvars.iv = phi i64 [ %indvars.iv.next, %31 ], [ 0, %.lr.ph62 ]
  store i32 0, ptr @m, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %22, %.lr.ph
  store i64 0, ptr @a, align 8, !tbaa !9
  br label %12

12:                                               ; preds = %14, %11
  %storemerge = phi i64 [ 0, %11 ], [ %21, %14 ]
  store i64 %storemerge, ptr @b, align 8, !tbaa !9
  %13 = call i32 @getchar()
  store i32 %13, ptr @c, align 4, !tbaa !5
  switch i32 %13, label %14 [
    i32 44, label %22
    i32 10, label %22
  ]

14:                                               ; preds = %12
  %15 = load i64, ptr @a, align 8, !tbaa !9
  %16 = mul i64 %15, 100000009
  %17 = sext i32 %13 to i64
  %18 = add i64 %16, %17
  store i64 %18, ptr @a, align 8, !tbaa !9
  %19 = load i64, ptr @b, align 8, !tbaa !9
  %20 = mul i64 %19, 1000000007
  %21 = add i64 %20, %17
  br label %12, !llvm.loop !11

22:                                               ; preds = %12, %12
  %23 = load i64, ptr @a, align 8, !tbaa !9
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %indvars.iv, i64 %25
  store i64 %23, ptr %26, align 16, !tbaa !13
  %27 = load i64, ptr @b, align 8, !tbaa !9
  %28 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %indvars.iv, i64 %25, i32 1
  store i64 %27, ptr %28, align 8, !tbaa !15
  %29 = add nsw i32 %24, 1
  store i32 %29, ptr @m, align 4, !tbaa !5
  %30 = icmp eq i32 %13, 10
  br i1 %30, label %31, label %11, !llvm.loop !16

31:                                               ; preds = %22
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %.lr.ph, label %.preheader, !llvm.loop !17

.loopexit.loopexit:                               ; preds = %._crit_edge
  %.pre83 = sext i32 %49 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph59
  %.pre-phi = phi i64 [ %.pre83, %.loopexit.loopexit ], [ %38, %.lr.ph59 ]
  %35 = phi i32 [ %49, %.loopexit.loopexit ], [ %37, %.lr.ph59 ]
  %36 = icmp slt i64 %indvars.iv.next81, %.pre-phi
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  br i1 %36, label %.lr.ph59, label %._crit_edge60, !llvm.loop !18

.lr.ph59:                                         ; preds = %.preheader, %.loopexit
  %37 = phi i32 [ %35, %.loopexit ], [ %9, %.preheader ]
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.loopexit ], [ 0, %.preheader ]
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.loopexit ], [ 1, %.preheader ]
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next81, %38
  br i1 %39, label %.lr.ph57, label %.loopexit

.lr.ph57:                                         ; preds = %.lr.ph59, %._crit_edge
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %._crit_edge ], [ %indvars.iv75, %.lr.ph59 ]
  call void @_ZNSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @f) #6
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %.not3752 = icmp sgt i32 %40, 0
  br i1 %.not3752, label %.lr.ph54, label %._crit_edge

.lr.ph54:                                         ; preds = %.lr.ph57, %44
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %44 ], [ 0, %.lr.ph57 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #6
  %41 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %indvars.iv72, i64 %indvars.iv80
  %42 = getelementptr inbounds [10009 x [19 x %"struct.std::pair"]], ptr @h, i64 0, i64 %indvars.iv72, i64 %indvars.iv77
  call void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %1, ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(16) %42)
  %43 = call noundef i64 @_ZNKSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 8 dereferenceable(32) %1)
  %.not = icmp eq i64 %43, 0
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #6
  br i1 %.not, label %44, label %55

44:                                               ; preds = %.lr.ph54
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #6
  call void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %3, ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(16) %42)
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 8 dereferenceable(32) %3)
  %46 = trunc nuw nsw i64 %indvars.iv72 to i32
  store i32 %46, ptr %45, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #6
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %.not37 = icmp slt i64 %indvars.iv.next73, %48
  br i1 %.not37, label %.lr.ph54, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %44, %.lr.ph57
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = trunc nuw i64 %indvars.iv.next78 to i32
  %51 = icmp sgt i32 %49, %50
  br i1 %51, label %.lr.ph57, label %.loopexit.loopexit, !llvm.loop !20

._crit_edge60:                                    ; preds = %.loopexit, %.preheader
  %52 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.backedge

.backedge:                                        ; preds = %._crit_edge60, %55
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %54 = icmp eq i32 %53, 2
  br i1 %54, label %.lr.ph62, label %._crit_edge63, !llvm.loop !21

55:                                               ; preds = %.lr.ph54
  %56 = trunc nuw nsw i64 %indvars.iv80 to i32
  %57 = trunc nuw nsw i64 %indvars.iv77 to i32
  %58 = trunc nuw nsw i64 %indvars.iv72 to i32
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #6
  call void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair.0") align 8 %2, ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(16) %42)
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIS0_IyyES1_EiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @f, ptr noundef nonnull align 8 dereferenceable(32) %2)
  %60 = load i32, ptr %59, align 4, !tbaa !5
  store i32 %60, ptr @r1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  store i32 %58, ptr @r2, align 4, !tbaa !5
  store i32 %56, ptr @c1, align 4, !tbaa !5
  store i32 %57, ptr @c2, align 4, !tbaa !5
  %61 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  %62 = load i32, ptr @r1, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  %64 = load i32, ptr @r2, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %63, i32 noundef %65)
  %67 = load i32, ptr @c1, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  %69 = load i32, ptr @c2, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %68, i32 noundef %70)
  br label %.backedge

._crit_edge63:                                    ; preds = %.backedge, %0
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZSt9make_pairIRSt4pairIyyES2_ES0_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair.0") align 8, ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #1

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

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


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