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

; 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<int128_t::BigInt, std::pair<const int128_t::BigInt, int>, std::_Select1st<std::pair<const int128_t::BigInt, int>>, std::less<int128_t::BigInt>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int128_t::BigInt, std::pair<const int128_t::BigInt, int>, std::_Select1st<std::pair<const int128_t::BigInt, int>>, std::less<int128_t::BigInt>>::_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.int128_t::BigInt" = type { i64, i64 }
%"struct.std::greater" = type { i8 }

@_ZN6fastIO7IOerrorE = external dso_local global i8, align 1
@tot = external dso_local global i32, align 4
@inv = external dso_local global [1290241 x i32], align 16
@sz = external dso_local global i32, align 4
@p = external dso_local global [19 x i32], align 16
@e = external dso_local global [19 x i32], align 16
@f = external dso_local global [172513 x i32], align 16
@Hash = external dso_local global %"class.std::map", align 8
@_ZL2pr = external hidden constant [19 x i32], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"struct.int128_t::BigInt", align 8
  %4 = alloca %"struct.int128_t::BigInt", align 8
  %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::greater", align 1
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"struct.int128_t::BigInt", align 8
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([1290241 x i32], ptr @inv, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %14

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

17:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %38

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

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

38:                                               ; preds = %17
  %39 = load i32, ptr @tot, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #7
  call void @_ZN8int128_t6BigIntC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef 1)
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIN8int128_t6BigIntEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 8 dereferenceable(16) %3)
  store i32 %39, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #7
  call void @_ZN8int128_t6BigIntC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %140, %38
  call void @_ZN6fastIO4readIN8int128_t6BigIntEEEvRT_(ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @sz)
  %43 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !11, !range !13, !noundef !14
  %44 = trunc i8 %43 to i1
  %45 = xor i1 %44, true
  br i1 %45, label %47, label %46

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

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

48:                                               ; preds = %57, %47
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = load i32, ptr @sz, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

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

53:                                               ; preds = %48
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [19 x i32], ptr @p, i64 0, i64 %55
  call void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %56)
  br label %57

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

60:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %94, %60
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = load i32, ptr @sz, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %97

66:                                               ; preds = %61
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %68
  store i32 0, ptr %69, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %77, %66
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [19 x i32], ptr @p, i64 0, i64 %72
  %74 = call noundef i32 @_ZNK8int128_t6BigIntrmERKi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %73)
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %70
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %80, align 4, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [19 x i32], ptr @p, i64 0, i64 %84
  call void @_ZN8int128_t6BigIntdVERKi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %85)
  br label %70, !llvm.loop !16

86:                                               ; preds = %70
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = mul nsw i32 %92, %91
  store i32 %93, ptr %8, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %86
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %9, align 4, !tbaa !5
  br label %61, !llvm.loop !17

97:                                               ; preds = %65
  %98 = load i32, ptr @sz, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %99
  store i32 0, ptr %100, align 4, !tbaa !5
  %101 = load i32, ptr @sz, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr @e, i64 %102
  call void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef @e, ptr noundef %103)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %126, %97
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = load i32, ptr @sz, align 4, !tbaa !5
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %129

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

110:                                              ; preds = %122, %109
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = icmp slt i32 %111, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %110
  store i32 20, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %125

118:                                              ; preds = %110
  %119 = load i32, ptr %11, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [19 x i32], ptr @_ZL2pr, i64 0, i64 %120
  call void @_ZN8int128_t6BigIntmLERKi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) %121)
  br label %122

122:                                              ; preds = %118
  %123 = load i32, ptr %12, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %12, align 4, !tbaa !5
  br label %110, !llvm.loop !18

125:                                              ; preds = %117
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %11, align 4, !tbaa !5
  br label %104, !llvm.loop !19

129:                                              ; preds = %108
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %4, i64 16, i1 false), !tbaa.struct !20
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %132 = load i64, ptr %131, align 8
  %133 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %134 = load i64, ptr %133, align 8
  %135 = call noundef i32 @_Z3dfsN8int128_t6BigIntEi(i64 %132, i64 %134, i32 noundef %130)
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [172513 x i32], ptr @f, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %138)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %140

140:                                              ; preds = %129
  %141 = load i32, ptr %5, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %5, align 4, !tbaa !5
  br label %42, !llvm.loop !23

