; LLVM IR from eyangch/competitive-programming :: Codeforces/1644 (d)

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

@MOD = external dso_local global i64, align 8
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@X = external dso_local global [200000 x i64], align 16
@Y = external dso_local global [200000 x i64], align 16
@xd = external dso_local global [200000 x i8], align 16
@yd = external dso_local global [200000 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", 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 i32, align 4
  %3 = alloca i32, align 4
  %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 i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @T)
  br label %20

20:                                               ; preds = %143, %0
  %21 = load i64, ptr @T, align 8, !tbaa !8
  %22 = add nsw i64 %21, -1
  store i64 %22, ptr @T, align 8, !tbaa !8
  %23 = icmp ne i64 %21, 0
  br i1 %23, label %24, label %147

24:                                               ; preds = %20
  %25 = 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)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %29 = load i64, ptr @N, align 8, !tbaa !8
  %30 = getelementptr inbounds i8, ptr @xd, i64 %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef @xd, ptr noundef %30, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %31 = load i64, ptr @M, align 8, !tbaa !8
  %32 = getelementptr inbounds i8, ptr @yd, i64 %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef @yd, ptr noundef %32, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %33

33:                                               ; preds = %53, %24
  %34 = load i64, ptr %4, align 8, !tbaa !8
  %35 = load i64, ptr @Q, align 8, !tbaa !8
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  %39 = load i64, ptr %4, align 8, !tbaa !8
  %40 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %39
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %40)
  %42 = load i64, ptr %4, align 8, !tbaa !8
  %43 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %42
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %41, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i64, ptr %4, align 8, !tbaa !8
  %46 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = add nsw i64 %47, -1
  store i64 %48, ptr %46, align 8, !tbaa !8
  %49 = load i64, ptr %4, align 8, !tbaa !8
  %50 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = add nsw i64 %51, -1
  store i64 %52, ptr %50, align 8, !tbaa !8
  br label %53

53:                                               ; preds = %38
  %54 = load i64, ptr %4, align 8, !tbaa !8
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %4, align 8, !tbaa !8
  br label %33, !llvm.loop !13

56:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %57 = load i64, ptr @N, align 8, !tbaa !8
  store i64 %57, ptr %5, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %58 = load i64, ptr @M, align 8, !tbaa !8
  store i64 %58, ptr %6, 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
  %59 = load i64, ptr @Q, align 8, !tbaa !8
  %60 = sub nsw i64 %59, 1
  store i64 %60, ptr %8, align 8, !tbaa !8
  br label %61

61:                                               ; preds = %140, %56
  %62 = load i64, ptr %8, align 8, !tbaa !8
  %63 = icmp sge i64 %62, 0
  br i1 %63, label %65, label %64

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

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #6
  store i8 0, ptr %10, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  %66 = load i64, ptr %8, align 8, !tbaa !8
  %67 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %69 = getelementptr inbounds [200000 x i8], ptr @xd, i64 0, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !15, !range !17, !noundef !18
  %71 = trunc i8 %70 to i1
  br i1 %71, label %76, label %72

72:                                               ; preds = %65
  %73 = load i64, ptr %6, align 8, !tbaa !8
  %74 = icmp ne i64 %73, 0
  %75 = xor i1 %74, true
  br label %76

76:                                               ; preds = %72, %65
  %77 = phi i1 [ true, %65 ], [ %75, %72 ]
  %78 = zext i1 %77 to i8
  store i8 %78, ptr %11, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #6
  %79 = load i64, ptr %8, align 8, !tbaa !8
  %80 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = getelementptr inbounds [200000 x i8], ptr @yd, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !15, !range !17, !noundef !18
  %84 = trunc i8 %83 to i1
  br i1 %84, label %89, label %85

85:                                               ; preds = %76
  %86 = load i64, ptr %5, align 8, !tbaa !8
  %87 = icmp ne i64 %86, 0
  %88 = xor i1 %87, true
  br label %89

89:                                               ; preds = %85, %76
  %90 = phi i1 [ true, %76 ], [ %88, %85 ]
  %91 = zext i1 %90 to i8
  store i8 %91, ptr %12, align 1, !tbaa !15
  %92 = load i8, ptr %11, align 1, !tbaa !15, !range !17, !noundef !18
  %93 = trunc i8 %92 to i1
  br i1 %93, label %94, label %97

94:                                               ; preds = %89
  %95 = load i8, ptr %12, align 1, !tbaa !15, !range !17, !noundef !18
  %96 = trunc i8 %95 to i1
  br label %97

