; LLVM IR from eyangch/competitive-programming :: CSES/Mathematics (divisor_analysis)

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

%"struct.std::pair" = type { i64, i64 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@pfx = external dso_local global [100001 x i64], align 16
@sfx = external dso_local global [100001 x i64], align 16
@a = external dso_local global [100000 x %"struct.std::pair"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4bpowxx(i64 noundef, i64 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 nounwind uwtable
declare dso_local noundef i64 @_Z4divmxx(i64 noundef, i64 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %20

20:                                               ; preds = %34, %0
  %21 = load i64, ptr %2, align 8, !tbaa !8
  %22 = load i64, ptr @N, align 8, !tbaa !8
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %37

25:                                               ; preds = %20
  %26 = load i64, ptr %2, align 8, !tbaa !8
  %27 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %26
  %28 = getelementptr inbounds %"struct.std::pair", ptr %27, i32 0, i32 0
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %30
  %32 = getelementptr inbounds %"struct.std::pair", ptr %31, i32 0, i32 1
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(8) %32)
  br label %34

34:                                               ; preds = %25
  %35 = load i64, ptr %2, align 8, !tbaa !8
  %36 = add nsw i64 %35, 1
  store i64 %36, ptr %2, align 8, !tbaa !8
  br label %20, !llvm.loop !11

37:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 1, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %51, %37
  %39 = load i64, ptr %4, align 8, !tbaa !8
  %40 = load i64, ptr @N, align 8, !tbaa !8
  %41 = icmp slt i64 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %54

43:                                               ; preds = %38
  %44 = load i64, ptr %3, align 8, !tbaa !8
  %45 = load i64, ptr %4, align 8, !tbaa !8
  %46 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %45
  %47 = getelementptr inbounds %"struct.std::pair", ptr %46, i32 0, i32 1
  %48 = load i64, ptr %47, align 8, !tbaa !13
  %49 = add nsw i64 %48, 1
  %50 = call noundef i64 @_Z3mulxx(i64 noundef %44, i64 noundef %49)
  store i64 %50, ptr %3, align 8, !tbaa !8
  br label %51

51:                                               ; preds = %43
  %52 = load i64, ptr %4, align 8, !tbaa !8
  %53 = add nsw i64 %52, 1
  store i64 %53, ptr %4, align 8, !tbaa !8
  br label %38, !llvm.loop !15

54:                                               ; preds = %42
  %55 = load i64, ptr %3, align 8, !tbaa !8
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %55)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef @.str)
  store i64 1000000006, ptr @MOD, align 8, !tbaa !8
  store i64 1, ptr @pfx, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %58

58:                                               ; preds = %76, %54
  %59 = load i64, ptr %5, align 8, !tbaa !8
  %60 = load i64, ptr @N, align 8, !tbaa !8
  %61 = icmp slt i64 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %79

63:                                               ; preds = %58
  %64 = load i64, ptr %5, align 8, !tbaa !8
  %65 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !8
  %67 = load i64, ptr %5, align 8, !tbaa !8
  %68 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %67
  %69 = getelementptr inbounds %"struct.std::pair", ptr %68, i32 0, i32 1
  %70 = load i64, ptr %69, align 8, !tbaa !13
  %71 = add nsw i64 %70, 1
  %72 = call noundef i64 @_Z3mulxx(i64 noundef %66, i64 noundef %71)
  %73 = load i64, ptr %5, align 8, !tbaa !8
  %74 = add nsw i64 %73, 1
  %75 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %74
  store i64 %72, ptr %75, align 8, !tbaa !8
  br label %76

76:                                               ; preds = %63
  %77 = load i64, ptr %5, align 8, !tbaa !8
  %78 = add nsw i64 %77, 1
  store i64 %78, ptr %5, align 8, !tbaa !8
  br label %58, !llvm.loop !16

79:                                               ; preds = %62
  %80 = load i64, ptr @N, align 8, !tbaa !8
  %81 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %80
  store i64 1, ptr %81, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %82 = load i64, ptr @N, align 8, !tbaa !8
  %83 = sub nsw i64 %82, 1
  store i64 %83, ptr %6, align 8, !tbaa !8
  br label %84

84:                                               ; preds = %101, %79
  %85 = load i64, ptr %6, align 8, !tbaa !8
  %86 = icmp sge i64 %85, 0
  br i1 %86, label %88, label %87

87:                                               ; preds = %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %104

88:                                               ; preds = %84
  %89 = load i64, ptr %6, align 8, !tbaa !8
  %90 = add nsw i64 %89, 1
  %91 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !8
  %93 = load i64, ptr %6, align 8, !tbaa !8
  %94 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %93
  %95 = getelementptr inbounds %"struct.std::pair", ptr %94, i32 0, i32 1
  %96 = load i64, ptr %95, align 8, !tbaa !13
  %97 = add nsw i64 %96, 1
  %98 = call noundef i64 @_Z3mulxx(i64 noundef %92, i64 noundef %97)
  %99 = load i64, ptr %6, align 8, !tbaa !8
  %100 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %99
  store i64 %98, ptr %100, align 8, !tbaa !8
  br label %101

101:                                              ; preds = %88
  %102 = load i64, ptr %6, align 8, !tbaa !8
  %103 = add nsw i64 %102, -1
  store i64 %103, ptr %6, align 8, !tbaa !8
  br label %84, !llvm.loop !17

104:                                              ; preds = %87
  store i64 1000000007, ptr @MOD, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 1, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %105

105:                                              ; preds = %130, %104
  %106 = load i64, ptr %8, align 8, !tbaa !8
  %107 = load i64, ptr @N, align 8, !tbaa !8
  %108 = icmp slt i64 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %133

110:                                              ; preds = %105
  %111 = load i64, ptr %7, align 8, !tbaa !8
  %112 = load i64, ptr %8, align 8, !tbaa !8
  %113 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %112
  %114 = getelementptr inbounds %"struct.std::pair", ptr %113, i32 0, i32 0
  %115 = load i64, ptr %114, align 16, !tbaa !18
  %116 = load i64, ptr %8, align 8, !tbaa !8
  %117 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %116
  %118 = getelementptr inbounds %"struct.std::pair", ptr %117, i32 0, i32 1
  %119 = load i64, ptr %118, align 8, !tbaa !13
  %120 = add nsw i64 %119, 1
  %121 = call noundef i64 @_Z4bpowxx(i64 noundef %115, i64 noundef %120)
  %122 = call noundef i64 @_Z3subxx(i64 noundef %121, i64 noundef 1)
  %123 = load i64, ptr %8, align 8, !tbaa !8
  %124 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %123
  %125 = getelementptr inbounds %"struct.std::pair", ptr %124, i32 0, i32 0
  %126 = load i64, ptr %125, align 16, !tbaa !18
  %127 = call noundef i64 @_Z3subxx(i64 noundef %126, i64 noundef 1)
  %128 = call noundef i64 @_Z4divmxx(i64 noundef %122, i64 noundef %127)
  %129 = call noundef i64 @_Z3mulxx(i64 noundef %111, i64 noundef %128)
  store i64 %129, ptr %7, align 8, !tbaa !8
  br label %130

130:                                              ; preds = %110
  %131 = load i64, ptr %8, align 8, !tbaa !8
  %132 = add nsw i64 %131, 1
  store i64 %132, ptr %8, align 8, !tbaa !8
  br label %105, !llvm.loop !19

133:                                              ; preds = %109
  %134 = load i64, ptr %7, align 8, !tbaa !8
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %135, ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 1, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %137

137:                                              ; preds = %172, %133
  %138 = load i64, ptr %10, align 8, !tbaa !8
  %139 = load i64, ptr @N, align 8, !tbaa !8
  %140 = icmp slt i64 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %175

142:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %143 = load i64, ptr %10, align 8, !tbaa !8
  %144 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %143
  %145 = getelementptr inbounds %"struct.std::pair", ptr %144, i32 0, i32 0
  %146 = load i64, ptr %145, align 16, !tbaa !18
  %147 = load i64, ptr %10, align 8, !tbaa !8
  %148 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %147
  %149 = getelementptr inbounds %"struct.std::pair", ptr %148, i32 0, i32 1
  %150 = load i64, ptr %149, align 8, !tbaa !13
  %151 = load i64, ptr %10, align 8, !tbaa !8
  %152 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %151
  %153 = getelementptr inbounds %"struct.std::pair", ptr %152, i32 0, i32 1
  %154 = load i64, ptr %153, align 8, !tbaa !13
  %155 = add nsw i64 %154, 1
  %156 = mul nsw i64 %150, %155
  %157 = sdiv i64 %156, 2
  %158 = call noundef i64 @_Z4bpowxx(i64 noundef %146, i64 noundef %157)
  store i64 %158, ptr %11, align 8, !tbaa !8
  store i64 1000000006, ptr @MOD, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %159 = load i64, ptr %10, align 8, !tbaa !8
  %160 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %159
  %161 = load i64, ptr %160, align 8, !tbaa !8
  %162 = load i64, ptr %10, align 8, !tbaa !8
  %163 = add nsw i64 %162, 1
  %164 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %163
  %165 = load i64, ptr %164, align 8, !tbaa !8
  %166 = call noundef i64 @_Z3mulxx(i64 noundef %161, i64 noundef %165)
  store i64 %166, ptr %12, align 8, !tbaa !8
  store i64 1000000007, ptr @MOD, align 8, !tbaa !8
  %167 = load i64, ptr %9, align 8, !tbaa !8
  %168 = load i64, ptr %11, align 8, !tbaa !8
  %169 = load i64, ptr %12, align 8, !tbaa !8
  %170 = call noundef i64 @_Z4bpowxx(i64 noundef %168, i64 noundef %169)
  %171 = call noundef i64 @_Z3mulxx(i64 noundef %167, i64 noundef %170)
  store i64 %171, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %172

172:                                              ; preds = %142
  %173 = load i64, ptr %10, align 8, !tbaa !8
  %174 = add nsw i64 %173, 1
  store i64 %174, ptr %10, align 8, !tbaa !8
  br label %137, !llvm.loop !20

175:                                              ; preds = %141
  %176 = load i64, ptr %9, align 8, !tbaa !8
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %176)
  %178 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %177, ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  %179 = load i32, ptr %1, align 4
  ret i32 %179
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

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

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


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