143:                                              ; preds = %46
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #7
  %144 = load i32, ptr %1, align 4
  ret i32 %144
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO4readIN8int128_t6BigIntEEEvRT_(ptr noundef nonnull align 8 dereferenceable(16)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8int128_t6BigIntrmERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntdVERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntmLERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{i64 0, i64 8, !21, i64 8, i64 8, !21}
!21 = !{!22, !22, i64 0}
!22 = !{!"long long", !7, i64 0}
!23 = distinct !{!23, !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<int128_t::BigInt, std::pair<const int128_t::BigInt, int>, std::_Select1st<std::pair<const int128_t::BigInt, int>>, std::less<int128_t::BigInt>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int128_t::BigInt, std::pair<const int128_t::BigInt, int>, std::_Select1st<std::pair<const int128_t::BigInt, int>>, std::less<int128_t::BigInt>>::_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.int128_t::BigInt" = type { i64, i64 }

@_ZN6fastIO7IOerrorE = external dso_local local_unnamed_addr global i8, align 1
@tot = external dso_local local_unnamed_addr global i32, align 4
@inv = external dso_local local_unnamed_addr global [1290241 x i32], align 16
@sz = external dso_local global i32, align 4
@p = external dso_local global [19 x i32], align 16
@e = external dso_local global [19 x i32], align 16
@f = external dso_local local_unnamed_addr global [172513 x i32], align 16
@Hash = external dso_local global %"class.std::map", align 8
@_ZL2pr = external hidden constant [19 x i32], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %"struct.int128_t::BigInt", align 8
  %2 = alloca %"struct.int128_t::BigInt", align 8
  store i32 1, ptr getelementptr inbounds (i8, ptr @inv, i64 4), align 4, !tbaa !5
  br label %9

3:                                                ; preds = %9
  %4 = load i32, ptr @tot, align 4, !tbaa !5
  %5 = add nsw i32 %4, 1
  store i32 %5, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  call void @_ZN8int128_t6BigIntC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 1)
  %6 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIN8int128_t6BigIntEiSt4lessIS1_ESaISt4pairIKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 8 dereferenceable(16) %1)
  store i32 %4, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @_ZN8int128_t6BigIntC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN6fastIO4readIN8int128_t6BigIntEEEvRT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @sz)
  %7 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !9, !range !11, !noundef !12
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %._crit_edge47, label %.preheader33.lr.ph

.preheader33.lr.ph:                               ; preds = %3
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  br label %.preheader33

9:                                                ; preds = %0, %9
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next, %9 ]
  %10 = trunc nuw nsw i64 %indvars.iv to i32
  %11 = udiv i32 1000000007, %10
  %12 = zext nneg i32 %11 to i64
  %13 = urem i32 1000000007, %10
  %14 = zext nneg i32 %13 to i64
  %15 = getelementptr inbounds [1290241 x i32], ptr @inv, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = mul nsw i64 %17, %12
  %19 = srem i64 %18, 1000000007
  %20 = trunc nsw i64 %19 to i32
  %21 = sub nsw i32 1000000007, %20
  %22 = getelementptr inbounds [1290241 x i32], ptr @inv, i64 0, i64 %indvars.iv
  store i32 %21, ptr %22, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 1290241
  br i1 %exitcond.not, label %3, label %9, !llvm.loop !13

.preheader33:                                     ; preds = %.preheader33.lr.ph, %._crit_edge46
  %23 = load i32, ptr @sz, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %.preheader32.._crit_edge40_crit_edge

._crit_edge47:                                    ; preds = %._crit_edge46, %3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  ret i32 0

.preheader32:                                     ; preds = %.lr.ph
  %25 = icmp sgt i32 %28, 0
  br i1 %25, label %.lr.ph39, label %.preheader32.._crit_edge40_crit_edge

.preheader32.._crit_edge40_crit_edge:             ; preds = %.preheader33, %.preheader32
  %26 = phi i32 [ %28, %.preheader32 ], [ %23, %.preheader33 ]
  %.pre60 = sext i32 %26 to i64
  br label %._crit_edge40

.lr.ph:                                           ; preds = %.preheader33, %.lr.ph
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %.lr.ph ], [ 0, %.preheader33 ]
  %27 = getelementptr inbounds [19 x i32], ptr @p, i64 0, i64 %indvars.iv51
  call void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) %27)
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %28 = load i32, ptr @sz, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next52, %29
  br i1 %30, label %.lr.ph, label %.preheader32, !llvm.loop !15