97:                                               ; preds = %94, %89
  %98 = phi i1 [ false, %89 ], [ %96, %94 ]
  %99 = zext i1 %98 to i8
  store i8 %99, ptr %10, align 1, !tbaa !15
  %100 = load i8, ptr %10, align 1, !tbaa !15, !range !17, !noundef !18
  %101 = trunc i8 %100 to i1
  br i1 %101, label %102, label %103

102:                                              ; preds = %97
  store i32 9, ptr %9, align 4
  br label %137

103:                                              ; preds = %97
  %104 = load i64, ptr %7, align 8, !tbaa !8
  %105 = load i64, ptr @K, align 8, !tbaa !8
  %106 = mul nsw i64 %104, %105
  %107 = load i64, ptr @MOD, align 8, !tbaa !8
  %108 = srem i64 %106, %107
  store i64 %108, ptr %7, align 8, !tbaa !8
  %109 = load i64, ptr %8, align 8, !tbaa !8
  %110 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !8
  %112 = getelementptr inbounds [200000 x i8], ptr @xd, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !15, !range !17, !noundef !18
  %114 = trunc i8 %113 to i1
  br i1 %114, label %122, label %115

115:                                              ; preds = %103
  %116 = load i64, ptr %8, align 8, !tbaa !8
  %117 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !8
  %119 = getelementptr inbounds [200000 x i8], ptr @xd, i64 0, i64 %118
  store i8 1, ptr %119, align 1, !tbaa !15
  %120 = load i64, ptr %5, align 8, !tbaa !8
  %121 = add nsw i64 %120, -1
  store i64 %121, ptr %5, align 8, !tbaa !8
  br label %122

122:                                              ; preds = %115, %103
  %123 = load i64, ptr %8, align 8, !tbaa !8
  %124 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %123
  %125 = load i64, ptr %124, align 8, !tbaa !8
  %126 = getelementptr inbounds [200000 x i8], ptr @yd, i64 0, i64 %125
  %127 = load i8, ptr %126, align 1, !tbaa !15, !range !17, !noundef !18
  %128 = trunc i8 %127 to i1
  br i1 %128, label %136, label %129

129:                                              ; preds = %122
  %130 = load i64, ptr %8, align 8, !tbaa !8
  %131 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %130
  %132 = load i64, ptr %131, align 8, !tbaa !8
  %133 = getelementptr inbounds [200000 x i8], ptr @yd, i64 0, i64 %132
  store i8 1, ptr %133, align 1, !tbaa !15
  %134 = load i64, ptr %6, align 8, !tbaa !8
  %135 = add nsw i64 %134, -1
  store i64 %135, ptr %6, align 8, !tbaa !8
  br label %136

136:                                              ; preds = %129, %122
  store i32 0, ptr %9, align 4
  br label %137

137:                                              ; preds = %136, %102
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  %138 = load i32, ptr %9, align 4
  switch i32 %138, label %149 [
    i32 0, label %139
    i32 9, label %140
  ]

139:                                              ; preds = %137
  br label %140

140:                                              ; preds = %139, %137
  %141 = load i64, ptr %8, align 8, !tbaa !8
  %142 = add nsw i64 %141, -1
  store i64 %142, ptr %8, align 8, !tbaa !8
  br label %61, !llvm.loop !19

143:                                              ; preds = %64
  %144 = load i64, ptr %7, align 8, !tbaa !8
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %144)
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %145, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %20, !llvm.loop !20

147:                                              ; preds = %20
  %148 = load i32, ptr %1, align 4
  ret i32 %148

149:                                              ; preds = %137
  unreachable
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #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)) #3 align 2

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

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

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

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

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

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

@MOD = external dso_local local_unnamed_addr global i64, align 8
@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@X = external dso_local global [200000 x i64], align 16
@Y = external dso_local global [200000 x i64], align 16
@xd = external dso_local global [200000 x i8], align 16
@yd = external dso_local global [200000 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", 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 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = 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) @T)
  %10 = load i64, ptr @T, align 8, !tbaa !8
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr @T, align 8, !tbaa !8
  %.not44 = icmp eq i64 %10, 0
  br i1 %.not44, label %._crit_edge47, label %.lr.ph46

.lr.ph46:                                         ; preds = %0, %._crit_edge42
  %12 = 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)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  %16 = load i64, ptr @N, align 8, !tbaa !8
  %17 = getelementptr inbounds i8, ptr @xd, i64 %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull @xd, ptr noundef nonnull %17, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %18 = load i64, ptr @M, align 8, !tbaa !8
  %19 = getelementptr inbounds i8, ptr @yd, i64 %18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 0, ptr %2, align 4, !tbaa !11
  call void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef nonnull @yd, ptr noundef nonnull %19, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %20 = load i64, ptr @Q, align 8, !tbaa !8
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge42

