; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/330 Division 2/Problem B (B)

; 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::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" }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@MOD = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@a = external dso_local global [100100 x i64], align 16
@b = external dso_local global [100100 x i64], align 16
@p = external dso_local global [10 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

27:                                               ; preds = %41, %0
  %28 = load i32, ptr %3, align 4, !tbaa !8
  %29 = icmp sle i32 %28, 9
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %44

31:                                               ; preds = %27
  %32 = load i32, ptr %3, align 4, !tbaa !8
  %33 = sub nsw i32 %32, 1
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = mul nsw i64 %36, 10
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %39
  store i64 %37, ptr %40, align 8, !tbaa !11
  br label %41

41:                                               ; preds = %31
  %42 = load i32, ptr %3, align 4, !tbaa !8
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !8
  br label %27, !llvm.loop !13

44:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %45

45:                                               ; preds = %56, %44
  %46 = load i32, ptr %4, align 4, !tbaa !8
  %47 = sext i32 %46 to i64
  %48 = load i64, ptr %2, align 8, !tbaa !11
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %59

51:                                               ; preds = %45
  %52 = load i32, ptr %4, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %53
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %54)
  br label %56

56:                                               ; preds = %51
  %57 = load i32, ptr %4, align 4, !tbaa !8
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %4, align 4, !tbaa !8
  br label %45, !llvm.loop !15

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

60:                                               ; preds = %71, %59
  %61 = load i32, ptr %5, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = load i64, ptr %2, align 8, !tbaa !11
  %64 = icmp slt i64 %62, %63
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %60
  %67 = load i32, ptr %5, align 4, !tbaa !8
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %68
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %69)
  br label %71

71:                                               ; preds = %66
  %72 = load i32, ptr %5, align 4, !tbaa !8
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %5, align 4, !tbaa !8
  br label %60, !llvm.loop !16

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

75:                                               ; preds = %196, %74
  %76 = load i32, ptr %6, align 4, !tbaa !8
  %77 = sext i32 %76 to i64
  %78 = load i64, ptr %2, align 8, !tbaa !11
  %79 = icmp slt i64 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %199

81:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %82 = load i32, ptr @k, align 4, !tbaa !8
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = sub nsw i64 %85, 1
  %87 = load i32, ptr %6, align 4, !tbaa !8
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !11
  %91 = sdiv i64 %86, %90
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %93 = load i32, ptr %6, align 4, !tbaa !8
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !11
  %97 = load i32, ptr @k, align 4, !tbaa !8
  %98 = sub nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !11
  %102 = mul nsw i64 %96, %101
  %103 = load i32, ptr %6, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !11
  %107 = srem i64 %102, %106
  store i64 %107, ptr %8, align 8, !tbaa !11
  %108 = load i32, ptr %6, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !11
  %112 = load i64, ptr %8, align 8, !tbaa !11
  %113 = sub nsw i64 %111, %112
  %114 = load i32, ptr %6, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = srem i64 %113, %117
  store i64 %118, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !11
  %119 = load i64, ptr %8, align 8, !tbaa !11
  %120 = icmp eq i64 %119, 0
  br i1 %120, label %121, label %134

121:                                              ; preds = %81
  %122 = load i32, ptr @k, align 4, !tbaa !8
  %123 = sub nsw i32 %122, 1
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !11
  %127 = sub nsw i64 %126, 1
  %128 = load i32, ptr %6, align 4, !tbaa !8
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %129
  %131 = load i64, ptr %130, align 8, !tbaa !11
  %132 = sdiv i64 %127, %131
  %133 = add nsw i64 %132, 1
  store i64 %133, ptr %9, align 8, !tbaa !11
  br label %188

134:                                              ; preds = %81
  %135 = load i64, ptr %8, align 8, !tbaa !11
  %136 = load i32, ptr @k, align 4, !tbaa !8
  %137 = sub nsw i32 %136, 1
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !11
  %141 = icmp slt i64 %135, %140
  br i1 %141, label %142, label %187

