; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/104 Division 1/Problem C (C)

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

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@m = external dso_local global %"class.std::map", align 8
@f = external dso_local global [100100 x i64], align 16
@MOD = external dso_local global i64, align 8
@dp = external dso_local global [100100 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

15:                                               ; preds = %58, %0
  %16 = load i32, ptr %3, 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 %3) #5
  br label %61

20:                                               ; preds = %15
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %22
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %23)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  store i32 %28, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %43, %20
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %44

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = srem i32 %33, 10
  store i32 %34, ptr %6, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sdiv i32 %35, 10
  store i32 %36, ptr %4, align 4, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 4
  br i1 %38, label %39, label %43

39:                                               ; preds = %32
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = icmp ne i32 %40, 7
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %42, %39, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %29, !llvm.loop !9

44:                                               ; preds = %29
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %54

47:                                               ; preds = %44
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %49
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %50)
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %51, align 4, !tbaa !5
  br label %57

54:                                               ; preds = %44
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !5
  br label %57

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

58:                                               ; preds = %57
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %3, align 4, !tbaa !5
  br label %15, !llvm.loop !11

61:                                               ; preds = %19
  store i64 1, ptr @f, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %80, %61
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = icmp slt i32 %63, 100100
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %62
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sub nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100100 x i64], ptr @f, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !12
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = mul nsw i64 %71, %73
  %75 = load i64, ptr @MOD, align 8, !tbaa !12
  %76 = srem i64 %74, %75
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100100 x i64], ptr @f, i64 0, i64 %78
  store i64 %76, ptr %79, align 8, !tbaa !12
  br label %80

80:                                               ; preds = %66
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %7, align 4, !tbaa !5
  br label %62, !llvm.loop !14

83:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %96, %83
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = load i32, ptr @k, align 4, !tbaa !5
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %99

89:                                               ; preds = %84
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = call noundef i64 @_Z1Cii(i32 noundef %90, i32 noundef %91)
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %94
  store i64 %92, ptr %95, align 8, !tbaa !12
  br label %96

96:                                               ; preds = %89
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %8, align 4, !tbaa !5
  br label %84, !llvm.loop !15

99:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %100 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @m) #5
  %101 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %9, i32 0, i32 0
  store ptr %100, ptr %101, align 8
  br label %102

102:                                              ; preds = %149, %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %103 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @m) #5
  %104 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  store ptr %103, ptr %104, align 8
  %105 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 13, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %152

107:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %108 = load i32, ptr @k, align 4, !tbaa !5
  store i32 %108, ptr %12, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %145, %107
  %110 = load i32, ptr %12, align 4, !tbaa !5
  %111 = icmp sge i32 %110, 1
  br i1 %111, label %113, label %112

112:                                              ; preds = %109
  store i32 16, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %148

113:                                              ; preds = %109
  %114 = load i32, ptr %12, align 4, !tbaa !5
  %115 = sub nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !12
  %119 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  %120 = getelementptr inbounds %"struct.std::pair", ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 4, !tbaa !16
  %122 = sext i32 %121 to i64
  %123 = mul nsw i64 %118, %122
  %124 = load i64, ptr @MOD, align 8, !tbaa !12
  %125 = srem i64 %123, %124
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %127
  %129 = load i64, ptr %128, align 8, !tbaa !12
  %130 = add nsw i64 %129, %125
  store i64 %130, ptr %128, align 8, !tbaa !12
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %132
  %134 = load i64, ptr %133, align 8, !tbaa !12
  %135 = load i64, ptr @MOD, align 8, !tbaa !12
  %136 = icmp sge i64 %134, %135
  br i1 %136, label %137, label %144

137:                                              ; preds = %113
  %138 = load i64, ptr @MOD, align 8, !tbaa !12
  %139 = load i32, ptr %12, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !12
  %143 = sub nsw i64 %142, %138
  store i64 %143, ptr %141, align 8, !tbaa !12
  br label %144

144:                                              ; preds = %137, %113
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = add nsw i32 %146, -1
  store i32 %147, ptr %12, align 4, !tbaa !5
  br label %109, !llvm.loop !18

148:                                              ; preds = %112
  br label %149

149:                                              ; preds = %148
  %150 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %9, i32 noundef 0) #5
  %151 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  store ptr %150, ptr %151, align 8
  br label %102, !llvm.loop !19

152:                                              ; preds = %106
  %153 = load i32, ptr @k, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %154
  %156 = load i64, ptr %155, align 8, !tbaa !12
  %157 = trunc i64 %156 to i32
  %158 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %157)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %159 = load i32, ptr %1, align 4
  ret i32 %159
}

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

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

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

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

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!17, !6, i64 4}
!17 = !{!"_ZTSSt4pairIKiiE", !6, i64 0, !6, i64 4}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@m = external dso_local global %"class.std::map", align 8
@f = external dso_local local_unnamed_addr global [100100 x i64], align 16
@MOD = external dso_local local_unnamed_addr global i64, align 8
@dp = external dso_local local_unnamed_addr global [100100 x i64], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

._crit_edge49:                                    ; preds = %19, %0
  %.032.lcssa = phi i32 [ 0, %0 ], [ %.1, %19 ]
  store i64 1, ptr @f, align 16, !tbaa !9
  %6 = load i64, ptr @MOD, align 8, !tbaa !9
  br label %24

