; LLVM IR from tangjz/acm-icpc :: codeforces/complete (757C)

; 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::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::__detail::_Node_iterator" = type { %"struct.std::__detail::_Node_iterator_base" }
%"struct.std::__detail::_Node_iterator_base" = type { ptr }
%"struct.std::pair.2" = type { %"struct.std::pair", i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@fact = external dso_local global [1000001 x i32], align 16
@tim = external dso_local global [1000001 x i32], align 16
@cnt = external dso_local global [1000001 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [1000001 x i32], align 16
@h1 = external dso_local global [1000001 x i32], align 16
@h2 = external dso_local global [1000001 x i32], align 16
@ans = external dso_local global i32, align 4
@Hash = external dso_local global %"class.std::unordered_map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca ptr, align 8
  %12 = alloca %"struct.std::__detail::_Node_iterator", align 8
  %13 = alloca %"struct.std::__detail::_Node_iterator", align 8
  %14 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  store i32 1, ptr @fact, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %15

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

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

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1000001 x i32], ptr @fact, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = mul nsw i64 %25, %27
  %29 = srem i64 %28, 1000000007
  %30 = trunc i64 %29 to i32
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [1000001 x i32], ptr @fact, i64 0, i64 %32
  store i32 %30, ptr %33, align 4, !tbaa !5
  br label %34

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

37:                                               ; preds = %18
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  br label %39

39:                                               ; preds = %159, %37
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %162

44:                                               ; preds = %39
  store i32 0, ptr @tot, align 4, !tbaa !5
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %79, %44
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %82

51:                                               ; preds = %46
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5)
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1000001 x i32], ptr @tim, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %59, label %72

59:                                               ; preds = %51
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1000001 x i32], ptr @tim, i64 0, i64 %62
  store i32 %60, ptr %63, align 4, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = load i32, ptr @tot, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr @tot, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %67
  store i32 %64, ptr %68, align 4, !tbaa !5
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %70
  store i32 1, ptr %71, align 4, !tbaa !5
  br label %78

72:                                               ; preds = %51
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %75, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %72, %59
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %7, align 4, !tbaa !5
  br label %46, !llvm.loop !11

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

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

87:                                               ; preds = %83
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %158

88:                                               ; preds = %83
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  store i32 %92, ptr %5, align 4, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = mul nsw i64 %97, 5145403
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = add nsw i64 %98, %100
  %102 = srem i64 %101, 1072098169
  %103 = trunc i64 %102 to i32
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %105
  store i32 %103, ptr %106, align 4, !tbaa !5
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = mul nsw i64 %111, 5145403
  %113 = load i32, ptr %5, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = add nsw i64 %112, %117
  %119 = srem i64 %118, 1072098169
  %120 = trunc i64 %119 to i32
  %121 = load i32, ptr %5, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %122
  store i32 %120, ptr %123, align 4, !tbaa !5
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = mul nsw i64 %128, 4558867
  %130 = load i32, ptr %3, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = add nsw i64 %129, %131
  %133 = srem i64 %132, 1123463261
  %134 = trunc i64 %133 to i32
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %136
  store i32 %134, ptr %137, align 4, !tbaa !5
  %138 = load i32, ptr %5, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = mul nsw i64 %142, 4558867
  %144 = load i32, ptr %5, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = add nsw i64 %143, %148
  %150 = srem i64 %149, 1123463261
  %151 = trunc i64 %150 to i32
  %152 = load i32, ptr %5, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %153
  store i32 %151, ptr %154, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %88
  %156 = load i32, ptr %8, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %8, align 4, !tbaa !5
  br label %83, !llvm.loop !12

158:                                              ; preds = %87
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %3, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %3, align 4, !tbaa !5
  br label %39, !llvm.loop !13

162:                                              ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %179, %162
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = load i32, ptr @m, align 4, !tbaa !5
  %166 = icmp sle i32 %164, %165
  br i1 %166, label %168, label %167

167:                                              ; preds = %163
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %182

168:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %170
  %172 = load i32, ptr %9, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %173
  %175 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %171, ptr noundef nonnull align 4 dereferenceable(4) %174)
  store i64 %175, ptr %10, align 4
  %176 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapISt4pairIiiEiSt4hashIS1_ESt8equal_toIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(56) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = add nsw i32 %177, 1
  store i32 %178, ptr %176, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %179

179:                                              ; preds = %168
  %180 = load i32, ptr %9, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %9, align 4, !tbaa !5
  br label %163, !llvm.loop !14