._crit_edge40:                                    ; preds = %._crit_edge, %.preheader32.._crit_edge40_crit_edge
  %.pre-phi = phi i64 [ %.pre60, %.preheader32.._crit_edge40_crit_edge ], [ %46, %._crit_edge ]
  %.028.lcssa = phi i32 [ 1, %.preheader32.._crit_edge40_crit_edge ], [ %44, %._crit_edge ]
  %31 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %.pre-phi
  store i32 0, ptr %31, align 4, !tbaa !5
  call void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef nonnull @e, ptr noundef nonnull %31)
  %32 = load i32, ptr @sz, align 4, !tbaa !5
  %33 = icmp sgt i32 %32, 0
  br i1 %33, label %.preheader, label %._crit_edge46

.lr.ph39:                                         ; preds = %.preheader32, %._crit_edge
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %._crit_edge ], [ 0, %.preheader32 ]
  %.02837 = phi i32 [ %44, %._crit_edge ], [ 1, %.preheader32 ]
  %34 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %indvars.iv54
  store i32 0, ptr %34, align 4, !tbaa !5
  %35 = getelementptr inbounds [19 x i32], ptr @p, i64 0, i64 %indvars.iv54
  %36 = call noundef i32 @_ZNK8int128_t6BigIntrmERKi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %.lr.ph36, label %._crit_edge

.lr.ph36:                                         ; preds = %.lr.ph39, %.lr.ph36
  %38 = load i32, ptr %34, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %34, align 4, !tbaa !5
  call void @_ZN8int128_t6BigIntdVERKi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %40 = call noundef i32 @_ZNK8int128_t6BigIntrmERKi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %41 = icmp eq i32 %40, 0
  br i1 %41, label %.lr.ph36, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph36, %.lr.ph39
  %42 = load i32, ptr %34, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  %44 = mul nsw i32 %43, %.02837
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %45 = load i32, ptr @sz, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next55, %46
  br i1 %47, label %.lr.ph39, label %._crit_edge40, !llvm.loop !17

.preheader:                                       ; preds = %._crit_edge40, %._crit_edge44
  %48 = phi i32 [ %60, %._crit_edge44 ], [ %32, %._crit_edge40 ]
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge44 ], [ 0, %._crit_edge40 ]
  %49 = getelementptr inbounds [19 x i32], ptr @e, i64 0, i64 %indvars.iv57
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.lr.ph43, label %._crit_edge44

.lr.ph43:                                         ; preds = %.preheader
  %52 = getelementptr inbounds [19 x i32], ptr @_ZL2pr, i64 0, i64 %indvars.iv57
  br label %63

._crit_edge46:                                    ; preds = %._crit_edge44, %._crit_edge40
  %.sroa.0.0.copyload = load i64, ptr %2, align 8, !tbaa !18
  %.sroa.2.0.copyload = load i64, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !18
  %53 = call noundef i32 @_Z3dfsN8int128_t6BigIntEi(i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload, i32 noundef %.028.lcssa)
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [172513 x i32], ptr @f, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %56)
  call void @_ZN6fastIO4readIN8int128_t6BigIntEEEvRT_(ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @sz)
  %58 = load i8, ptr @_ZN6fastIO7IOerrorE, align 1, !tbaa !9, !range !11, !noundef !12
  %59 = trunc nuw i8 %58 to i1
  br i1 %59, label %._crit_edge47, label %.preheader33, !llvm.loop !20

._crit_edge44.loopexit:                           ; preds = %63
  %.pre = load i32, ptr @sz, align 4, !tbaa !5
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge44.loopexit, %.preheader
  %60 = phi i32 [ %.pre, %._crit_edge44.loopexit ], [ %48, %.preheader ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next58, %61
  br i1 %62, label %.preheader, label %._crit_edge46, !llvm.loop !21

63:                                               ; preds = %.lr.ph43, %63
  %.02542 = phi i32 [ 0, %.lr.ph43 ], [ %64, %63 ]
  call void @_ZN8int128_t6BigIntmLERKi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %52)
  %64 = add nuw nsw i32 %.02542, 1
  %65 = load i32, ptr %49, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %63, label %._crit_edge44.loopexit, !llvm.loop !22
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO4readIN8int128_t6BigIntEEEvRT_(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6fastIO4readIiEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8int128_t6BigIntrmERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntdVERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8int128_t6BigIntmLERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

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

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


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