._crit_edge:                                      ; preds = %.lr.ph
  %22 = icmp sgt i64 %36, 0
  br i1 %22, label %.lr.ph41, label %._crit_edge42

.lr.ph41:                                         ; preds = %._crit_edge
  %23 = load i64, ptr @M, align 8, !tbaa !8
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %25 = load i64, ptr @K, align 8
  %26 = load i64, ptr @MOD, align 8
  br label %42

.lr.ph:                                           ; preds = %.lr.ph46, %.lr.ph
  %.034 = phi i64 [ %35, %.lr.ph ], [ 0, %.lr.ph46 ]
  %27 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %.034
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %.034
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %27, align 8, !tbaa !8
  %32 = add nsw i64 %31, -1
  store i64 %32, ptr %27, align 8, !tbaa !8
  %33 = load i64, ptr %29, align 8, !tbaa !8
  %34 = add nsw i64 %33, -1
  store i64 %34, ptr %29, align 8, !tbaa !8
  %35 = add nuw nsw i64 %.034, 1
  %36 = load i64, ptr @Q, align 8, !tbaa !8
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge42:                                    ; preds = %64, %.lr.ph46, %._crit_edge
  %.029.lcssa = phi i64 [ 1, %._crit_edge ], [ 1, %.lr.ph46 ], [ %.130, %64 ]
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.029.lcssa)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %38, i8 noundef signext 10)
  %40 = load i64, ptr @T, align 8, !tbaa !8
  %41 = add nsw i64 %40, -1
  store i64 %41, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %40, 0
  br i1 %.not, label %._crit_edge47, label %.lr.ph46, !llvm.loop !15

42:                                               ; preds = %.lr.ph41, %64
  %.02839.in = phi i64 [ %36, %.lr.ph41 ], [ %.02839, %64 ]
  %.02438 = phi i64 [ %24, %.lr.ph41 ], [ %.2, %64 ]
  %.02537 = phi i64 [ %23, %.lr.ph41 ], [ %.227, %64 ]
  %.02936 = phi i64 [ 1, %.lr.ph41 ], [ %.130, %64 ]
  %.02839 = add nsw i64 %.02839.in, -1
  %43 = getelementptr inbounds [200000 x i64], ptr @X, i64 0, i64 %.02839
  %44 = load i64, ptr %43, align 8, !tbaa !8
  %45 = getelementptr inbounds [200000 x i8], ptr @xd, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !16, !range !18, !noundef !19
  %47 = trunc nuw i8 %46 to i1
  %.not32 = icmp eq i64 %.02537, 0
  %48 = select i1 %47, i1 true, i1 %.not32
  %49 = getelementptr inbounds [200000 x i64], ptr @Y, i64 0, i64 %.02839
  %50 = load i64, ptr %49, align 8, !tbaa !8
  %51 = getelementptr inbounds [200000 x i8], ptr @yd, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !16, !range !18, !noundef !19
  %53 = trunc nuw i8 %52 to i1
  %.not33 = icmp eq i64 %.02438, 0
  %54 = select i1 %53, i1 true, i1 %.not33
  %55 = select i1 %48, i1 %54, i1 false
  br i1 %55, label %64, label %56

56:                                               ; preds = %42
  %57 = mul nsw i64 %25, %.02936
  %58 = srem i64 %57, %26
  br i1 %47, label %61, label %59

59:                                               ; preds = %56
  store i8 1, ptr %45, align 1, !tbaa !16
  %60 = add nsw i64 %.02438, -1
  br label %61

61:                                               ; preds = %59, %56
  %.1 = phi i64 [ %.02438, %56 ], [ %60, %59 ]
  br i1 %53, label %64, label %62

62:                                               ; preds = %61
  store i8 1, ptr %51, align 1, !tbaa !16
  %63 = add nsw i64 %.02537, -1
  br label %64

64:                                               ; preds = %61, %62, %42
  %.130 = phi i64 [ %.02936, %42 ], [ %58, %62 ], [ %58, %61 ]
  %.227 = phi i64 [ %.02537, %42 ], [ %63, %62 ], [ %.02537, %61 ]
  %.2 = phi i64 [ %.02438, %42 ], [ %.1, %62 ], [ %.1, %61 ]
  %65 = icmp ugt i64 %.02839.in, 1
  br i1 %65, label %42, label %._crit_edge42, !llvm.loop !20

._crit_edge47:                                    ; preds = %._crit_edge42, %0
  ret i32 0
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #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 dso_local void @_ZSt4fillIPbiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) 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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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" }
attributes #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !14}


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