%"struct.std::pair" = type { i64, i64 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@N = external dso_local global i64, align 8
@pfx = external dso_local local_unnamed_addr global [100001 x i64], align 16
@sfx = external dso_local local_unnamed_addr global [100001 x i64], align 16
@a = external dso_local global [100000 x %"struct.std::pair"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %8 = load i64, ptr @N, align 8, !tbaa !8
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %10 = icmp sgt i64 %16, 0
  br i1 %10, label %.lr.ph50, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.047 = phi i64 [ %15, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %.047
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %13 = getelementptr inbounds i8, ptr %11, i64 8
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %15 = add nuw nsw i64 %.047, 1
  %16 = load i64, ptr @N, align 8, !tbaa !8
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph50, %0, %.preheader
  %.038.lcssa = phi i64 [ 1, %.preheader ], [ 1, %0 ], [ %26, %.lr.ph50 ]
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.038.lcssa)
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull @.str)
  store i64 1000000006, ptr @MOD, align 8, !tbaa !8
  store i64 1, ptr @pfx, align 16, !tbaa !8
  %20 = load i64, ptr @N, align 8, !tbaa !8
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph53, label %._crit_edge54.thread

._crit_edge54.thread:                             ; preds = %._crit_edge
  %22 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %20
  store i64 1, ptr %22, align 8, !tbaa !8
  br label %._crit_edge59.thread

.lr.ph50:                                         ; preds = %.preheader, %.lr.ph50
  %.03849 = phi i64 [ %26, %.lr.ph50 ], [ 1, %.preheader ]
  %.04548 = phi i64 [ %27, %.lr.ph50 ], [ 0, %.preheader ]
  %23 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %.04548, i32 1
  %24 = load i64, ptr %23, align 8, !tbaa !13
  %25 = add nsw i64 %24, 1
  %26 = tail call noundef i64 @_Z3mulxx(i64 noundef %.03849, i64 noundef %25)
  %27 = add nuw nsw i64 %.04548, 1
  %28 = load i64, ptr @N, align 8, !tbaa !8
  %29 = icmp slt i64 %27, %28
  br i1 %29, label %.lr.ph50, label %._crit_edge, !llvm.loop !15

._crit_edge54:                                    ; preds = %.lr.ph53
  %30 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %39
  store i64 1, ptr %30, align 8, !tbaa !8
  %31 = icmp sgt i64 %39, 0
  br i1 %31, label %.lr.ph58, label %._crit_edge59.thread

.lr.ph53:                                         ; preds = %._crit_edge, %.lr.ph53
  %32 = phi i64 [ %36, %.lr.ph53 ], [ 1, %._crit_edge ]
  %.04451 = phi i64 [ %37, %.lr.ph53 ], [ 0, %._crit_edge ]
  %33 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %.04451, i32 1
  %34 = load i64, ptr %33, align 8, !tbaa !13
  %35 = add nsw i64 %34, 1
  %36 = tail call noundef i64 @_Z3mulxx(i64 noundef %32, i64 noundef %35)
  %37 = add nuw nsw i64 %.04451, 1
  %38 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %37
  store i64 %36, ptr %38, align 8, !tbaa !8
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = icmp slt i64 %37, %39
  br i1 %40, label %.lr.ph53, label %._crit_edge54, !llvm.loop !16

._crit_edge59.thread:                             ; preds = %._crit_edge54, %._crit_edge54.thread
  store i64 1000000007, ptr @MOD, align 8, !tbaa !8
  br label %._crit_edge64

._crit_edge59:                                    ; preds = %.lr.ph58
  %.pre = load i64, ptr @N, align 8, !tbaa !8
  %41 = icmp sgt i64 %.pre, 0
  store i64 1000000007, ptr @MOD, align 8, !tbaa !8
  br i1 %41, label %.lr.ph63, label %._crit_edge64

.lr.ph58:                                         ; preds = %._crit_edge54, %.lr.ph58
  %42 = phi i64 [ %46, %.lr.ph58 ], [ 1, %._crit_edge54 ]
  %.043.in56 = phi i64 [ %.043, %.lr.ph58 ], [ %39, %._crit_edge54 ]
  %.043 = add nsw i64 %.043.in56, -1
  %43 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %.043, i32 1
  %44 = load i64, ptr %43, align 8, !tbaa !13
  %45 = add nsw i64 %44, 1
  %46 = tail call noundef i64 @_Z3mulxx(i64 noundef %42, i64 noundef %45)
  %47 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %.043
  store i64 %46, ptr %47, align 8, !tbaa !8
  %48 = icmp ugt i64 %.043.in56, 1
  br i1 %48, label %.lr.ph58, label %._crit_edge59, !llvm.loop !17

._crit_edge64:                                    ; preds = %.lr.ph63, %._crit_edge59.thread, %._crit_edge59
  %.042.lcssa = phi i64 [ 1, %._crit_edge59 ], [ 1, %._crit_edge59.thread ], [ %63, %.lr.ph63 ]
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.042.lcssa)
  %50 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %49, ptr noundef nonnull @.str)
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = icmp sgt i64 %51, 0
  br i1 %52, label %.lr.ph69, label %._crit_edge70