142:                                              ; preds = %134
  %143 = load i32, ptr @k, align 4, !tbaa !8
  %144 = sub nsw i32 %143, 1
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !11
  %148 = sub nsw i64 %147, 1
  %149 = load i64, ptr %8, align 8, !tbaa !11
  %150 = sub nsw i64 %148, %149
  %151 = load i32, ptr %6, align 4, !tbaa !8
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !11
  %155 = sdiv i64 %150, %154
  %156 = add nsw i64 %155, 1
  store i64 %156, ptr %9, align 8, !tbaa !11
  %157 = load i32, ptr @k, align 4, !tbaa !8
  %158 = sub nsw i32 %157, 1
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %159
  %161 = load i64, ptr %160, align 8, !tbaa !11
  %162 = sub nsw i64 %161, 1
  %163 = load i64, ptr %8, align 8, !tbaa !11
  %164 = sub nsw i64 %162, %163
  %165 = load i32, ptr %6, align 4, !tbaa !8
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %166
  %168 = load i64, ptr %167, align 8, !tbaa !11
  %169 = sdiv i64 %164, %168
  %170 = load i32, ptr %6, align 4, !tbaa !8
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %171
  %173 = load i64, ptr %172, align 8, !tbaa !11
  %174 = mul nsw i64 %169, %173
  %175 = load i64, ptr %8, align 8, !tbaa !11
  %176 = add nsw i64 %174, %175
  %177 = load i32, ptr @k, align 4, !tbaa !8
  %178 = sub nsw i32 %177, 1
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !11
  %182 = icmp slt i64 %176, %181
  br i1 %182, label %183, label %186

183:                                              ; preds = %142
  %184 = load i64, ptr %9, align 8, !tbaa !11
  %185 = add nsw i64 %184, 1
  store i64 %185, ptr %9, align 8, !tbaa !11
  br label %186

186:                                              ; preds = %183, %142
  br label %187

187:                                              ; preds = %186, %134
  br label %188

188:                                              ; preds = %187, %121
  %189 = load i64, ptr @ans, align 8, !tbaa !11
  %190 = load i64, ptr %7, align 8, !tbaa !11
  %191 = load i64, ptr %9, align 8, !tbaa !11
  %192 = sub nsw i64 %190, %191
  %193 = mul nsw i64 %189, %192
  %194 = load i64, ptr @MOD, align 8, !tbaa !11
  %195 = srem i64 %193, %194
  store i64 %195, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %196

196:                                              ; preds = %188
  %197 = load i32, ptr %6, align 4, !tbaa !8
  %198 = add nsw i32 %197, 1
  store i32 %198, ptr %6, align 4, !tbaa !8
  br label %75, !llvm.loop !17

199:                                              ; preds = %80
  %200 = load i64, ptr @ans, align 8, !tbaa !11
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %200)
  %202 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %201, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

; Function Attrs: mustprogress 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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #4 align 2

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

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

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


; 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::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" }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@MOD = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@a = external dso_local global [100100 x i64], align 16
@b = external dso_local global [100100 x i64], align 16
@p = external dso_local local_unnamed_addr global [10 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader44:
  %0 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = load ptr, ptr @_ZSt4cerr, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt4cerr, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @k)
  %13 = load i32, ptr @n, align 4, !tbaa !8
  %14 = load i32, ptr @k, align 4, !tbaa !8
  store i64 1, ptr @p, align 16, !tbaa !11
  store i64 10, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !11
  store i64 100, ptr getelementptr inbounds (i8, ptr @p, i64 16), align 16, !tbaa !11
  store i64 1000, ptr getelementptr inbounds (i8, ptr @p, i64 24), align 8, !tbaa !11
  store i64 10000, ptr getelementptr inbounds (i8, ptr @p, i64 32), align 16, !tbaa !11
  store i64 100000, ptr getelementptr inbounds (i8, ptr @p, i64 40), align 8, !tbaa !11
  store i64 1000000, ptr getelementptr inbounds (i8, ptr @p, i64 48), align 16, !tbaa !11
  store i64 10000000, ptr getelementptr inbounds (i8, ptr @p, i64 56), align 8, !tbaa !11
  store i64 100000000, ptr getelementptr inbounds (i8, ptr @p, i64 64), align 16, !tbaa !11
  store i64 1000000000, ptr getelementptr inbounds (i8, ptr @p, i64 72), align 8, !tbaa !11
  %15 = sdiv i32 %13, %14
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph.preheader, label %.preheader._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader44
  %wide.trip.count = zext nneg i32 %15 to i64
  br label %.lr.ph