182:                                              ; preds = %167
  store i32 1, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr @Hash, ptr %11, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %183 = call ptr @_ZNSt13unordered_mapISt4pairIiiEiSt4hashIS1_ESt8equal_toIS1_ESaIS0_IKS1_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(56) @Hash) #5
  %184 = getelementptr inbounds %"struct.std::__detail::_Node_iterator", ptr %12, i32 0, i32 0
  %185 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base", ptr %184, i32 0, i32 0
  store ptr %183, ptr %185, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %186 = call ptr @_ZNSt13unordered_mapISt4pairIiiEiSt4hashIS1_ESt8equal_toIS1_ESaIS0_IKS1_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(56) @Hash) #5
  %187 = getelementptr inbounds %"struct.std::__detail::_Node_iterator", ptr %13, i32 0, i32 0
  %188 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base", ptr %187, i32 0, i32 0
  store ptr %186, ptr %188, align 8
  br label %189

189:                                              ; preds = %206, %182
  %190 = call noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKS1_IiiEiELb1EEES7_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  br i1 %190, label %192, label %191

191:                                              ; preds = %189
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %208

192:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %193 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt8__detail14_Node_iteratorISt4pairIKS1_IiiEiELb0ELb1EEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  store ptr %193, ptr %14, align 8, !tbaa !15
  %194 = load i32, ptr @ans, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = load ptr, ptr %14, align 8, !tbaa !15
  %197 = getelementptr inbounds %"struct.std::pair.2", ptr %196, i32 0, i32 1
  %198 = load i32, ptr %197, align 4, !tbaa !17
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [1000001 x i32], ptr @fact, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = mul nsw i64 %195, %202
  %204 = srem i64 %203, 1000000007
  %205 = trunc i64 %204 to i32
  store i32 %205, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %206

206:                                              ; preds = %192
  %207 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8__detail14_Node_iteratorISt4pairIKS1_IiiEiELb0ELb1EEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  br label %189

208:                                              ; preds = %191
  %209 = load i32, ptr @ans, align 4, !tbaa !5
  %210 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %209)
  ret i32 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

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

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

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

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

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

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

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

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

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

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

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

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


; 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::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"struct.std::pair" = type { i32, i32 }
%"struct.std::__detail::_Node_iterator" = type { %"struct.std::__detail::_Node_iterator_base" }
%"struct.std::__detail::_Node_iterator_base" = type { ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@fact = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@tim = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@h1 = external dso_local global [1000001 x i32], align 16
@h2 = external dso_local global [1000001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@Hash = external dso_local global %"class.std::unordered_map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca %"struct.std::__detail::_Node_iterator", align 8
  %5 = alloca %"struct.std::__detail::_Node_iterator", align 8
  store i32 1, ptr @fact, align 16, !tbaa !5
  br label %9

6:                                                ; preds = %9
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not33 = icmp slt i32 %8, 1
  br i1 %.not33, label %._crit_edge37, label %.lr.ph36

9:                                                ; preds = %9, %0
  %10 = phi i64 [ 1, %0 ], [ %16, %9 ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %9 ]
  %11 = mul nsw i64 %10, %indvars.iv
  %12 = srem i64 %11, 1000000007
  %13 = trunc nsw i64 %12 to i32
  %14 = getelementptr inbounds [1000001 x i32], ptr @fact, i64 0, i64 %indvars.iv
  store i32 %13, ptr %14, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = mul nsw i64 %12, %indvars.iv.next
  %16 = srem i64 %15, 1000000007
  %17 = trunc nsw i64 %16 to i32
  %18 = getelementptr inbounds [1000001 x i32], ptr @fact, i64 0, i64 %indvars.iv.next
  store i32 %17, ptr %18, 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, 1000001
  br i1 %exitcond.not.1, label %6, label %9, !llvm.loop !9

._crit_edge37:                                    ; preds = %45, %6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %.not2438 = icmp slt i32 %19, 1
  br i1 %.not2438, label %._crit_edge42, label %.lr.ph41

.lr.ph36:                                         ; preds = %6, %45
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %45 ], [ 1, %6 ]
  store i32 0, ptr @tot, align 4, !tbaa !5
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %.not2528 = icmp slt i32 %21, 1
  br i1 %.not2528, label %.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph36
  %22 = trunc nuw nsw i64 %indvars.iv51 to i32
  br label %.lr.ph

.preheader:                                       ; preds = %42, %.lr.ph36
  %23 = load i32, ptr @tot, align 4, !tbaa !5
  %.not2630 = icmp slt i32 %23, 1
  br i1 %.not2630, label %45, label %.lr.ph32

.lr.ph32:                                         ; preds = %.preheader
  %24 = add nuw i32 %23, 1
  %wide.trip.count = zext i32 %24 to i64
  br label %48

.lr.ph:                                           ; preds = %.lr.ph.preheader, %42
  %.02329 = phi i32 [ %43, %42 ], [ 1, %.lr.ph.preheader ]
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2)
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000001 x i32], ptr @tim, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp sgt i64 %indvars.iv51, %30
  br i1 %31, label %32, label %38

32:                                               ; preds = %.lr.ph
  store i32 %22, ptr %28, align 4, !tbaa !5
  %33 = load i32, ptr @tot, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr @tot, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %35
  store i32 %26, ptr %36, align 4, !tbaa !5
  %37 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %27
  store i32 1, ptr %37, align 4, !tbaa !5
  br label %42