.lr.ph63:                                         ; preds = %._crit_edge59, %.lr.ph63
  %.04161 = phi i64 [ %64, %.lr.ph63 ], [ 0, %._crit_edge59 ]
  %.04260 = phi i64 [ %63, %.lr.ph63 ], [ 1, %._crit_edge59 ]
  %53 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %.04161
  %54 = load i64, ptr %53, align 16, !tbaa !18
  %55 = getelementptr inbounds i8, ptr %53, i64 8
  %56 = load i64, ptr %55, align 8, !tbaa !13
  %57 = add nsw i64 %56, 1
  %58 = tail call noundef i64 @_Z4bpowxx(i64 noundef %54, i64 noundef %57)
  %59 = tail call noundef i64 @_Z3subxx(i64 noundef %58, i64 noundef 1)
  %60 = load i64, ptr %53, align 16, !tbaa !18
  %61 = tail call noundef i64 @_Z3subxx(i64 noundef %60, i64 noundef 1)
  %62 = tail call noundef i64 @_Z4divmxx(i64 noundef %59, i64 noundef %61)
  %63 = tail call noundef i64 @_Z3mulxx(i64 noundef %.04260, i64 noundef %62)
  %64 = add nuw nsw i64 %.04161, 1
  %65 = load i64, ptr @N, align 8, !tbaa !8
  %66 = icmp slt i64 %64, %65
  br i1 %66, label %.lr.ph63, label %._crit_edge64, !llvm.loop !19