.lr.ph48:                                         ; preds = %0, %19
  %indvars.iv = phi i64 [ %indvars.iv.next, %19 ], [ 0, %0 ]
  %.03246 = phi i32 [ %.1, %19 ], [ 0, %0 ]
  %7 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %7)
  %9 = load i32, ptr %7, align 4, !tbaa !5
  %.not4042 = icmp eq i32 %9, 0
  br i1 %.not4042, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph48, %13
  %.03344 = phi i32 [ %.134, %13 ], [ 1, %.lr.ph48 ]
  %.03543 = phi i32 [ %11, %13 ], [ %9, %.lr.ph48 ]
  %10 = srem i32 %.03543, 10
  %11 = sdiv i32 %.03543, 10
  switch i32 %10, label %12 [
    i32 7, label %13
    i32 4, label %13
  ]

12:                                               ; preds = %.lr.ph
  br label %13

13:                                               ; preds = %.lr.ph, %.lr.ph, %12
  %.134 = phi i32 [ 0, %12 ], [ %.03344, %.lr.ph ], [ %.03344, %.lr.ph ]
  %.03543.off = add i32 %.03543, 9
  %.not40 = icmp ult i32 %.03543.off, 19
  br i1 %.not40, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %13
  %.not41 = icmp eq i32 %.134, 0
  br i1 %.not41, label %17, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph48, %._crit_edge
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @m, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr %14, align 4, !tbaa !5
  br label %19

17:                                               ; preds = %._crit_edge
  %18 = add nsw i32 %.03246, 1
  br label %19

19:                                               ; preds = %17, %._crit_edge.thread
  %.1 = phi i32 [ %.03246, %._crit_edge.thread ], [ %18, %17 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph48, label %._crit_edge49, !llvm.loop !13

.preheader:                                       ; preds = %24
  %23 = load i32, ptr @k, align 4, !tbaa !5
  %.not52 = icmp slt i32 %23, 0
  br i1 %.not52, label %._crit_edge55, label %.lr.ph54

24:                                               ; preds = %29, %._crit_edge49
  %25 = phi i64 [ 1, %._crit_edge49 ], [ %31, %29 ]
  %indvars.iv64 = phi i64 [ 1, %._crit_edge49 ], [ %indvars.iv.next65.1, %29 ]
  %26 = mul nsw i64 %25, %indvars.iv64
  %27 = srem i64 %26, %6
  %28 = getelementptr inbounds [100100 x i64], ptr @f, i64 0, i64 %indvars.iv64
  store i64 %27, ptr %28, align 8, !tbaa !9
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next65, 100100
  br i1 %exitcond.not, label %.preheader, label %29, !llvm.loop !14

29:                                               ; preds = %24
  %30 = mul nsw i64 %27, %indvars.iv.next65
  %31 = srem i64 %30, %6
  %32 = getelementptr inbounds [100100 x i64], ptr @f, i64 0, i64 %indvars.iv.next65
  store i64 %31, ptr %32, align 8, !tbaa !9
  %indvars.iv.next65.1 = add nuw nsw i64 %indvars.iv64, 2
  br label %24

._crit_edge55:                                    ; preds = %.lr.ph54, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %33 = tail call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @m) #5
  store ptr %33, ptr %1, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %34 = tail call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @m) #5
  store ptr %34, ptr %2, align 8
  %35 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br i1 %35, label %.lr.ph61, label %._crit_edge62

.lr.ph54:                                         ; preds = %.preheader, %.lr.ph54
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph54 ], [ 0, %.preheader ]
  %36 = trunc nuw nsw i64 %indvars.iv67 to i32
  %37 = tail call noundef i64 @_Z1Cii(i32 noundef %.032.lcssa, i32 noundef %36)
  %38 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %indvars.iv67
  store i64 %37, ptr %38, align 8, !tbaa !9
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %39 = load i32, ptr @k, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %.not.not = icmp slt i64 %indvars.iv67, %40
  br i1 %.not.not, label %.lr.ph54, label %._crit_edge55, !llvm.loop !15

._crit_edge62:                                    ; preds = %._crit_edge59, %._crit_edge55
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  %41 = load i32, ptr @k, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = trunc i64 %44 to i32
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %45)
  ret i32 0

.lr.ph61:                                         ; preds = %._crit_edge55, %._crit_edge59
  %47 = load i32, ptr @k, align 4, !tbaa !5
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph58.preheader, label %._crit_edge59

.lr.ph58.preheader:                               ; preds = %.lr.ph61
  %49 = zext nneg i32 %47 to i64
  br label %.lr.ph58

._crit_edge59:                                    ; preds = %.lr.ph58, %.lr.ph61
  %50 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKiiEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %51 = call ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @m) #5
  store ptr %51, ptr %2, align 8
  %52 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiiEES5_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br i1 %52, label %.lr.ph61, label %._crit_edge62, !llvm.loop !16

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %.lr.ph58
  %indvars.iv70 = phi i64 [ %49, %.lr.ph58.preheader ], [ %indvars.iv.next71, %.lr.ph58 ]
  %indvars.iv.next71 = add nsw i64 %indvars.iv70, -1
  %53 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %indvars.iv.next71
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiiEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %1) #5
  %56 = getelementptr inbounds i8, ptr %55, i64 4
  %57 = load i32, ptr %56, align 4, !tbaa !17
  %58 = sext i32 %57 to i64
  %59 = mul nsw i64 %54, %58
  %60 = load i64, ptr @MOD, align 8, !tbaa !9
  %61 = srem i64 %59, %60
  %62 = getelementptr inbounds [100100 x i64], ptr @dp, i64 0, i64 %indvars.iv70
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = add nsw i64 %63, %61
  %.not39 = icmp slt i64 %64, %60
  %65 = select i1 %.not39, i64 0, i64 %60
  %spec.select = sub nsw i64 %64, %65
  store i64 %spec.select, ptr %62, align 8, !tbaa !9
  %66 = icmp ugt i64 %indvars.iv70, 1
  br i1 %66, label %.lr.ph58, label %._crit_edge59, !llvm.loop !19
}

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

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

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

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

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

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

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

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

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


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