38:                                               ; preds = %.lr.ph
  %39 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %27
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %32, %38
  %43 = add nuw nsw i32 %.02329, 1
  %44 = load i32, ptr %1, align 4, !tbaa !5
  %.not25.not = icmp slt i32 %.02329, %44
  br i1 %.not25.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %48
  store i32 %50, ptr %2, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %._crit_edge, %.preheader
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %.not.not = icmp slt i64 %indvars.iv51, %47
  br i1 %.not.not, label %.lr.ph36, label %._crit_edge37, !llvm.loop !12

48:                                               ; preds = %.lr.ph32, %48
  %indvars.iv47 = phi i64 [ 1, %.lr.ph32 ], [ %indvars.iv.next48, %48 ]
  %49 = getelementptr inbounds [1000001 x i32], ptr @que, i64 0, i64 %indvars.iv47
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 %54, 5145403
  %56 = add nsw i64 %55, %indvars.iv51
  %57 = srem i64 %56, 1072098169
  %58 = mul nsw i64 %57, 5145403
  %59 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %51
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = add nsw i64 %58, %61
  %63 = srem i64 %62, 1072098169
  %64 = trunc nsw i64 %63 to i32
  store i32 %64, ptr %52, align 4, !tbaa !5
  %65 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %51
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = mul nsw i64 %67, 4558867
  %69 = add nsw i64 %68, %indvars.iv51
  %70 = srem i64 %69, 1123463261
  %71 = mul nsw i64 %70, 4558867
  %72 = add nsw i64 %71, %61
  %73 = srem i64 %72, 1123463261
  %74 = trunc nsw i64 %73 to i32
  store i32 %74, ptr %65, align 4, !tbaa !5
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %exitcond50.not = icmp eq i64 %indvars.iv.next48, %wide.trip.count
  br i1 %exitcond50.not, label %._crit_edge, label %48, !llvm.loop !13

._crit_edge42:                                    ; preds = %.lr.ph41, %._crit_edge37
  store i32 1, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %75 = call ptr @_ZNSt13unordered_mapISt4pairIiiEiSt4hashIS1_ESt8equal_toIS1_ESaIS0_IKS1_iEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(56) @Hash) #5
  store ptr %75, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %76 = call ptr @_ZNSt13unordered_mapISt4pairIiiEiSt4hashIS1_ESt8equal_toIS1_ESaIS0_IKS1_iEEE3endEv(ptr noundef nonnull align 8 dereferenceable(56) @Hash) #5
  store ptr %76, ptr %5, align 8
  %77 = call noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKS1_IiiEiELb1EEES7_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br i1 %77, label %.lr.ph44, label %._crit_edge45

.lr.ph41:                                         ; preds = %._crit_edge37, %.lr.ph41
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.lr.ph41 ], [ 1, %._crit_edge37 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %78 = getelementptr inbounds [1000001 x i32], ptr @h1, i64 0, i64 %indvars.iv54
  %79 = getelementptr inbounds [1000001 x i32], ptr @h2, i64 0, i64 %indvars.iv54
  %80 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %78, ptr noundef nonnull align 4 dereferenceable(4) %79)
  store i64 %80, ptr %3, align 8
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapISt4pairIiiEiSt4hashIS1_ESt8equal_toIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(56) @Hash, ptr noundef nonnull align 4 dereferenceable(8) %3)
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %81, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %84 = load i32, ptr @m, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %.not24.not = icmp slt i64 %indvars.iv54, %85
  br i1 %.not24.not, label %.lr.ph41, label %._crit_edge42, !llvm.loop !14

._crit_edge45:                                    ; preds = %.lr.ph44, %._crit_edge42
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %86 = load i32, ptr @ans, align 4, !tbaa !5
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %86)
  ret i32 0

.lr.ph44:                                         ; preds = %._crit_edge42, %.lr.ph44
  %88 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNKSt8__detail14_Node_iteratorISt4pairIKS1_IiiEiELb0ELb1EEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %89 = load i32, ptr @ans, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i8, ptr %88, i64 8
  %92 = load i32, ptr %91, align 4, !tbaa !15
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1000001 x i32], ptr @fact, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = mul nsw i64 %96, %90
  %98 = srem i64 %97, 1000000007
  %99 = trunc nsw i64 %98 to i32
  store i32 %99, ptr @ans, align 4, !tbaa !5
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8__detail14_Node_iteratorISt4pairIKS1_IiiEiELb0ELb1EEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #5
  %101 = call noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKS1_IiiEiELb1EEES7_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  br i1 %101, label %.lr.ph44, label %._crit_edge45
}

; 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8__detail14_Node_iteratorISt4pairIKS1_IiiEiELb0ELb1EEppEv(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 #2

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

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

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


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