.preheader43:                                     ; preds = %.lr.ph
  br i1 %16, label %.lr.ph48.preheader, label %.preheader._crit_edge

.lr.ph48.preheader:                               ; preds = %.preheader43
  %wide.trip.count57 = zext nneg i32 %15 to i64
  br label %.lr.ph48

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %17 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv
  %18 = 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) %17)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader43, label %.lr.ph, !llvm.loop !13

.preheader:                                       ; preds = %.lr.ph48
  br i1 %16, label %.lr.ph50, label %.preheader._crit_edge

.preheader._crit_edge:                            ; preds = %.preheader44, %.preheader43, %.preheader
  %.pre = load i64, ptr @ans, align 8, !tbaa !11
  br label %32

.lr.ph50:                                         ; preds = %.preheader
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !11
  %19 = load i32, ptr @k, align 4, !tbaa !8
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %20
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = add nsw i64 %22, -1
  %24 = add nsw i32 %19, -1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10 x i64], ptr @p, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = add nsw i64 %27, -1
  %29 = load i64, ptr @MOD, align 8, !tbaa !11
  %wide.trip.count62 = zext nneg i32 %15 to i64
  br label %36

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %.lr.ph48
  %indvars.iv54 = phi i64 [ 0, %.lr.ph48.preheader ], [ %indvars.iv.next55, %.lr.ph48 ]
  %30 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv54
  %31 = 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) %30)
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond58.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count57
  br i1 %exitcond58.not, label %.preheader, label %.lr.ph48, !llvm.loop !15

._crit_edge:                                      ; preds = %60
  store i64 %63, ptr @ans, align 8, !tbaa !11
  br label %32

32:                                               ; preds = %.preheader._crit_edge, %._crit_edge
  %33 = phi i64 [ %.pre, %.preheader._crit_edge ], [ %63, %._crit_edge ]
  %34 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %33)
  %35 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %34, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

36:                                               ; preds = %.lr.ph50, %60
  %indvars.iv59 = phi i64 [ 0, %.lr.ph50 ], [ %indvars.iv.next60, %60 ]
  %37 = phi i64 [ %ans.promoted, %.lr.ph50 ], [ %63, %60 ]
  %38 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv59
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %40 = sdiv i64 %23, %39
  %41 = add nsw i64 %40, 1
  %42 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv59
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = mul nsw i64 %27, %43
  %45 = srem i64 %44, %39
  %46 = sub nsw i64 %39, %45
  %47 = srem i64 %46, %39
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %49, label %51

49:                                               ; preds = %36
  %50 = sdiv i64 %28, %39
  %.neg = xor i64 %50, -1
  br label %60

51:                                               ; preds = %36
  %52 = icmp slt i64 %47, %27
  br i1 %52, label %53, label %60

53:                                               ; preds = %51
  %54 = xor i64 %47, -1
  %55 = add i64 %27, %54
  %56 = sdiv i64 %55, %39
  %57 = mul nsw i64 %56, %39
  %58 = add nsw i64 %57, %47
  %59 = icmp slt i64 %58, %27
  %spec.select.v.neg = select i1 %59, i64 -2, i64 -1
  %spec.select.neg = sub i64 %spec.select.v.neg, %56
  br label %60

60:                                               ; preds = %53, %51, %49
  %.0.neg51 = phi i64 [ %.neg, %49 ], [ 0, %51 ], [ %spec.select.neg, %53 ]
  %61 = add i64 %41, %.0.neg51
  %62 = mul nsw i64 %37, %61
  %63 = srem i64 %62, %29
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond63.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count62
  br i1 %exitcond63.not, label %._crit_edge, label %36, !llvm.loop !16
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; 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: 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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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