._crit_edge70:                                    ; preds = %.lr.ph69, %._crit_edge64
  %.040.lcssa = phi i64 [ 1, %._crit_edge64 ], [ %84, %.lr.ph69 ]
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.040.lcssa)
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef nonnull @.str.1)
  ret i32 0

.lr.ph69:                                         ; preds = %._crit_edge64, %.lr.ph69
  %.03967 = phi i64 [ %79, %.lr.ph69 ], [ 0, %._crit_edge64 ]
  %.04066 = phi i64 [ %84, %.lr.ph69 ], [ 1, %._crit_edge64 ]
  %69 = getelementptr inbounds [100000 x %"struct.std::pair"], ptr @a, i64 0, i64 %.03967
  %70 = load i64, ptr %69, align 16, !tbaa !18
  %71 = getelementptr inbounds i8, ptr %69, i64 8
  %72 = load i64, ptr %71, align 8, !tbaa !13
  %73 = add nsw i64 %72, 1
  %74 = mul nsw i64 %73, %72
  %75 = sdiv i64 %74, 2
  %76 = tail call noundef i64 @_Z4bpowxx(i64 noundef %70, i64 noundef %75)
  store i64 1000000006, ptr @MOD, align 8, !tbaa !8
  %77 = getelementptr inbounds [100001 x i64], ptr @pfx, i64 0, i64 %.03967
  %78 = load i64, ptr %77, align 8, !tbaa !8
  %79 = add nuw nsw i64 %.03967, 1
  %80 = getelementptr inbounds [100001 x i64], ptr @sfx, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = tail call noundef i64 @_Z3mulxx(i64 noundef %78, i64 noundef %81)
  store i64 1000000007, ptr @MOD, align 8, !tbaa !8
  %83 = tail call noundef i64 @_Z4bpowxx(i64 noundef %76, i64 noundef %82)
  %84 = tail call noundef i64 @_Z3mulxx(i64 noundef %.04066, i64 noundef %83)
  %85 = load i64, ptr @N, align 8, !tbaa !8
  %86 = icmp slt i64 %79, %85
  br i1 %86, label %.lr.ph69, label %._crit_edge70, !llvm.loop !20
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #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 = { 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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !9, i64 8}
!14 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{!14, !9, i64 0}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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